got rid of weak_ptr from DocumentTiming and DocumentLoadTiming

used a RawPtrWillBeMember instead because Oilpan can deal with
these ownership cycles


BUG=382542

Review URL: https://codereview.chromium.org/1290683003

git-svn-id: svn://svn.chromium.org/blink/trunk@200759 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 80d80446
......@@ -421,7 +421,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_loadEventDelayCount(0)
, m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
, m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired)
, m_documentTiming(this->weakReference())
, m_documentTiming(*this)
, m_writeRecursionIsTooDeep(false)
, m_writeRecursionDepth(0)
, m_taskRunner(MainThreadTaskRunner::create(this))
......@@ -4394,18 +4394,13 @@ WeakPtrWillBeRawPtr<Document> Document::contextDocument()
if (m_contextDocument)
return m_contextDocument;
if (m_frame) {
return weakReference();
}
return WeakPtrWillBeRawPtr<Document>(nullptr);
}
WeakPtrWillBeRawPtr<Document> Document::weakReference()
{
#if ENABLE(OILPAN)
return this;
return this;
#else
return m_weakFactory.createWeakPtr();
return m_weakFactory.createWeakPtr();
#endif
}
return nullptr;
}
PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState)
......
......@@ -1101,7 +1101,6 @@ private:
void refExecutionContext() final { ref(); }
void derefExecutionContext() final { deref(); }
#endif
WeakPtrWillBeRawPtr<Document> weakReference();
const KURL& virtualURL() const final; // Same as url(), but needed for ExecutionContext to implement it without a performance loss for direct calls.
KURL virtualCompleteURL(const String&) const final; // Same as completeURL() for the same reason as above.
......
......@@ -8,10 +8,11 @@
#include "core/dom/Document.h"
#include "core/loader/DocumentLoader.h"
#include "platform/TraceEvent.h"
#include "wtf/RawPtr.h"
namespace blink {
DocumentTiming::DocumentTiming(WeakPtrWillBeRawPtr<Document> document)
DocumentTiming::DocumentTiming(Document& document)
: m_domLoading(0.0)
, m_domInteractive(0.0)
, m_domContentLoadedEventStart(0.0)
......
......@@ -35,7 +35,7 @@ class Document;
class DocumentTiming final {
DISALLOW_ALLOCATION();
public:
DocumentTiming(WeakPtrWillBeRawPtr<Document>);
explicit DocumentTiming(Document&);
void markDomLoading();
void markDomInteractive();
......@@ -63,7 +63,7 @@ private:
double m_domComplete;
double m_firstLayout;
WeakPtrWillBeMember<Document> m_document;
RawPtrWillBeMember<Document> m_document;
};
}
......
......@@ -29,11 +29,12 @@
#include "core/loader/DocumentLoader.h"
#include "platform/TraceEvent.h"
#include "platform/weborigin/SecurityOrigin.h"
#include "wtf/RawPtr.h"
#include "wtf/RefPtr.h"
namespace blink {
DocumentLoadTiming::DocumentLoadTiming(WeakPtrWillBeRawPtr<DocumentLoader> documentLoader)
DocumentLoadTiming::DocumentLoadTiming(DocumentLoader& documentLoader)
: m_referenceMonotonicTime(0.0)
, m_referenceWallTime(0.0)
, m_navigationStart(0.0)
......
......@@ -29,7 +29,6 @@
#include "core/CoreExport.h"
#include "platform/heap/Handle.h"
#include "wtf/CurrentTime.h"
#include "wtf/WeakPtr.h"
namespace blink {
......@@ -39,7 +38,7 @@ class KURL;
class CORE_EXPORT DocumentLoadTiming final {
DISALLOW_ALLOCATION();
public:
DocumentLoadTiming(WeakPtrWillBeRawPtr<DocumentLoader>);
explicit DocumentLoadTiming(DocumentLoader&);
double monotonicTimeToZeroBasedDocumentTime(double) const;
double monotonicTimeToPseudoWallTime(double) const;
......@@ -95,7 +94,7 @@ private:
bool m_hasCrossOriginRedirect;
bool m_hasSameOriginAsPreviousDocument;
WeakPtrWillBeMember<DocumentLoader> m_documentLoader;
RawPtrWillBeMember<DocumentLoader> m_documentLoader;
};
} // namespace blink
......
......@@ -91,10 +91,7 @@ DocumentLoader::DocumentLoader(LocalFrame* frame, const ResourceRequest& req, co
, m_isClientRedirect(false)
, m_replacesCurrentHistoryItem(false)
, m_navigationType(NavigationTypeOther)
#if !ENABLE(OILPAN)
, m_weakFactory(this)
#endif
, m_documentLoadTiming(this->weakReference())
, m_documentLoadTiming(*this)
, m_timeOfLastDataReceived(0.0)
, m_applicationCacheHost(ApplicationCacheHost::create(this))
, m_state(NotStarted)
......@@ -443,15 +440,6 @@ bool DocumentLoader::shouldContinueForResponse() const
return true;
}
WeakPtrWillBeRawPtr<DocumentLoader> DocumentLoader::weakReference()
{
#if ENABLE(OILPAN)
return this;
#else
return m_weakFactory.createWeakPtr();
#endif
}
void DocumentLoader::cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceResponse& response)
{
InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame, this, mainResourceIdentifier(), response);
......
......@@ -188,8 +188,6 @@ private:
bool shouldContinueForResponse() const;
WeakPtrWillBeRawPtr<DocumentLoader> weakReference();
RawPtrWillBeMember<LocalFrame> m_frame;
PersistentWillBeMember<ResourceFetcher> m_fetcher;
......@@ -220,9 +218,6 @@ private:
RefPtrWillBeMember<MHTMLArchive> m_archive;
#if !ENABLE(OILPAN)
WeakPtrFactory<DocumentLoader> m_weakFactory;
#endif
DocumentLoadTiming m_documentLoadTiming;
double m_timeOfLastDataReceived;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment