Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: Source/core/dom/Document.cpp

Issue 1290683003: Remove WeakPtrs from DocumentTiming/DocumentLoadTiming (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 , m_isMobileDocument(false) 414 , m_isMobileDocument(false)
415 , m_layoutView(0) 415 , m_layoutView(0)
416 #if !ENABLE(OILPAN) 416 #if !ENABLE(OILPAN)
417 , m_weakFactory(this) 417 , m_weakFactory(this)
418 #endif 418 #endif
419 , m_contextDocument(initializer.contextDocument()) 419 , m_contextDocument(initializer.contextDocument())
420 , m_hasFullscreenSupplement(false) 420 , m_hasFullscreenSupplement(false)
421 , m_loadEventDelayCount(0) 421 , m_loadEventDelayCount(0)
422 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) 422 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
423 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired) 423 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired)
424 , m_documentTiming(this->weakReference()) 424 , m_documentTiming(this)
425 , m_writeRecursionIsTooDeep(false) 425 , m_writeRecursionIsTooDeep(false)
426 , m_writeRecursionDepth(0) 426 , m_writeRecursionDepth(0)
427 , m_taskRunner(MainThreadTaskRunner::create(this)) 427 , m_taskRunner(MainThreadTaskRunner::create(this))
428 , m_registrationContext(initializer.registrationContext(this)) 428 , m_registrationContext(initializer.registrationContext(this))
429 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red) 429 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red)
430 , m_timeline(AnimationTimeline::create(this)) 430 , m_timeline(AnimationTimeline::create(this))
431 , m_templateDocumentHost(nullptr) 431 , m_templateDocumentHost(nullptr)
432 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired) 432 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired)
433 , m_hasViewportUnits(false) 433 , m_hasViewportUnits(false)
434 , m_styleRecalcElementCounter(0) 434 , m_styleRecalcElementCounter(0)
(...skipping 3952 matching lines...) Expand 10 before | Expand all | Expand 10 after
4387 4387
4388 ASSERT(doc); 4388 ASSERT(doc);
4389 return *doc; 4389 return *doc;
4390 } 4390 }
4391 4391
4392 WeakPtrWillBeRawPtr<Document> Document::contextDocument() 4392 WeakPtrWillBeRawPtr<Document> Document::contextDocument()
4393 { 4393 {
4394 if (m_contextDocument) 4394 if (m_contextDocument)
4395 return m_contextDocument; 4395 return m_contextDocument;
4396 if (m_frame) { 4396 if (m_frame) {
4397 return weakReference(); 4397 #if ENABLE(OILPAN)
4398 return this;
4399 #else
4400 return m_weakFactory.createWeakPtr();
4401 #endif
4398 } 4402 }
4399 return WeakPtrWillBeRawPtr<Document>(nullptr); 4403 return WeakPtrWillBeRawPtr<Document>(nullptr);
dcheng 2015/08/18 19:25:32 I think nullptr by itself should work here.
4400 } 4404 }
4401 4405
4402 WeakPtrWillBeRawPtr<Document> Document::weakReference()
4403 {
4404 #if ENABLE(OILPAN)
4405 return this;
4406 #else
4407 return m_weakFactory.createWeakPtr();
4408 #endif
4409 }
4410
4411 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState) 4406 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState)
4412 { 4407 {
4413 if (isHTMLDocument() && name != name.lower()) 4408 if (isHTMLDocument() && name != name.lower())
4414 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL owercase); 4409 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL owercase);
4415 return createAttributeNS(nullAtom, name, exceptionState, true); 4410 return createAttributeNS(nullAtom, name, exceptionState, true);
4416 } 4411 }
4417 4412
4418 PassRefPtrWillBeRawPtr<Attr> Document::createAttributeNS(const AtomicString& nam espaceURI, const AtomicString& qualifiedName, ExceptionState& exceptionState, bo ol shouldIgnoreNamespaceChecks) 4413 PassRefPtrWillBeRawPtr<Attr> Document::createAttributeNS(const AtomicString& nam espaceURI, const AtomicString& qualifiedName, ExceptionState& exceptionState, bo ol shouldIgnoreNamespaceChecks)
4419 { 4414 {
4420 AtomicString prefix, localName; 4415 AtomicString prefix, localName;
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after
5684 #ifndef NDEBUG 5679 #ifndef NDEBUG
5685 using namespace blink; 5680 using namespace blink;
5686 void showLiveDocumentInstances() 5681 void showLiveDocumentInstances()
5687 { 5682 {
5688 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5683 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5689 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5684 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5690 for (Document* document : set) 5685 for (Document* document : set)
5691 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5686 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5692 } 5687 }
5693 #endif 5688 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698