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

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

Issue 559553002: Merge ExecutionContextClient and ExecutionContext (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@tmp1
Patch Set: fix win build Created 6 years, 3 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 , m_writeRecursionDepth(0) 504 , m_writeRecursionDepth(0)
505 , m_taskRunner(MainThreadTaskRunner::create(this)) 505 , m_taskRunner(MainThreadTaskRunner::create(this))
506 , m_registrationContext(initializer.registrationContext(this)) 506 , m_registrationContext(initializer.registrationContext(this))
507 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red) 507 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red)
508 , m_timeline(AnimationTimeline::create(this)) 508 , m_timeline(AnimationTimeline::create(this))
509 , m_templateDocumentHost(nullptr) 509 , m_templateDocumentHost(nullptr)
510 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired) 510 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired)
511 , m_hasViewportUnits(false) 511 , m_hasViewportUnits(false)
512 , m_styleRecalcElementCounter(0) 512 , m_styleRecalcElementCounter(0)
513 { 513 {
514 setClient(this);
515
516 if (m_frame) { 514 if (m_frame) {
517 ASSERT(m_frame->page()); 515 ASSERT(m_frame->page());
518 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); 516 provideContextFeaturesToDocumentFrom(*this, *m_frame->page());
519 517
520 m_fetcher = m_frame->loader().documentLoader()->fetcher(); 518 m_fetcher = m_frame->loader().documentLoader()->fetcher();
521 } 519 }
522 520
523 if (!m_fetcher) 521 if (!m_fetcher)
524 m_fetcher = ResourceFetcher::create(0); 522 m_fetcher = ResourceFetcher::create(0);
525 m_fetcher->setDocument(this); 523 m_fetcher->setDocument(this);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 ASSERT(m_listsInvalidatedAtDocument.isEmpty()); 619 ASSERT(m_listsInvalidatedAtDocument.isEmpty());
622 620
623 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); ++i) 621 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); ++i)
624 ASSERT(!m_nodeListCounts[i]); 622 ASSERT(!m_nodeListCounts[i]);
625 623
626 #ifndef NDEBUG 624 #ifndef NDEBUG
627 liveDocumentSet().remove(this); 625 liveDocumentSet().remove(this);
628 #endif 626 #endif
629 #endif 627 #endif
630 628
631 setClient(0);
632
633 InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter); 629 InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter);
634 } 630 }
635 631
636 #if !ENABLE(OILPAN) 632 #if !ENABLE(OILPAN)
637 void Document::dispose() 633 void Document::dispose()
638 { 634 {
639 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); 635 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun);
640 636
641 // We must make sure not to be retaining any of our children through 637 // We must make sure not to be retaining any of our children through
642 // these extra pointers or we will create a reference cycle. 638 // these extra pointers or we will create a reference cycle.
(...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2799 EventTarget* Document::errorEventTarget() 2795 EventTarget* Document::errorEventTarget()
2800 { 2796 {
2801 return domWindow(); 2797 return domWindow();
2802 } 2798 }
2803 2799
2804 void Document::logExceptionToConsole(const String& errorMessage, int scriptId, c onst String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr <ScriptCallStack> callStack) 2800 void Document::logExceptionToConsole(const String& errorMessage, int scriptId, c onst String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr <ScriptCallStack> callStack)
2805 { 2801 {
2806 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); 2802 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber);
2807 consoleMessage->setScriptId(scriptId); 2803 consoleMessage->setScriptId(scriptId);
2808 consoleMessage->setCallStack(callStack); 2804 consoleMessage->setCallStack(callStack);
2809 addMessage(consoleMessage.release()); 2805 addConsoleMessage(consoleMessage.release());
2810 } 2806 }
2811 2807
2812 void Document::setURL(const KURL& url) 2808 void Document::setURL(const KURL& url)
2813 { 2809 {
2814 const KURL& newURL = url.isEmpty() ? blankURL() : url; 2810 const KURL& newURL = url.isEmpty() ? blankURL() : url;
2815 if (newURL == m_url) 2811 if (newURL == m_url)
2816 return; 2812 return;
2817 2813
2818 m_url = newURL; 2814 m_url = newURL;
2819 updateBaseURL(); 2815 updateBaseURL();
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
3133 unsigned long requestIdentifier = loader()->mainResourceIdentifier(); 3129 unsigned long requestIdentifier = loader()->mainResourceIdentifier();
3134 if (frameLoader.shouldInterruptLoadForXFrameOptions(content, url(), requestI dentifier)) { 3130 if (frameLoader.shouldInterruptLoadForXFrameOptions(content, url(), requestI dentifier)) {
3135 String message = "Refused to display '" + url().elidedString() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'."; 3131 String message = "Refused to display '" + url().elidedString() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'.";
3136 frameLoader.stopAllLoaders(); 3132 frameLoader.stopAllLoaders();
3137 // Stopping the loader isn't enough, as we're already parsing the docume nt; to honor the header's 3133 // Stopping the loader isn't enough, as we're already parsing the docume nt; to honor the header's
3138 // intent, we must navigate away from the possibly partially-rendered do cument to a location that 3134 // intent, we must navigate away from the possibly partially-rendered do cument to a location that
3139 // doesn't inherit the parent's SecurityOrigin. 3135 // doesn't inherit the parent's SecurityOrigin.
3140 frame->navigationScheduler().scheduleLocationChange(this, SecurityOrigin ::urlWithUniqueSecurityOrigin(), Referrer()); 3136 frame->navigationScheduler().scheduleLocationChange(this, SecurityOrigin ::urlWithUniqueSecurityOrigin(), Referrer());
3141 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::crea te(SecurityMessageSource, ErrorMessageLevel, message); 3137 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::crea te(SecurityMessageSource, ErrorMessageLevel, message);
3142 consoleMessage->setRequestIdentifier(requestIdentifier); 3138 consoleMessage->setRequestIdentifier(requestIdentifier);
3143 addMessage(consoleMessage.release()); 3139 addConsoleMessage(consoleMessage.release());
3144 } 3140 }
3145 } 3141 }
3146 3142
3147 bool Document::shouldMergeWithLegacyDescription(ViewportDescription::Type origin ) 3143 bool Document::shouldMergeWithLegacyDescription(ViewportDescription::Type origin )
3148 { 3144 {
3149 return settings() && settings()->viewportMetaMergeContentQuirk() && m_legacy ViewportDescription.isMetaViewportType() && m_legacyViewportDescription.type == origin; 3145 return settings() && settings()->viewportMetaMergeContentQuirk() && m_legacy ViewportDescription.isMetaViewportType() && m_legacyViewportDescription.type == origin;
3150 } 3146 }
3151 3147
3152 void Document::setViewportDescription(const ViewportDescription& viewportDescrip tion) 3148 void Document::setViewportDescription(const ViewportDescription& viewportDescrip tion)
3153 { 3149 {
(...skipping 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after
5016 5012
5017 m_isDNSPrefetchEnabled = false; 5013 m_isDNSPrefetchEnabled = false;
5018 m_haveExplicitlyDisabledDNSPrefetch = true; 5014 m_haveExplicitlyDisabledDNSPrefetch = true;
5019 } 5015 }
5020 5016
5021 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe xt) 5017 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe xt)
5022 { 5018 {
5023 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); 5019 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText);
5024 } 5020 }
5025 5021
5026 void Document::addMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleMessage) 5022 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM essage)
5027 { 5023 {
5028 if (!isContextThread()) { 5024 if (!isContextThread()) {
5029 m_taskRunner->postTask(AddConsoleMessageTask::create(consoleMessage->sou rce(), consoleMessage->level(), consoleMessage->message())); 5025 m_taskRunner->postTask(AddConsoleMessageTask::create(consoleMessage->sou rce(), consoleMessage->level(), consoleMessage->message()));
5030 return; 5026 return;
5031 } 5027 }
5032 5028
5033 if (!m_frame) 5029 if (!m_frame)
5034 return; 5030 return;
5035 5031
5036 if (!consoleMessage->scriptState() && consoleMessage->url().isNull() && !con soleMessage->lineNumber()) { 5032 if (!consoleMessage->scriptState() && consoleMessage->url().isNull() && !con soleMessage->lineNumber()) {
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
5850 using namespace blink; 5846 using namespace blink;
5851 void showLiveDocumentInstances() 5847 void showLiveDocumentInstances()
5852 { 5848 {
5853 WeakDocumentSet& set = liveDocumentSet(); 5849 WeakDocumentSet& set = liveDocumentSet();
5854 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5850 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5855 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 5851 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
5856 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); 5852 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data());
5857 } 5853 }
5858 } 5854 }
5859 #endif 5855 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698