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

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

Issue 1441073006: Move throttling of background timers into the renderer scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Last few changes Sami requested 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(Platform::current()->currentThread()->scheduler()->timerTaskRunne r()->adoptClone()) 445 , m_timers(timerTaskRunner()->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());
457 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); 456 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this);
458 } else if (m_importsController) { 457 } else if (m_importsController) {
459 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr); 458 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr);
460 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); 459 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this);
461 } else { 460 } else {
462 m_fetcher = ResourceFetcher::create(nullptr); 461 m_fetcher = ResourceFetcher::create(nullptr);
463 } 462 }
464 463
465 // We depend on the url getting immediately set in subframes, but we 464 // We depend on the url getting immediately set in subframes, but we
466 // also depend on the url NOT getting immediately set in opened windows. 465 // also depend on the url NOT getting immediately set in opened windows.
(...skipping 2403 matching lines...) Expand 10 before | Expand all | Expand 10 after
2870 const KURL& Document::virtualURL() const 2869 const KURL& Document::virtualURL() const
2871 { 2870 {
2872 return m_url; 2871 return m_url;
2873 } 2872 }
2874 2873
2875 KURL Document::virtualCompleteURL(const String& url) const 2874 KURL Document::virtualCompleteURL(const String& url) const
2876 { 2875 {
2877 return completeURL(url); 2876 return completeURL(url);
2878 } 2877 }
2879 2878
2880 double Document::timerAlignmentInterval() const
2881 {
2882 Page* p = page();
2883 if (!p)
2884 return DOMTimer::visiblePageAlignmentInterval();
2885 return p->timerAlignmentInterval();
2886 }
2887
2888 DOMTimerCoordinator* Document::timers() 2879 DOMTimerCoordinator* Document::timers()
2889 { 2880 {
2890 return &m_timers; 2881 return &m_timers;
2891 } 2882 }
2892 2883
2893 EventTarget* Document::errorEventTarget() 2884 EventTarget* Document::errorEventTarget()
2894 { 2885 {
2895 return domWindow(); 2886 return domWindow();
2896 } 2887 }
2897 2888
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 // Only imports on master documents can trigger rendering. 3009 // Only imports on master documents can trigger rendering.
3019 if (HTMLImportLoader* import = importLoader()) 3010 if (HTMLImportLoader* import = importLoader())
3020 import->didRemoveAllPendingStylesheet(); 3011 import->didRemoveAllPendingStylesheet();
3021 if (!haveImportsLoaded()) 3012 if (!haveImportsLoaded())
3022 return; 3013 return;
3023 didLoadAllScriptBlockingResources(); 3014 didLoadAllScriptBlockingResources();
3024 } 3015 }
3025 3016
3026 void Document::didLoadAllScriptBlockingResources() 3017 void Document::didLoadAllScriptBlockingResources()
3027 { 3018 {
3028 Platform::current()->currentThread()->scheduler()->loadingTaskRunner()->post Task( 3019 loadingTaskRunner()->postTask(BLINK_FROM_HERE, m_executeScriptsWaitingForRes ourcesTask->cancelAndCreate());
3029 BLINK_FROM_HERE, m_executeScriptsWaitingForResourcesTask->cancelAndCreat e());
3030 3020
3031 if (frame()) 3021 if (frame())
3032 frame()->loader().client()->didRemoveAllPendingStylesheet(); 3022 frame()->loader().client()->didRemoveAllPendingStylesheet();
3033 3023
3034 if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) 3024 if (m_gotoAnchorNeededAfterStylesheetsLoad && view())
3035 view()->processUrlFragment(m_url); 3025 view()->processUrlFragment(m_url);
3036 } 3026 }
3037 3027
3038 void Document::executeScriptsWaitingForResources() 3028 void Document::executeScriptsWaitingForResources()
3039 { 3029 {
(...skipping 2708 matching lines...) Expand 10 before | Expand all | Expand 10 after
5748 5738
5749 WebTaskRunner* Document::loadingTaskRunner() const 5739 WebTaskRunner* Document::loadingTaskRunner() const
5750 { 5740 {
5751 if (frame()) 5741 if (frame())
5752 return frame()->frameScheduler()->loadingTaskRunner(); 5742 return frame()->frameScheduler()->loadingTaskRunner();
5753 return Platform::current()->currentThread()->scheduler()->loadingTaskRunner( ); 5743 return Platform::current()->currentThread()->scheduler()->loadingTaskRunner( );
5754 } 5744 }
5755 5745
5756 WebTaskRunner* Document::timerTaskRunner() const 5746 WebTaskRunner* Document::timerTaskRunner() const
5757 { 5747 {
5758 return m_timers.timerTaskRunner(); 5748 if (frame())
5749 return m_frame->frameScheduler()->timerTaskRunner();
5750 return Platform::current()->currentThread()->scheduler()->timerTaskRunner();
5759 } 5751 }
5760 5752
5761 DEFINE_TRACE(Document) 5753 DEFINE_TRACE(Document)
5762 { 5754 {
5763 #if ENABLE(OILPAN) 5755 #if ENABLE(OILPAN)
5764 visitor->trace(m_importsController); 5756 visitor->trace(m_importsController);
5765 visitor->trace(m_docType); 5757 visitor->trace(m_docType);
5766 visitor->trace(m_implementation); 5758 visitor->trace(m_implementation);
5767 visitor->trace(m_autofocusElement); 5759 visitor->trace(m_autofocusElement);
5768 visitor->trace(m_focusedElement); 5760 visitor->trace(m_focusedElement);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
5829 #ifndef NDEBUG 5821 #ifndef NDEBUG
5830 using namespace blink; 5822 using namespace blink;
5831 void showLiveDocumentInstances() 5823 void showLiveDocumentInstances()
5832 { 5824 {
5833 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5825 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5834 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5826 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5835 for (Document* document : set) 5827 for (Document* document : set)
5836 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5828 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5837 } 5829 }
5838 #endif 5830 #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