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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 #include "core/dom/DocumentFragment.h" | 68 #include "core/dom/DocumentFragment.h" |
| 69 #include "core/dom/DocumentLifecycleObserver.h" | 69 #include "core/dom/DocumentLifecycleObserver.h" |
| 70 #include "core/dom/DocumentType.h" | 70 #include "core/dom/DocumentType.h" |
| 71 #include "core/dom/Element.h" | 71 #include "core/dom/Element.h" |
| 72 #include "core/dom/ElementDataCache.h" | 72 #include "core/dom/ElementDataCache.h" |
| 73 #include "core/dom/ElementRegistrationOptions.h" | 73 #include "core/dom/ElementRegistrationOptions.h" |
| 74 #include "core/dom/ElementTraversal.h" | 74 #include "core/dom/ElementTraversal.h" |
| 75 #include "core/dom/ExceptionCode.h" | 75 #include "core/dom/ExceptionCode.h" |
| 76 #include "core/dom/ExecutionContextTask.h" | 76 #include "core/dom/ExecutionContextTask.h" |
| 77 #include "core/dom/FrameRequestCallback.h" | 77 #include "core/dom/FrameRequestCallback.h" |
| 78 #include "core/dom/IntersectionObserverController.h" | |
| 78 #include "core/dom/LayoutTreeBuilderTraversal.h" | 79 #include "core/dom/LayoutTreeBuilderTraversal.h" |
| 79 #include "core/dom/MainThreadTaskRunner.h" | 80 #include "core/dom/MainThreadTaskRunner.h" |
| 80 #include "core/dom/Microtask.h" | 81 #include "core/dom/Microtask.h" |
| 81 #include "core/dom/MutationObserver.h" | 82 #include "core/dom/MutationObserver.h" |
| 82 #include "core/dom/NodeChildRemovalTracker.h" | 83 #include "core/dom/NodeChildRemovalTracker.h" |
| 83 #include "core/dom/NodeComputedStyle.h" | 84 #include "core/dom/NodeComputedStyle.h" |
| 84 #include "core/dom/NodeFilter.h" | 85 #include "core/dom/NodeFilter.h" |
| 85 #include "core/dom/NodeIterator.h" | 86 #include "core/dom/NodeIterator.h" |
| 86 #include "core/dom/NodeRareData.h" | 87 #include "core/dom/NodeRareData.h" |
| 87 #include "core/dom/NodeTraversal.h" | 88 #include "core/dom/NodeTraversal.h" |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 601 // FIXME: consider using ActiveDOMObject. | 602 // FIXME: consider using ActiveDOMObject. |
| 602 if (m_scriptedAnimationController) | 603 if (m_scriptedAnimationController) |
| 603 m_scriptedAnimationController->clearDocumentPointer(); | 604 m_scriptedAnimationController->clearDocumentPointer(); |
| 604 m_scriptedAnimationController.clear(); | 605 m_scriptedAnimationController.clear(); |
| 605 | 606 |
| 606 m_scriptedIdleTaskController.clear(); | 607 m_scriptedIdleTaskController.clear(); |
| 607 | 608 |
| 608 if (svgExtensions()) | 609 if (svgExtensions()) |
| 609 accessSVGExtensions().pauseAnimations(); | 610 accessSVGExtensions().pauseAnimations(); |
| 610 | 611 |
| 612 if (m_intersectionObserverController) { | |
| 613 m_intersectionObserverController->dispose(); | |
| 614 m_intersectionObserverController.clear(); | |
| 615 } | |
| 616 | |
| 611 m_lifecycle.advanceTo(DocumentLifecycle::Disposed); | 617 m_lifecycle.advanceTo(DocumentLifecycle::Disposed); |
| 612 DocumentLifecycleNotifier::notifyDocumentWasDisposed(); | 618 DocumentLifecycleNotifier::notifyDocumentWasDisposed(); |
| 613 | 619 |
| 614 m_canvasFontCache.clear(); | 620 m_canvasFontCache.clear(); |
| 615 } | 621 } |
| 616 #endif | 622 #endif |
| 617 | 623 |
| 618 SelectorQueryCache& Document::selectorQueryCache() | 624 SelectorQueryCache& Document::selectorQueryCache() |
| 619 { | 625 { |
| 620 if (!m_selectorQueryCache) | 626 if (!m_selectorQueryCache) |
| (...skipping 3954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4575 | 4581 |
| 4576 ASSERT(doc); | 4582 ASSERT(doc); |
| 4577 return *doc; | 4583 return *doc; |
| 4578 } | 4584 } |
| 4579 | 4585 |
| 4580 WeakPtrWillBeRawPtr<Document> Document::contextDocument() | 4586 WeakPtrWillBeRawPtr<Document> Document::contextDocument() |
| 4581 { | 4587 { |
| 4582 if (m_contextDocument) | 4588 if (m_contextDocument) |
| 4583 return m_contextDocument; | 4589 return m_contextDocument; |
| 4584 if (m_frame) { | 4590 if (m_frame) { |
| 4585 #if ENABLE(OILPAN) | 4591 return createWeakPtr(); |
| 4586 return this; | |
| 4587 #else | |
| 4588 return m_weakFactory.createWeakPtr(); | |
| 4589 #endif | |
| 4590 } | 4592 } |
| 4591 return nullptr; | 4593 return nullptr; |
| 4592 } | 4594 } |
| 4593 | 4595 |
| 4594 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState) | 4596 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState) |
| 4595 { | 4597 { |
| 4596 if (isHTMLDocument() && name != name.lower()) | 4598 if (isHTMLDocument() && name != name.lower()) |
| 4597 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL owercase); | 4599 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL owercase); |
| 4598 return createAttributeNS(nullAtom, name, exceptionState, true); | 4600 return createAttributeNS(nullAtom, name, exceptionState, true); |
| 4599 } | 4601 } |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5055 { | 5057 { |
| 5056 if (equalIgnoringCase(dnsPrefetchControl, "on") && !m_haveExplicitlyDisabled DNSPrefetch) { | 5058 if (equalIgnoringCase(dnsPrefetchControl, "on") && !m_haveExplicitlyDisabled DNSPrefetch) { |
| 5057 m_isDNSPrefetchEnabled = true; | 5059 m_isDNSPrefetchEnabled = true; |
| 5058 return; | 5060 return; |
| 5059 } | 5061 } |
| 5060 | 5062 |
| 5061 m_isDNSPrefetchEnabled = false; | 5063 m_isDNSPrefetchEnabled = false; |
| 5062 m_haveExplicitlyDisabledDNSPrefetch = true; | 5064 m_haveExplicitlyDisabledDNSPrefetch = true; |
| 5063 } | 5065 } |
| 5064 | 5066 |
| 5067 WeakPtrWillBeRawPtr<Document> Document::createWeakPtr() | |
| 5068 { | |
| 5069 #if ENABLE(OILPAN) | |
| 5070 return this; | |
| 5071 #else | |
| 5072 return m_weakFactory.createWeakPtr(); | |
| 5073 #endif | |
| 5074 } | |
| 5075 | |
| 5076 IntersectionObserverController& Document::ensureIntersectionObserverController() | |
| 5077 { | |
| 5078 if (!m_intersectionObserverController) | |
| 5079 m_intersectionObserverController = new IntersectionObserverController(); | |
| 5080 return *m_intersectionObserverController; | |
| 5081 } | |
| 5082 | |
| 5065 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe xt) | 5083 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe xt) |
| 5066 { | 5084 { |
| 5067 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); | 5085 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); |
| 5068 } | 5086 } |
| 5069 | 5087 |
| 5070 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM essage) | 5088 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM essage) |
| 5071 { | 5089 { |
| 5072 if (!isContextThread()) { | 5090 if (!isContextThread()) { |
| 5073 m_taskRunner->postTask(BLINK_FROM_HERE, AddConsoleMessageTask::create(co nsoleMessage->source(), consoleMessage->level(), consoleMessage->message())); | 5091 m_taskRunner->postTask(BLINK_FROM_HERE, AddConsoleMessageTask::create(co nsoleMessage->source(), consoleMessage->level(), consoleMessage->message())); |
| 5074 return; | 5092 return; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 5092 void Document::postTask(const WebTraceLocation& location, PassOwnPtr<ExecutionCo ntextTask> task) | 5110 void Document::postTask(const WebTraceLocation& location, PassOwnPtr<ExecutionCo ntextTask> task) |
| 5093 { | 5111 { |
| 5094 m_taskRunner->postTask(location, task); | 5112 m_taskRunner->postTask(location, task); |
| 5095 } | 5113 } |
| 5096 | 5114 |
| 5097 void Document::postInspectorTask(const WebTraceLocation& location, PassOwnPtr<Ex ecutionContextTask> task) | 5115 void Document::postInspectorTask(const WebTraceLocation& location, PassOwnPtr<Ex ecutionContextTask> task) |
| 5098 { | 5116 { |
| 5099 m_taskRunner->postInspectorTask(location, task); | 5117 m_taskRunner->postInspectorTask(location, task); |
| 5100 } | 5118 } |
| 5101 | 5119 |
| 5102 void Document::tasksWereSuspended() | 5120 void Document::tasksWereSuspended() |
|
haraken
2016/01/02 13:47:39
Don't you need to suspend the observers when the d
szager1
2016/01/02 19:18:34
As I understand it, "suspended" in this case means
haraken
2016/01/03 16:34:20
Yes, you're right. What I'm suggesting is just to
szager1
2016/01/04 03:53:04
Done.
| |
| 5103 { | 5121 { |
| 5104 scriptRunner()->suspend(); | 5122 scriptRunner()->suspend(); |
| 5105 | 5123 |
| 5106 if (m_parser) | 5124 if (m_parser) |
| 5107 m_parser->suspendScheduledTasks(); | 5125 m_parser->suspendScheduledTasks(); |
| 5108 if (m_scriptedAnimationController) | 5126 if (m_scriptedAnimationController) |
| 5109 m_scriptedAnimationController->suspend(); | 5127 m_scriptedAnimationController->suspend(); |
| 5110 } | 5128 } |
| 5111 | 5129 |
| 5112 void Document::tasksWereResumed() | 5130 void Document::tasksWereResumed() |
| 5113 { | 5131 { |
| 5114 scriptRunner()->resume(); | 5132 scriptRunner()->resume(); |
| 5115 | 5133 |
| 5116 if (m_parser) | 5134 if (m_parser) |
| 5117 m_parser->resumeScheduledTasks(); | 5135 m_parser->resumeScheduledTasks(); |
| 5118 if (m_scriptedAnimationController) | 5136 if (m_scriptedAnimationController) |
| 5119 m_scriptedAnimationController->resume(); | 5137 m_scriptedAnimationController->resume(); |
| 5120 | 5138 |
| 5121 MutationObserver::resumeSuspendedObservers(); | 5139 MutationObserver::resumeSuspendedObservers(); |
| 5140 if (m_intersectionObserverController) | |
| 5141 m_intersectionObserverController->resumeSuspendedIntersectionObservers() ; | |
| 5122 if (m_domWindow) | 5142 if (m_domWindow) |
| 5123 DOMWindowPerformance::performance(*m_domWindow)->resumeSuspendedObserver s(); | 5143 DOMWindowPerformance::performance(*m_domWindow)->resumeSuspendedObserver s(); |
| 5124 } | 5144 } |
| 5125 | 5145 |
| 5126 // FIXME: suspendScheduledTasks(), resumeScheduledTasks(), tasksNeedSuspension() | 5146 // FIXME: suspendScheduledTasks(), resumeScheduledTasks(), tasksNeedSuspension() |
| 5127 // should be moved to LocalDOMWindow once it inherits ExecutionContext | 5147 // should be moved to LocalDOMWindow once it inherits ExecutionContext |
| 5128 void Document::suspendScheduledTasks() | 5148 void Document::suspendScheduledTasks() |
| 5129 { | 5149 { |
| 5130 ExecutionContext::suspendScheduledTasks(); | 5150 ExecutionContext::suspendScheduledTasks(); |
| 5131 m_taskRunner->suspend(); | 5151 m_taskRunner->suspend(); |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5858 visitor->trace(m_timers); | 5878 visitor->trace(m_timers); |
| 5859 visitor->trace(m_templateDocument); | 5879 visitor->trace(m_templateDocument); |
| 5860 visitor->trace(m_templateDocumentHost); | 5880 visitor->trace(m_templateDocumentHost); |
| 5861 visitor->trace(m_visibilityObservers); | 5881 visitor->trace(m_visibilityObservers); |
| 5862 visitor->trace(m_userActionElements); | 5882 visitor->trace(m_userActionElements); |
| 5863 visitor->trace(m_svgExtensions); | 5883 visitor->trace(m_svgExtensions); |
| 5864 visitor->trace(m_timeline); | 5884 visitor->trace(m_timeline); |
| 5865 visitor->trace(m_compositorPendingAnimations); | 5885 visitor->trace(m_compositorPendingAnimations); |
| 5866 visitor->trace(m_contextDocument); | 5886 visitor->trace(m_contextDocument); |
| 5867 visitor->trace(m_canvasFontCache); | 5887 visitor->trace(m_canvasFontCache); |
| 5888 visitor->trace(m_intersectionObserverController); | |
| 5868 WillBeHeapSupplementable<Document>::trace(visitor); | 5889 WillBeHeapSupplementable<Document>::trace(visitor); |
| 5869 #endif | 5890 #endif |
| 5870 TreeScope::trace(visitor); | 5891 TreeScope::trace(visitor); |
| 5871 ContainerNode::trace(visitor); | 5892 ContainerNode::trace(visitor); |
| 5872 ExecutionContext::trace(visitor); | 5893 ExecutionContext::trace(visitor); |
| 5873 DocumentLifecycleNotifier::trace(visitor); | 5894 DocumentLifecycleNotifier::trace(visitor); |
| 5874 SecurityContext::trace(visitor); | 5895 SecurityContext::trace(visitor); |
| 5875 } | 5896 } |
| 5876 | 5897 |
| 5877 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; | 5898 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; |
| 5878 | 5899 |
| 5879 } // namespace blink | 5900 } // namespace blink |
| 5880 | 5901 |
| 5881 #ifndef NDEBUG | 5902 #ifndef NDEBUG |
| 5882 using namespace blink; | 5903 using namespace blink; |
| 5883 void showLiveDocumentInstances() | 5904 void showLiveDocumentInstances() |
| 5884 { | 5905 { |
| 5885 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5906 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 5886 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5907 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5887 for (Document* document : set) | 5908 for (Document* document : set) |
| 5888 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); | 5909 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); |
| 5889 } | 5910 } |
| 5890 #endif | 5911 #endif |
| OLD | NEW |