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 ...@@ -421,7 +421,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_loadEventDelayCount(0) , m_loadEventDelayCount(0)
, m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
, m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired) , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired)
, m_documentTiming(this->weakReference()) , m_documentTiming(*this)
, m_writeRecursionIsTooDeep(false) , m_writeRecursionIsTooDeep(false)
, m_writeRecursionDepth(0) , m_writeRecursionDepth(0)
, m_taskRunner(MainThreadTaskRunner::create(this)) , m_taskRunner(MainThreadTaskRunner::create(this))
...@@ -4394,18 +4394,13 @@ WeakPtrWillBeRawPtr<Document> Document::contextDocument() ...@@ -4394,18 +4394,13 @@ WeakPtrWillBeRawPtr<Document> Document::contextDocument()
if (m_contextDocument) if (m_contextDocument)
return m_contextDocument; return m_contextDocument;
if (m_frame) { if (m_frame) {
return weakReference();
}
return WeakPtrWillBeRawPtr<Document>(nullptr);
}
WeakPtrWillBeRawPtr<Document> Document::weakReference()
{
#if ENABLE(OILPAN) #if ENABLE(OILPAN)
return this; return this;
#else #else
return m_weakFactory.createWeakPtr(); return m_weakFactory.createWeakPtr();
#endif #endif
}
return nullptr;
} }
PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState) PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState)
......
...@@ -1101,7 +1101,6 @@ private: ...@@ -1101,7 +1101,6 @@ private:
void refExecutionContext() final { ref(); } void refExecutionContext() final { ref(); }
void derefExecutionContext() final { deref(); } void derefExecutionContext() final { deref(); }
#endif #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. 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. KURL virtualCompleteURL(const String&) const final; // Same as completeURL() for the same reason as above.
......
...@@ -8,10 +8,11 @@ ...@@ -8,10 +8,11 @@
#include "core/dom/Document.h" #include "core/dom/Document.h"
#include "core/loader/DocumentLoader.h" #include "core/loader/DocumentLoader.h"
#include "platform/TraceEvent.h" #include "platform/TraceEvent.h"
#include "wtf/RawPtr.h"
namespace blink { namespace blink {
DocumentTiming::DocumentTiming(WeakPtrWillBeRawPtr<Document> document) DocumentTiming::DocumentTiming(Document& document)
: m_domLoading(0.0) : m_domLoading(0.0)
, m_domInteractive(0.0) , m_domInteractive(0.0)
, m_domContentLoadedEventStart(0.0) , m_domContentLoadedEventStart(0.0)
......
...@@ -35,7 +35,7 @@ class Document; ...@@ -35,7 +35,7 @@ class Document;
class DocumentTiming final { class DocumentTiming final {
DISALLOW_ALLOCATION(); DISALLOW_ALLOCATION();
public: public:
DocumentTiming(WeakPtrWillBeRawPtr<Document>); explicit DocumentTiming(Document&);
void markDomLoading(); void markDomLoading();
void markDomInteractive(); void markDomInteractive();
...@@ -63,7 +63,7 @@ private: ...@@ -63,7 +63,7 @@ private:
double m_domComplete; double m_domComplete;
double m_firstLayout; double m_firstLayout;
WeakPtrWillBeMember<Document> m_document; RawPtrWillBeMember<Document> m_document;
}; };
} }
......
...@@ -29,11 +29,12 @@ ...@@ -29,11 +29,12 @@
#include "core/loader/DocumentLoader.h" #include "core/loader/DocumentLoader.h"
#include "platform/TraceEvent.h" #include "platform/TraceEvent.h"
#include "platform/weborigin/SecurityOrigin.h" #include "platform/weborigin/SecurityOrigin.h"
#include "wtf/RawPtr.h"
#include "wtf/RefPtr.h" #include "wtf/RefPtr.h"
namespace blink { namespace blink {
DocumentLoadTiming::DocumentLoadTiming(WeakPtrWillBeRawPtr<DocumentLoader> documentLoader) DocumentLoadTiming::DocumentLoadTiming(DocumentLoader& documentLoader)
: m_referenceMonotonicTime(0.0) : m_referenceMonotonicTime(0.0)
, m_referenceWallTime(0.0) , m_referenceWallTime(0.0)
, m_navigationStart(0.0) , m_navigationStart(0.0)
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "platform/heap/Handle.h" #include "platform/heap/Handle.h"
#include "wtf/CurrentTime.h" #include "wtf/CurrentTime.h"
#include "wtf/WeakPtr.h"
namespace blink { namespace blink {
...@@ -39,7 +38,7 @@ class KURL; ...@@ -39,7 +38,7 @@ class KURL;
class CORE_EXPORT DocumentLoadTiming final { class CORE_EXPORT DocumentLoadTiming final {
DISALLOW_ALLOCATION(); DISALLOW_ALLOCATION();
public: public:
DocumentLoadTiming(WeakPtrWillBeRawPtr<DocumentLoader>); explicit DocumentLoadTiming(DocumentLoader&);
double monotonicTimeToZeroBasedDocumentTime(double) const; double monotonicTimeToZeroBasedDocumentTime(double) const;
double monotonicTimeToPseudoWallTime(double) const; double monotonicTimeToPseudoWallTime(double) const;
...@@ -95,7 +94,7 @@ private: ...@@ -95,7 +94,7 @@ private:
bool m_hasCrossOriginRedirect; bool m_hasCrossOriginRedirect;
bool m_hasSameOriginAsPreviousDocument; bool m_hasSameOriginAsPreviousDocument;
WeakPtrWillBeMember<DocumentLoader> m_documentLoader; RawPtrWillBeMember<DocumentLoader> m_documentLoader;
}; };
} // namespace blink } // namespace blink
......
...@@ -91,10 +91,7 @@ DocumentLoader::DocumentLoader(LocalFrame* frame, const ResourceRequest& req, co ...@@ -91,10 +91,7 @@ DocumentLoader::DocumentLoader(LocalFrame* frame, const ResourceRequest& req, co
, m_isClientRedirect(false) , m_isClientRedirect(false)
, m_replacesCurrentHistoryItem(false) , m_replacesCurrentHistoryItem(false)
, m_navigationType(NavigationTypeOther) , m_navigationType(NavigationTypeOther)
#if !ENABLE(OILPAN) , m_documentLoadTiming(*this)
, m_weakFactory(this)
#endif
, m_documentLoadTiming(this->weakReference())
, m_timeOfLastDataReceived(0.0) , m_timeOfLastDataReceived(0.0)
, m_applicationCacheHost(ApplicationCacheHost::create(this)) , m_applicationCacheHost(ApplicationCacheHost::create(this))
, m_state(NotStarted) , m_state(NotStarted)
...@@ -443,15 +440,6 @@ bool DocumentLoader::shouldContinueForResponse() const ...@@ -443,15 +440,6 @@ bool DocumentLoader::shouldContinueForResponse() const
return true; return true;
} }
WeakPtrWillBeRawPtr<DocumentLoader> DocumentLoader::weakReference()
{
#if ENABLE(OILPAN)
return this;
#else
return m_weakFactory.createWeakPtr();
#endif
}
void DocumentLoader::cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceResponse& response) void DocumentLoader::cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceResponse& response)
{ {
InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame, this, mainResourceIdentifier(), response); InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame, this, mainResourceIdentifier(), response);
......
...@@ -188,8 +188,6 @@ private: ...@@ -188,8 +188,6 @@ private:
bool shouldContinueForResponse() const; bool shouldContinueForResponse() const;
WeakPtrWillBeRawPtr<DocumentLoader> weakReference();
RawPtrWillBeMember<LocalFrame> m_frame; RawPtrWillBeMember<LocalFrame> m_frame;
PersistentWillBeMember<ResourceFetcher> m_fetcher; PersistentWillBeMember<ResourceFetcher> m_fetcher;
...@@ -220,9 +218,6 @@ private: ...@@ -220,9 +218,6 @@ private:
RefPtrWillBeMember<MHTMLArchive> m_archive; RefPtrWillBeMember<MHTMLArchive> m_archive;
#if !ENABLE(OILPAN)
WeakPtrFactory<DocumentLoader> m_weakFactory;
#endif
DocumentLoadTiming m_documentLoadTiming; DocumentLoadTiming m_documentLoadTiming;
double m_timeOfLastDataReceived; 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