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

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

Issue 1477353002: Revert of Move throttling of background timers into the renderer scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired) 435 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired)
436 , m_documentTiming(*this) 436 , m_documentTiming(*this)
437 , m_writeRecursionIsTooDeep(false) 437 , m_writeRecursionIsTooDeep(false)
438 , m_writeRecursionDepth(0) 438 , m_writeRecursionDepth(0)
439 , m_taskRunner(MainThreadTaskRunner::create(this)) 439 , m_taskRunner(MainThreadTaskRunner::create(this))
440 , m_registrationContext(initializer.registrationContext(this)) 440 , m_registrationContext(initializer.registrationContext(this))
441 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red) 441 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red)
442 , m_timeline(AnimationTimeline::create(this)) 442 , m_timeline(AnimationTimeline::create(this))
443 , m_templateDocumentHost(nullptr) 443 , m_templateDocumentHost(nullptr)
444 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired) 444 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired)
445 , m_timers(timerTaskRunner()->adoptClone()) 445 , m_timers(Platform::current()->currentThread()->scheduler()->timerTaskRunne r()->adoptClone())
446 , m_hasViewportUnits(false) 446 , m_hasViewportUnits(false)
447 , m_styleRecalcElementCounter(0) 447 , m_styleRecalcElementCounter(0)
448 , m_parserSyncPolicy(AllowAsynchronousParsing) 448 , m_parserSyncPolicy(AllowAsynchronousParsing)
449 , m_nodeCount(0) 449 , m_nodeCount(0)
450 { 450 {
451 if (m_frame) { 451 if (m_frame) {
452 ASSERT(m_frame->page()); 452 ASSERT(m_frame->page());
453 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); 453 provideContextFeaturesToDocumentFrom(*this, *m_frame->page());
454 454
455 m_fetcher = m_frame->loader().documentLoader()->fetcher(); 455 m_fetcher = m_frame->loader().documentLoader()->fetcher();
456 m_timers.setTimerTaskRunner(m_frame->frameScheduler()->timerTaskRunner() ->adoptClone());
456 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); 457 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this);
457 } else if (m_importsController) { 458 } else if (m_importsController) {
458 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr); 459 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr);
459 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); 460 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this);
460 } else { 461 } else {
461 m_fetcher = ResourceFetcher::create(nullptr); 462 m_fetcher = ResourceFetcher::create(nullptr);
462 } 463 }
463 464
464 // We depend on the url getting immediately set in subframes, but we 465 // We depend on the url getting immediately set in subframes, but we
465 // also depend on the url NOT getting immediately set in opened windows. 466 // also depend on the url NOT getting immediately set in opened windows.
(...skipping 2403 matching lines...) Expand 10 before | Expand all | Expand 10 after
2869 const KURL& Document::virtualURL() const 2870 const KURL& Document::virtualURL() const
2870 { 2871 {
2871 return m_url; 2872 return m_url;
2872 } 2873 }
2873 2874
2874 KURL Document::virtualCompleteURL(const String& url) const 2875 KURL Document::virtualCompleteURL(const String& url) const
2875 { 2876 {
2876 return completeURL(url); 2877 return completeURL(url);
2877 } 2878 }
2878 2879
2880 double Document::timerAlignmentInterval() const
2881 {
2882 Page* p = page();
2883 if (!p)
2884 return DOMTimer::visiblePageAlignmentInterval();
2885 return p->timerAlignmentInterval();
2886 }
2887
2879 DOMTimerCoordinator* Document::timers() 2888 DOMTimerCoordinator* Document::timers()
2880 { 2889 {
2881 return &m_timers; 2890 return &m_timers;
2882 } 2891 }
2883 2892
2884 EventTarget* Document::errorEventTarget() 2893 EventTarget* Document::errorEventTarget()
2885 { 2894 {
2886 return domWindow(); 2895 return domWindow();
2887 } 2896 }
2888 2897
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3009 // Only imports on master documents can trigger rendering. 3018 // Only imports on master documents can trigger rendering.
3010 if (HTMLImportLoader* import = importLoader()) 3019 if (HTMLImportLoader* import = importLoader())
3011 import->didRemoveAllPendingStylesheet(); 3020 import->didRemoveAllPendingStylesheet();
3012 if (!haveImportsLoaded()) 3021 if (!haveImportsLoaded())
3013 return; 3022 return;
3014 didLoadAllScriptBlockingResources(); 3023 didLoadAllScriptBlockingResources();
3015 } 3024 }
3016 3025
3017 void Document::didLoadAllScriptBlockingResources() 3026 void Document::didLoadAllScriptBlockingResources()
3018 { 3027 {
3019 loadingTaskRunner()->postTask(BLINK_FROM_HERE, m_executeScriptsWaitingForRes ourcesTask->cancelAndCreate()); 3028 Platform::current()->currentThread()->scheduler()->loadingTaskRunner()->post Task(
3029 BLINK_FROM_HERE, m_executeScriptsWaitingForResourcesTask->cancelAndCreat e());
3020 3030
3021 if (frame()) 3031 if (frame())
3022 frame()->loader().client()->didRemoveAllPendingStylesheet(); 3032 frame()->loader().client()->didRemoveAllPendingStylesheet();
3023 3033
3024 if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) 3034 if (m_gotoAnchorNeededAfterStylesheetsLoad && view())
3025 view()->processUrlFragment(m_url); 3035 view()->processUrlFragment(m_url);
3026 } 3036 }
3027 3037
3028 void Document::executeScriptsWaitingForResources() 3038 void Document::executeScriptsWaitingForResources()
3029 { 3039 {
(...skipping 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after
5733 context = context->parentDocument(); 5743 context = context->parentDocument();
5734 } 5744 }
5735 } 5745 }
5736 return true; 5746 return true;
5737 } 5747 }
5738 5748
5739 WebTaskRunner* Document::loadingTaskRunner() const 5749 WebTaskRunner* Document::loadingTaskRunner() const
5740 { 5750 {
5741 if (frame()) 5751 if (frame())
5742 return frame()->frameScheduler()->loadingTaskRunner(); 5752 return frame()->frameScheduler()->loadingTaskRunner();
5743 if (m_importsController)
5744 return m_importsController->master()->loadingTaskRunner();
5745 if (m_contextDocument)
5746 return m_contextDocument->loadingTaskRunner();
5747 return Platform::current()->currentThread()->scheduler()->loadingTaskRunner( ); 5753 return Platform::current()->currentThread()->scheduler()->loadingTaskRunner( );
5748 } 5754 }
5749 5755
5750 WebTaskRunner* Document::timerTaskRunner() const 5756 WebTaskRunner* Document::timerTaskRunner() const
5751 { 5757 {
5752 if (frame()) 5758 return m_timers.timerTaskRunner();
5753 return m_frame->frameScheduler()->timerTaskRunner();
5754 if (m_importsController)
5755 return m_importsController->master()->timerTaskRunner();
5756 if (m_contextDocument)
5757 return m_contextDocument->timerTaskRunner();
5758 return Platform::current()->currentThread()->scheduler()->timerTaskRunner();
5759 } 5759 }
5760 5760
5761 DEFINE_TRACE(Document) 5761 DEFINE_TRACE(Document)
5762 { 5762 {
5763 #if ENABLE(OILPAN) 5763 #if ENABLE(OILPAN)
5764 visitor->trace(m_importsController); 5764 visitor->trace(m_importsController);
5765 visitor->trace(m_docType); 5765 visitor->trace(m_docType);
5766 visitor->trace(m_implementation); 5766 visitor->trace(m_implementation);
5767 visitor->trace(m_autofocusElement); 5767 visitor->trace(m_autofocusElement);
5768 visitor->trace(m_focusedElement); 5768 visitor->trace(m_focusedElement);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
5829 #ifndef NDEBUG 5829 #ifndef NDEBUG
5830 using namespace blink; 5830 using namespace blink;
5831 void showLiveDocumentInstances() 5831 void showLiveDocumentInstances()
5832 { 5832 {
5833 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5833 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5834 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5834 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5835 for (Document* document : set) 5835 for (Document* document : set)
5836 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5836 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5837 } 5837 }
5838 #endif 5838 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/ExecutionContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698