Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 #include "core/dom/DocumentFragment.h" | 69 #include "core/dom/DocumentFragment.h" |
| 70 #include "core/dom/DocumentLifecycleObserver.h" | 70 #include "core/dom/DocumentLifecycleObserver.h" |
| 71 #include "core/dom/DocumentType.h" | 71 #include "core/dom/DocumentType.h" |
| 72 #include "core/dom/Element.h" | 72 #include "core/dom/Element.h" |
| 73 #include "core/dom/ElementDataCache.h" | 73 #include "core/dom/ElementDataCache.h" |
| 74 #include "core/dom/ElementRegistrationOptions.h" | 74 #include "core/dom/ElementRegistrationOptions.h" |
| 75 #include "core/dom/ElementTraversal.h" | 75 #include "core/dom/ElementTraversal.h" |
| 76 #include "core/dom/ExceptionCode.h" | 76 #include "core/dom/ExceptionCode.h" |
| 77 #include "core/dom/ExecutionContextTask.h" | 77 #include "core/dom/ExecutionContextTask.h" |
| 78 #include "core/dom/FrameRequestCallback.h" | 78 #include "core/dom/FrameRequestCallback.h" |
| 79 #include "core/dom/IntersectionObserverRegistry.h" | |
| 79 #include "core/dom/LayoutTreeBuilderTraversal.h" | 80 #include "core/dom/LayoutTreeBuilderTraversal.h" |
| 80 #include "core/dom/MainThreadTaskRunner.h" | 81 #include "core/dom/MainThreadTaskRunner.h" |
| 81 #include "core/dom/Microtask.h" | 82 #include "core/dom/Microtask.h" |
| 82 #include "core/dom/MutationObserver.h" | 83 #include "core/dom/MutationObserver.h" |
| 83 #include "core/dom/NodeChildRemovalTracker.h" | 84 #include "core/dom/NodeChildRemovalTracker.h" |
| 84 #include "core/dom/NodeComputedStyle.h" | 85 #include "core/dom/NodeComputedStyle.h" |
| 85 #include "core/dom/NodeFilter.h" | 86 #include "core/dom/NodeFilter.h" |
| 86 #include "core/dom/NodeIterator.h" | 87 #include "core/dom/NodeIterator.h" |
| 87 #include "core/dom/NodeRareData.h" | 88 #include "core/dom/NodeRareData.h" |
| 88 #include "core/dom/NodeTraversal.h" | 89 #include "core/dom/NodeTraversal.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 , m_isMobileDocument(false) | 427 , m_isMobileDocument(false) |
| 427 , m_layoutView(0) | 428 , m_layoutView(0) |
| 428 #if !ENABLE(OILPAN) | 429 #if !ENABLE(OILPAN) |
| 429 , m_weakFactory(this) | 430 , m_weakFactory(this) |
| 430 #endif | 431 #endif |
| 431 , m_contextDocument(initializer.contextDocument()) | 432 , m_contextDocument(initializer.contextDocument()) |
| 432 , m_hasFullscreenSupplement(false) | 433 , m_hasFullscreenSupplement(false) |
| 433 , m_loadEventDelayCount(0) | 434 , m_loadEventDelayCount(0) |
| 434 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) | 435 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) |
| 435 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired) | 436 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired) |
| 437 , m_deliverIntersectionObservationsTimer(this, &Document::deliverIntersectio nObservationsTimerFired) | |
| 436 , m_documentTiming(*this) | 438 , m_documentTiming(*this) |
| 437 , m_writeRecursionIsTooDeep(false) | 439 , m_writeRecursionIsTooDeep(false) |
| 438 , m_writeRecursionDepth(0) | 440 , m_writeRecursionDepth(0) |
| 439 , m_taskRunner(MainThreadTaskRunner::create(this)) | 441 , m_taskRunner(MainThreadTaskRunner::create(this)) |
| 440 , m_registrationContext(initializer.registrationContext(this)) | 442 , m_registrationContext(initializer.registrationContext(this)) |
| 441 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red) | 443 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red) |
| 442 , m_timeline(AnimationTimeline::create(this)) | 444 , m_timeline(AnimationTimeline::create(this)) |
| 443 , m_templateDocumentHost(nullptr) | 445 , m_templateDocumentHost(nullptr) |
| 444 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired) | 446 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired) |
| 445 , m_timers(timerTaskRunner()->adoptClone()) | 447 , m_timers(timerTaskRunner()->adoptClone()) |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 595 // FIXME: consider using ActiveDOMObject. | 597 // FIXME: consider using ActiveDOMObject. |
| 596 if (m_scriptedAnimationController) | 598 if (m_scriptedAnimationController) |
| 597 m_scriptedAnimationController->clearDocumentPointer(); | 599 m_scriptedAnimationController->clearDocumentPointer(); |
| 598 m_scriptedAnimationController.clear(); | 600 m_scriptedAnimationController.clear(); |
| 599 | 601 |
| 600 m_scriptedIdleTaskController.clear(); | 602 m_scriptedIdleTaskController.clear(); |
| 601 | 603 |
| 602 if (svgExtensions()) | 604 if (svgExtensions()) |
| 603 accessSVGExtensions().pauseAnimations(); | 605 accessSVGExtensions().pauseAnimations(); |
| 604 | 606 |
| 607 m_deliverIntersectionObservationsTimer.stop(); | |
| 608 | |
| 605 m_lifecycle.advanceTo(DocumentLifecycle::Disposed); | 609 m_lifecycle.advanceTo(DocumentLifecycle::Disposed); |
| 606 DocumentLifecycleNotifier::notifyDocumentWasDisposed(); | 610 DocumentLifecycleNotifier::notifyDocumentWasDisposed(); |
| 607 | 611 |
| 608 m_canvasFontCache.clear(); | 612 m_canvasFontCache.clear(); |
| 609 } | 613 } |
| 610 #endif | 614 #endif |
| 611 | 615 |
| 612 SelectorQueryCache& Document::selectorQueryCache() | 616 SelectorQueryCache& Document::selectorQueryCache() |
| 613 { | 617 { |
| 614 if (!m_selectorQueryCache) | 618 if (!m_selectorQueryCache) |
| (...skipping 3870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4485 | 4489 |
| 4486 ASSERT(doc); | 4490 ASSERT(doc); |
| 4487 return *doc; | 4491 return *doc; |
| 4488 } | 4492 } |
| 4489 | 4493 |
| 4490 WeakPtrWillBeRawPtr<Document> Document::contextDocument() | 4494 WeakPtrWillBeRawPtr<Document> Document::contextDocument() |
| 4491 { | 4495 { |
| 4492 if (m_contextDocument) | 4496 if (m_contextDocument) |
| 4493 return m_contextDocument; | 4497 return m_contextDocument; |
| 4494 if (m_frame) { | 4498 if (m_frame) { |
| 4495 #if ENABLE(OILPAN) | 4499 return createWeakPtr(); |
| 4496 return this; | |
| 4497 #else | |
| 4498 return m_weakFactory.createWeakPtr(); | |
| 4499 #endif | |
| 4500 } | 4500 } |
| 4501 return nullptr; | 4501 return nullptr; |
| 4502 } | 4502 } |
| 4503 | 4503 |
| 4504 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState) | 4504 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState) |
| 4505 { | 4505 { |
| 4506 if (isHTMLDocument() && name != name.lower()) | 4506 if (isHTMLDocument() && name != name.lower()) |
| 4507 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL owercase); | 4507 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL owercase); |
| 4508 return createAttributeNS(nullAtom, name, exceptionState, true); | 4508 return createAttributeNS(nullAtom, name, exceptionState, true); |
| 4509 } | 4509 } |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4965 { | 4965 { |
| 4966 if (equalIgnoringCase(dnsPrefetchControl, "on") && !m_haveExplicitlyDisabled DNSPrefetch) { | 4966 if (equalIgnoringCase(dnsPrefetchControl, "on") && !m_haveExplicitlyDisabled DNSPrefetch) { |
| 4967 m_isDNSPrefetchEnabled = true; | 4967 m_isDNSPrefetchEnabled = true; |
| 4968 return; | 4968 return; |
| 4969 } | 4969 } |
| 4970 | 4970 |
| 4971 m_isDNSPrefetchEnabled = false; | 4971 m_isDNSPrefetchEnabled = false; |
| 4972 m_haveExplicitlyDisabledDNSPrefetch = true; | 4972 m_haveExplicitlyDisabledDNSPrefetch = true; |
| 4973 } | 4973 } |
| 4974 | 4974 |
| 4975 WeakPtrWillBeRawPtr<Document> Document::createWeakPtr() | |
| 4976 { | |
| 4977 #if ENABLE(OILPAN) | |
| 4978 return this; | |
| 4979 #else | |
| 4980 return m_weakFactory.createWeakPtr(); | |
| 4981 #endif | |
| 4982 } | |
| 4983 | |
| 4984 IntersectionObserverRegistry* Document::intersectionObserverRegistry() | |
| 4985 { | |
| 4986 if (!m_intersectionObserverRegistry) | |
| 4987 m_intersectionObserverRegistry = new IntersectionObserverRegistry(m_deli verIntersectionObservationsTimer); | |
|
esprehn
2015/12/12 00:14:13
put the timer in the registry, it doesn't need to
szager1
2015/12/16 19:15:34
Done.
| |
| 4988 return m_intersectionObserverRegistry.get(); | |
| 4989 } | |
| 4990 | |
| 4991 void Document::deliverIntersectionObservationsTimerFired(Timer<Document>*) | |
| 4992 { | |
| 4993 ASSERT(isMainThread()); | |
|
esprehn
2015/12/12 00:14:13
no need for the main thread assert, the whole DOM
szager1
2015/12/16 19:15:34
Done.
| |
| 4994 ASSERT(m_intersectionObserverRegistry); | |
| 4995 m_intersectionObserverRegistry->deliverIntersectionObservations(); | |
|
esprehn
2015/12/12 00:14:13
remove this, move it into the registry
szager1
2015/12/16 19:15:34
Done.
| |
| 4996 } | |
| 4997 | |
| 4975 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe xt) | 4998 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe xt) |
| 4976 { | 4999 { |
| 4977 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); | 5000 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); |
| 4978 } | 5001 } |
| 4979 | 5002 |
| 4980 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM essage) | 5003 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM essage) |
| 4981 { | 5004 { |
| 4982 if (!isContextThread()) { | 5005 if (!isContextThread()) { |
| 4983 m_taskRunner->postTask(BLINK_FROM_HERE, AddConsoleMessageTask::create(co nsoleMessage->source(), consoleMessage->level(), consoleMessage->message())); | 5006 m_taskRunner->postTask(BLINK_FROM_HERE, AddConsoleMessageTask::create(co nsoleMessage->source(), consoleMessage->level(), consoleMessage->message())); |
| 4984 return; | 5007 return; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5022 void Document::tasksWereResumed() | 5045 void Document::tasksWereResumed() |
| 5023 { | 5046 { |
| 5024 scriptRunner()->resume(); | 5047 scriptRunner()->resume(); |
| 5025 | 5048 |
| 5026 if (m_parser) | 5049 if (m_parser) |
| 5027 m_parser->resumeScheduledTasks(); | 5050 m_parser->resumeScheduledTasks(); |
| 5028 if (m_scriptedAnimationController) | 5051 if (m_scriptedAnimationController) |
| 5029 m_scriptedAnimationController->resume(); | 5052 m_scriptedAnimationController->resume(); |
| 5030 | 5053 |
| 5031 MutationObserver::resumeSuspendedObservers(); | 5054 MutationObserver::resumeSuspendedObservers(); |
| 5055 if (m_intersectionObserverRegistry) | |
| 5056 m_intersectionObserverRegistry->resumeSuspendedIntersectionObservers(); | |
| 5032 if (m_domWindow) | 5057 if (m_domWindow) |
| 5033 DOMWindowPerformance::performance(*m_domWindow)->resumeSuspendedObserver s(); | 5058 DOMWindowPerformance::performance(*m_domWindow)->resumeSuspendedObserver s(); |
| 5034 } | 5059 } |
| 5035 | 5060 |
| 5036 // FIXME: suspendScheduledTasks(), resumeScheduledTasks(), tasksNeedSuspension() | 5061 // FIXME: suspendScheduledTasks(), resumeScheduledTasks(), tasksNeedSuspension() |
| 5037 // should be moved to LocalDOMWindow once it inherits ExecutionContext | 5062 // should be moved to LocalDOMWindow once it inherits ExecutionContext |
| 5038 void Document::suspendScheduledTasks() | 5063 void Document::suspendScheduledTasks() |
| 5039 { | 5064 { |
| 5040 ExecutionContext::suspendScheduledTasks(); | 5065 ExecutionContext::suspendScheduledTasks(); |
| 5041 m_taskRunner->suspend(); | 5066 m_taskRunner->suspend(); |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5815 visitor->trace(m_timers); | 5840 visitor->trace(m_timers); |
| 5816 visitor->trace(m_templateDocument); | 5841 visitor->trace(m_templateDocument); |
| 5817 visitor->trace(m_templateDocumentHost); | 5842 visitor->trace(m_templateDocumentHost); |
| 5818 visitor->trace(m_visibilityObservers); | 5843 visitor->trace(m_visibilityObservers); |
| 5819 visitor->trace(m_userActionElements); | 5844 visitor->trace(m_userActionElements); |
| 5820 visitor->trace(m_svgExtensions); | 5845 visitor->trace(m_svgExtensions); |
| 5821 visitor->trace(m_timeline); | 5846 visitor->trace(m_timeline); |
| 5822 visitor->trace(m_compositorPendingAnimations); | 5847 visitor->trace(m_compositorPendingAnimations); |
| 5823 visitor->trace(m_contextDocument); | 5848 visitor->trace(m_contextDocument); |
| 5824 visitor->trace(m_canvasFontCache); | 5849 visitor->trace(m_canvasFontCache); |
| 5850 visitor->trace(m_intersectionObserverRegistry); | |
| 5825 WillBeHeapSupplementable<Document>::trace(visitor); | 5851 WillBeHeapSupplementable<Document>::trace(visitor); |
| 5826 #endif | 5852 #endif |
| 5827 TreeScope::trace(visitor); | 5853 TreeScope::trace(visitor); |
| 5828 ContainerNode::trace(visitor); | 5854 ContainerNode::trace(visitor); |
| 5829 ExecutionContext::trace(visitor); | 5855 ExecutionContext::trace(visitor); |
| 5830 DocumentLifecycleNotifier::trace(visitor); | 5856 DocumentLifecycleNotifier::trace(visitor); |
| 5831 SecurityContext::trace(visitor); | 5857 SecurityContext::trace(visitor); |
| 5832 } | 5858 } |
| 5833 | 5859 |
| 5834 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; | 5860 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; |
| 5835 | 5861 |
| 5836 } // namespace blink | 5862 } // namespace blink |
| 5837 | 5863 |
| 5838 #ifndef NDEBUG | 5864 #ifndef NDEBUG |
| 5839 using namespace blink; | 5865 using namespace blink; |
| 5840 void showLiveDocumentInstances() | 5866 void showLiveDocumentInstances() |
| 5841 { | 5867 { |
| 5842 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5868 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 5843 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5869 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5844 for (Document* document : set) | 5870 for (Document* document : set) |
| 5845 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); | 5871 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); |
| 5846 } | 5872 } |
| 5847 #endif | 5873 #endif |
| OLD | NEW |