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 4487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4575 | 4576 |
4576 ASSERT(doc); | 4577 ASSERT(doc); |
4577 return *doc; | 4578 return *doc; |
4578 } | 4579 } |
4579 | 4580 |
4580 WeakPtrWillBeRawPtr<Document> Document::contextDocument() | 4581 WeakPtrWillBeRawPtr<Document> Document::contextDocument() |
4581 { | 4582 { |
4582 if (m_contextDocument) | 4583 if (m_contextDocument) |
4583 return m_contextDocument; | 4584 return m_contextDocument; |
4584 if (m_frame) { | 4585 if (m_frame) { |
4585 #if ENABLE(OILPAN) | 4586 return createWeakPtr(); |
4586 return this; | |
4587 #else | |
4588 return m_weakFactory.createWeakPtr(); | |
4589 #endif | |
4590 } | 4587 } |
4591 return nullptr; | 4588 return nullptr; |
4592 } | 4589 } |
4593 | 4590 |
4594 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name,
ExceptionState& exceptionState) | 4591 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name,
ExceptionState& exceptionState) |
4595 { | 4592 { |
4596 if (isHTMLDocument() && name != name.lower()) | 4593 if (isHTMLDocument() && name != name.lower()) |
4597 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL
owercase); | 4594 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL
owercase); |
4598 return createAttributeNS(nullAtom, name, exceptionState, true); | 4595 return createAttributeNS(nullAtom, name, exceptionState, true); |
4599 } | 4596 } |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5055 { | 5052 { |
5056 if (equalIgnoringCase(dnsPrefetchControl, "on") && !m_haveExplicitlyDisabled
DNSPrefetch) { | 5053 if (equalIgnoringCase(dnsPrefetchControl, "on") && !m_haveExplicitlyDisabled
DNSPrefetch) { |
5057 m_isDNSPrefetchEnabled = true; | 5054 m_isDNSPrefetchEnabled = true; |
5058 return; | 5055 return; |
5059 } | 5056 } |
5060 | 5057 |
5061 m_isDNSPrefetchEnabled = false; | 5058 m_isDNSPrefetchEnabled = false; |
5062 m_haveExplicitlyDisabledDNSPrefetch = true; | 5059 m_haveExplicitlyDisabledDNSPrefetch = true; |
5063 } | 5060 } |
5064 | 5061 |
| 5062 WeakPtrWillBeRawPtr<Document> Document::createWeakPtr() |
| 5063 { |
| 5064 #if ENABLE(OILPAN) |
| 5065 return this; |
| 5066 #else |
| 5067 return m_weakFactory.createWeakPtr(); |
| 5068 #endif |
| 5069 } |
| 5070 |
| 5071 IntersectionObserverController& Document::ensureIntersectionObserverController() |
| 5072 { |
| 5073 if (!m_intersectionObserverController) |
| 5074 m_intersectionObserverController = new IntersectionObserverController(); |
| 5075 return *m_intersectionObserverController; |
| 5076 } |
| 5077 |
5065 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe
xt) | 5078 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe
xt) |
5066 { | 5079 { |
5067 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); | 5080 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); |
5068 } | 5081 } |
5069 | 5082 |
5070 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM
essage) | 5083 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM
essage) |
5071 { | 5084 { |
5072 if (!isContextThread()) { | 5085 if (!isContextThread()) { |
5073 m_taskRunner->postTask(BLINK_FROM_HERE, AddConsoleMessageTask::create(co
nsoleMessage->source(), consoleMessage->level(), consoleMessage->message())); | 5086 m_taskRunner->postTask(BLINK_FROM_HERE, AddConsoleMessageTask::create(co
nsoleMessage->source(), consoleMessage->level(), consoleMessage->message())); |
5074 return; | 5087 return; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5112 void Document::tasksWereResumed() | 5125 void Document::tasksWereResumed() |
5113 { | 5126 { |
5114 scriptRunner()->resume(); | 5127 scriptRunner()->resume(); |
5115 | 5128 |
5116 if (m_parser) | 5129 if (m_parser) |
5117 m_parser->resumeScheduledTasks(); | 5130 m_parser->resumeScheduledTasks(); |
5118 if (m_scriptedAnimationController) | 5131 if (m_scriptedAnimationController) |
5119 m_scriptedAnimationController->resume(); | 5132 m_scriptedAnimationController->resume(); |
5120 | 5133 |
5121 MutationObserver::resumeSuspendedObservers(); | 5134 MutationObserver::resumeSuspendedObservers(); |
| 5135 if (m_intersectionObserverController) |
| 5136 m_intersectionObserverController->resumeSuspendedIntersectionObservers()
; |
5122 if (m_domWindow) | 5137 if (m_domWindow) |
5123 DOMWindowPerformance::performance(*m_domWindow)->resumeSuspendedObserver
s(); | 5138 DOMWindowPerformance::performance(*m_domWindow)->resumeSuspendedObserver
s(); |
5124 } | 5139 } |
5125 | 5140 |
5126 // FIXME: suspendScheduledTasks(), resumeScheduledTasks(), tasksNeedSuspension() | 5141 // FIXME: suspendScheduledTasks(), resumeScheduledTasks(), tasksNeedSuspension() |
5127 // should be moved to LocalDOMWindow once it inherits ExecutionContext | 5142 // should be moved to LocalDOMWindow once it inherits ExecutionContext |
5128 void Document::suspendScheduledTasks() | 5143 void Document::suspendScheduledTasks() |
5129 { | 5144 { |
5130 ExecutionContext::suspendScheduledTasks(); | 5145 ExecutionContext::suspendScheduledTasks(); |
5131 m_taskRunner->suspend(); | 5146 m_taskRunner->suspend(); |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5858 visitor->trace(m_timers); | 5873 visitor->trace(m_timers); |
5859 visitor->trace(m_templateDocument); | 5874 visitor->trace(m_templateDocument); |
5860 visitor->trace(m_templateDocumentHost); | 5875 visitor->trace(m_templateDocumentHost); |
5861 visitor->trace(m_visibilityObservers); | 5876 visitor->trace(m_visibilityObservers); |
5862 visitor->trace(m_userActionElements); | 5877 visitor->trace(m_userActionElements); |
5863 visitor->trace(m_svgExtensions); | 5878 visitor->trace(m_svgExtensions); |
5864 visitor->trace(m_timeline); | 5879 visitor->trace(m_timeline); |
5865 visitor->trace(m_compositorPendingAnimations); | 5880 visitor->trace(m_compositorPendingAnimations); |
5866 visitor->trace(m_contextDocument); | 5881 visitor->trace(m_contextDocument); |
5867 visitor->trace(m_canvasFontCache); | 5882 visitor->trace(m_canvasFontCache); |
| 5883 visitor->trace(m_intersectionObserverController); |
5868 WillBeHeapSupplementable<Document>::trace(visitor); | 5884 WillBeHeapSupplementable<Document>::trace(visitor); |
5869 #endif | 5885 #endif |
5870 TreeScope::trace(visitor); | 5886 TreeScope::trace(visitor); |
5871 ContainerNode::trace(visitor); | 5887 ContainerNode::trace(visitor); |
5872 ExecutionContext::trace(visitor); | 5888 ExecutionContext::trace(visitor); |
5873 DocumentLifecycleNotifier::trace(visitor); | 5889 DocumentLifecycleNotifier::trace(visitor); |
5874 SecurityContext::trace(visitor); | 5890 SecurityContext::trace(visitor); |
5875 } | 5891 } |
5876 | 5892 |
5877 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; | 5893 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; |
5878 | 5894 |
5879 } // namespace blink | 5895 } // namespace blink |
5880 | 5896 |
5881 #ifndef NDEBUG | 5897 #ifndef NDEBUG |
5882 using namespace blink; | 5898 using namespace blink; |
5883 void showLiveDocumentInstances() | 5899 void showLiveDocumentInstances() |
5884 { | 5900 { |
5885 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5901 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
5886 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5902 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5887 for (Document* document : set) | 5903 for (Document* document : set) |
5888 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5904 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
5889 } | 5905 } |
5890 #endif | 5906 #endif |
OLD | NEW |