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 3860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4475 | 4479 |
4476 ASSERT(doc); | 4480 ASSERT(doc); |
4477 return *doc; | 4481 return *doc; |
4478 } | 4482 } |
4479 | 4483 |
4480 WeakPtrWillBeRawPtr<Document> Document::contextDocument() | 4484 WeakPtrWillBeRawPtr<Document> Document::contextDocument() |
4481 { | 4485 { |
4482 if (m_contextDocument) | 4486 if (m_contextDocument) |
4483 return m_contextDocument; | 4487 return m_contextDocument; |
4484 if (m_frame) { | 4488 if (m_frame) { |
4485 #if ENABLE(OILPAN) | 4489 return createWeakPtr(); |
4486 return this; | |
4487 #else | |
4488 return m_weakFactory.createWeakPtr(); | |
4489 #endif | |
4490 } | 4490 } |
4491 return nullptr; | 4491 return nullptr; |
4492 } | 4492 } |
4493 | 4493 |
4494 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState) | 4494 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState) |
4495 { | 4495 { |
4496 if (isHTMLDocument() && name != name.lower()) | 4496 if (isHTMLDocument() && name != name.lower()) |
4497 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL owercase); | 4497 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL owercase); |
4498 return createAttributeNS(nullAtom, name, exceptionState, true); | 4498 return createAttributeNS(nullAtom, name, exceptionState, true); |
4499 } | 4499 } |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4955 { | 4955 { |
4956 if (equalIgnoringCase(dnsPrefetchControl, "on") && !m_haveExplicitlyDisabled DNSPrefetch) { | 4956 if (equalIgnoringCase(dnsPrefetchControl, "on") && !m_haveExplicitlyDisabled DNSPrefetch) { |
4957 m_isDNSPrefetchEnabled = true; | 4957 m_isDNSPrefetchEnabled = true; |
4958 return; | 4958 return; |
4959 } | 4959 } |
4960 | 4960 |
4961 m_isDNSPrefetchEnabled = false; | 4961 m_isDNSPrefetchEnabled = false; |
4962 m_haveExplicitlyDisabledDNSPrefetch = true; | 4962 m_haveExplicitlyDisabledDNSPrefetch = true; |
4963 } | 4963 } |
4964 | 4964 |
4965 WeakPtrWillBeRawPtr<Document> Document::createWeakPtr() | |
dcheng
2015/12/10 00:37:09
Having look at the design doc and spec some more,
szager1
2015/12/10 22:38:54
I understand your reticence, but I also spent two
| |
4966 { | |
4967 #if ENABLE(OILPAN) | |
4968 return this; | |
4969 #else | |
4970 return m_weakFactory.createWeakPtr(); | |
4971 #endif | |
4972 } | |
4973 | |
4974 IntersectionObserverRegistry* Document::intersectionObserverRegistry() | |
4975 { | |
4976 if (!m_intersectionObserverRegistry) | |
4977 m_intersectionObserverRegistry = new IntersectionObserverRegistry(m_deli verIntersectionObservationsTimer); | |
4978 return m_intersectionObserverRegistry.get(); | |
4979 } | |
4980 | |
4981 void Document::deliverIntersectionObservationsTimerFired(Timer<Document>*) | |
4982 { | |
4983 ASSERT(isMainThread()); | |
4984 ASSERT(m_intersectionObserverRegistry); | |
4985 m_intersectionObserverRegistry->deliverIntersectionObservations(); | |
4986 } | |
4987 | |
4965 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe xt) | 4988 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe xt) |
4966 { | 4989 { |
4967 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); | 4990 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); |
4968 } | 4991 } |
4969 | 4992 |
4970 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM essage) | 4993 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM essage) |
4971 { | 4994 { |
4972 if (!isContextThread()) { | 4995 if (!isContextThread()) { |
4973 m_taskRunner->postTask(BLINK_FROM_HERE, AddConsoleMessageTask::create(co nsoleMessage->source(), consoleMessage->level(), consoleMessage->message())); | 4996 m_taskRunner->postTask(BLINK_FROM_HERE, AddConsoleMessageTask::create(co nsoleMessage->source(), consoleMessage->level(), consoleMessage->message())); |
4974 return; | 4997 return; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5012 void Document::tasksWereResumed() | 5035 void Document::tasksWereResumed() |
5013 { | 5036 { |
5014 scriptRunner()->resume(); | 5037 scriptRunner()->resume(); |
5015 | 5038 |
5016 if (m_parser) | 5039 if (m_parser) |
5017 m_parser->resumeScheduledTasks(); | 5040 m_parser->resumeScheduledTasks(); |
5018 if (m_scriptedAnimationController) | 5041 if (m_scriptedAnimationController) |
5019 m_scriptedAnimationController->resume(); | 5042 m_scriptedAnimationController->resume(); |
5020 | 5043 |
5021 MutationObserver::resumeSuspendedObservers(); | 5044 MutationObserver::resumeSuspendedObservers(); |
5045 if (m_intersectionObserverRegistry) | |
5046 m_intersectionObserverRegistry->resumeSuspendedIntersectionObservers(); | |
5022 if (m_domWindow) | 5047 if (m_domWindow) |
5023 DOMWindowPerformance::performance(*m_domWindow)->resumeSuspendedObserver s(); | 5048 DOMWindowPerformance::performance(*m_domWindow)->resumeSuspendedObserver s(); |
5024 } | 5049 } |
5025 | 5050 |
5026 // FIXME: suspendScheduledTasks(), resumeScheduledTasks(), tasksNeedSuspension() | 5051 // FIXME: suspendScheduledTasks(), resumeScheduledTasks(), tasksNeedSuspension() |
5027 // should be moved to LocalDOMWindow once it inherits ExecutionContext | 5052 // should be moved to LocalDOMWindow once it inherits ExecutionContext |
5028 void Document::suspendScheduledTasks() | 5053 void Document::suspendScheduledTasks() |
5029 { | 5054 { |
5030 ExecutionContext::suspendScheduledTasks(); | 5055 ExecutionContext::suspendScheduledTasks(); |
5031 m_taskRunner->suspend(); | 5056 m_taskRunner->suspend(); |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5805 visitor->trace(m_timers); | 5830 visitor->trace(m_timers); |
5806 visitor->trace(m_templateDocument); | 5831 visitor->trace(m_templateDocument); |
5807 visitor->trace(m_templateDocumentHost); | 5832 visitor->trace(m_templateDocumentHost); |
5808 visitor->trace(m_visibilityObservers); | 5833 visitor->trace(m_visibilityObservers); |
5809 visitor->trace(m_userActionElements); | 5834 visitor->trace(m_userActionElements); |
5810 visitor->trace(m_svgExtensions); | 5835 visitor->trace(m_svgExtensions); |
5811 visitor->trace(m_timeline); | 5836 visitor->trace(m_timeline); |
5812 visitor->trace(m_compositorPendingAnimations); | 5837 visitor->trace(m_compositorPendingAnimations); |
5813 visitor->trace(m_contextDocument); | 5838 visitor->trace(m_contextDocument); |
5814 visitor->trace(m_canvasFontCache); | 5839 visitor->trace(m_canvasFontCache); |
5840 visitor->trace(m_intersectionObserverRegistry); | |
5815 WillBeHeapSupplementable<Document>::trace(visitor); | 5841 WillBeHeapSupplementable<Document>::trace(visitor); |
5816 #endif | 5842 #endif |
5817 TreeScope::trace(visitor); | 5843 TreeScope::trace(visitor); |
5818 ContainerNode::trace(visitor); | 5844 ContainerNode::trace(visitor); |
5819 ExecutionContext::trace(visitor); | 5845 ExecutionContext::trace(visitor); |
5820 DocumentLifecycleNotifier::trace(visitor); | 5846 DocumentLifecycleNotifier::trace(visitor); |
5821 SecurityContext::trace(visitor); | 5847 SecurityContext::trace(visitor); |
5822 } | 5848 } |
5823 | 5849 |
5824 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; | 5850 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; |
5825 | 5851 |
5826 } // namespace blink | 5852 } // namespace blink |
5827 | 5853 |
5828 #ifndef NDEBUG | 5854 #ifndef NDEBUG |
5829 using namespace blink; | 5855 using namespace blink; |
5830 void showLiveDocumentInstances() | 5856 void showLiveDocumentInstances() |
5831 { | 5857 { |
5832 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5858 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
5833 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5859 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5834 for (Document* document : set) | 5860 for (Document* document : set) |
5835 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); | 5861 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); |
5836 } | 5862 } |
5837 #endif | 5863 #endif |
OLD | NEW |