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

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: Rebased 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
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/ExecutionContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2775 EventTarget* Document::errorEventTarget() 2771 EventTarget* Document::errorEventTarget()
2776 { 2772 {
2777 return domWindow(); 2773 return domWindow();
2778 } 2774 }
2779 2775
2780 void Document::logExceptionToConsole(const String& errorMessage, int scriptId, c onst String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr <ScriptCallStack> callStack) 2776 void Document::logExceptionToConsole(const String& errorMessage, int scriptId, c onst String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr <ScriptCallStack> callStack)
2781 { 2777 {
2782 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); 2778 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber);
2783 consoleMessage->setScriptId(scriptId); 2779 consoleMessage->setScriptId(scriptId);
2784 consoleMessage->setCallStack(callStack); 2780 consoleMessage->setCallStack(callStack);
2785 addMessage(consoleMessage.release()); 2781 addConsoleMessage(consoleMessage.release());
2786 } 2782 }
2787 2783
2788 void Document::setURL(const KURL& url) 2784 void Document::setURL(const KURL& url)
2789 { 2785 {
2790 const KURL& newURL = url.isEmpty() ? blankURL() : url; 2786 const KURL& newURL = url.isEmpty() ? blankURL() : url;
2791 if (newURL == m_url) 2787 if (newURL == m_url)
2792 return; 2788 return;
2793 2789
2794 m_url = newURL; 2790 m_url = newURL;
2795 updateBaseURL(); 2791 updateBaseURL();
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
3109 unsigned long requestIdentifier = loader()->mainResourceIdentifier(); 3105 unsigned long requestIdentifier = loader()->mainResourceIdentifier();
3110 if (frameLoader.shouldInterruptLoadForXFrameOptions(content, url(), requestI dentifier)) { 3106 if (frameLoader.shouldInterruptLoadForXFrameOptions(content, url(), requestI dentifier)) {
3111 String message = "Refused to display '" + url().elidedString() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'."; 3107 String message = "Refused to display '" + url().elidedString() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'.";
3112 frameLoader.stopAllLoaders(); 3108 frameLoader.stopAllLoaders();
3113 // Stopping the loader isn't enough, as we're already parsing the docume nt; to honor the header's 3109 // Stopping the loader isn't enough, as we're already parsing the docume nt; to honor the header's
3114 // intent, we must navigate away from the possibly partially-rendered do cument to a location that 3110 // intent, we must navigate away from the possibly partially-rendered do cument to a location that
3115 // doesn't inherit the parent's SecurityOrigin. 3111 // doesn't inherit the parent's SecurityOrigin.
3116 frame->navigationScheduler().scheduleLocationChange(this, SecurityOrigin ::urlWithUniqueSecurityOrigin(), Referrer()); 3112 frame->navigationScheduler().scheduleLocationChange(this, SecurityOrigin ::urlWithUniqueSecurityOrigin(), Referrer());
3117 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::crea te(SecurityMessageSource, ErrorMessageLevel, message); 3113 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::crea te(SecurityMessageSource, ErrorMessageLevel, message);
3118 consoleMessage->setRequestIdentifier(requestIdentifier); 3114 consoleMessage->setRequestIdentifier(requestIdentifier);
3119 addMessage(consoleMessage.release()); 3115 addConsoleMessage(consoleMessage.release());
3120 } 3116 }
3121 } 3117 }
3122 3118
3123 bool Document::shouldMergeWithLegacyDescription(ViewportDescription::Type origin ) 3119 bool Document::shouldMergeWithLegacyDescription(ViewportDescription::Type origin )
3124 { 3120 {
3125 return settings() && settings()->viewportMetaMergeContentQuirk() && m_legacy ViewportDescription.isMetaViewportType() && m_legacyViewportDescription.type == origin; 3121 return settings() && settings()->viewportMetaMergeContentQuirk() && m_legacy ViewportDescription.isMetaViewportType() && m_legacyViewportDescription.type == origin;
3126 } 3122 }
3127 3123
3128 void Document::setViewportDescription(const ViewportDescription& viewportDescrip tion) 3124 void Document::setViewportDescription(const ViewportDescription& viewportDescrip tion)
3129 { 3125 {
(...skipping 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after
4992 4988
4993 m_isDNSPrefetchEnabled = false; 4989 m_isDNSPrefetchEnabled = false;
4994 m_haveExplicitlyDisabledDNSPrefetch = true; 4990 m_haveExplicitlyDisabledDNSPrefetch = true;
4995 } 4991 }
4996 4992
4997 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe xt) 4993 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe xt)
4998 { 4994 {
4999 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); 4995 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText);
5000 } 4996 }
5001 4997
5002 void Document::addMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleMessage) 4998 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM essage)
5003 { 4999 {
5004 if (!isContextThread()) { 5000 if (!isContextThread()) {
5005 m_taskRunner->postTask(AddConsoleMessageTask::create(consoleMessage->sou rce(), consoleMessage->level(), consoleMessage->message())); 5001 m_taskRunner->postTask(AddConsoleMessageTask::create(consoleMessage->sou rce(), consoleMessage->level(), consoleMessage->message()));
5006 return; 5002 return;
5007 } 5003 }
5008 5004
5009 if (!m_frame) 5005 if (!m_frame)
5010 return; 5006 return;
5011 5007
5012 if (!consoleMessage->scriptState() && consoleMessage->url().isNull() && !con soleMessage->lineNumber()) { 5008 if (!consoleMessage->scriptState() && consoleMessage->url().isNull() && !con soleMessage->lineNumber()) {
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
5826 using namespace blink; 5822 using namespace blink;
5827 void showLiveDocumentInstances() 5823 void showLiveDocumentInstances()
5828 { 5824 {
5829 WeakDocumentSet& set = liveDocumentSet(); 5825 WeakDocumentSet& set = liveDocumentSet();
5830 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5826 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5831 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 5827 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
5832 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); 5828 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data());
5833 } 5829 }
5834 } 5830 }
5835 #endif 5831 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/ExecutionContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698