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

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

Issue 1340343003: scheduler: Implement WebFrameScheduler and WebPageScheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased + fixed gn build. Created 5 years, 2 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 | « media/blink/run_all_unittests.cc ('k') | third_party/WebKit/Source/core/frame/DOMTimer.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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 #include "platform/network/ContentSecurityPolicyParsers.h" 208 #include "platform/network/ContentSecurityPolicyParsers.h"
209 #include "platform/network/HTTPParsers.h" 209 #include "platform/network/HTTPParsers.h"
210 #include "platform/scheduler/CancellableTaskFactory.h" 210 #include "platform/scheduler/CancellableTaskFactory.h"
211 #include "platform/scroll/ScrollbarTheme.h" 211 #include "platform/scroll/ScrollbarTheme.h"
212 #include "platform/text/PlatformLocale.h" 212 #include "platform/text/PlatformLocale.h"
213 #include "platform/text/SegmentedString.h" 213 #include "platform/text/SegmentedString.h"
214 #include "platform/weborigin/OriginAccessEntry.h" 214 #include "platform/weborigin/OriginAccessEntry.h"
215 #include "platform/weborigin/SchemeRegistry.h" 215 #include "platform/weborigin/SchemeRegistry.h"
216 #include "platform/weborigin/SecurityOrigin.h" 216 #include "platform/weborigin/SecurityOrigin.h"
217 #include "public/platform/Platform.h" 217 #include "public/platform/Platform.h"
218 #include "public/platform/WebFrameScheduler.h"
218 #include "wtf/CurrentTime.h" 219 #include "wtf/CurrentTime.h"
219 #include "wtf/DateMath.h" 220 #include "wtf/DateMath.h"
220 #include "wtf/Functional.h" 221 #include "wtf/Functional.h"
221 #include "wtf/HashFunctions.h" 222 #include "wtf/HashFunctions.h"
222 #include "wtf/MainThread.h" 223 #include "wtf/MainThread.h"
223 #include "wtf/StdLibExtras.h" 224 #include "wtf/StdLibExtras.h"
224 #include "wtf/TemporaryChange.h" 225 #include "wtf/TemporaryChange.h"
225 #include "wtf/text/StringBuffer.h" 226 #include "wtf/text/StringBuffer.h"
226 #include "wtf/text/TextEncodingRegistry.h" 227 #include "wtf/text/TextEncodingRegistry.h"
227 228
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired) 433 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired)
433 , m_documentTiming(*this) 434 , m_documentTiming(*this)
434 , m_writeRecursionIsTooDeep(false) 435 , m_writeRecursionIsTooDeep(false)
435 , m_writeRecursionDepth(0) 436 , m_writeRecursionDepth(0)
436 , m_taskRunner(MainThreadTaskRunner::create(this)) 437 , m_taskRunner(MainThreadTaskRunner::create(this))
437 , m_registrationContext(initializer.registrationContext(this)) 438 , m_registrationContext(initializer.registrationContext(this))
438 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red) 439 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red)
439 , m_timeline(AnimationTimeline::create(this)) 440 , m_timeline(AnimationTimeline::create(this))
440 , m_templateDocumentHost(nullptr) 441 , m_templateDocumentHost(nullptr)
441 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired) 442 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired)
443 , m_timers(Platform::current()->currentThread()->scheduler()->timerTaskRunne r())
442 , m_hasViewportUnits(false) 444 , m_hasViewportUnits(false)
443 , m_styleRecalcElementCounter(0) 445 , m_styleRecalcElementCounter(0)
444 , m_parserSyncPolicy(AllowAsynchronousParsing) 446 , m_parserSyncPolicy(AllowAsynchronousParsing)
445 , m_nodeCount(0) 447 , m_nodeCount(0)
446 { 448 {
447 if (m_frame) { 449 if (m_frame) {
448 ASSERT(m_frame->page()); 450 ASSERT(m_frame->page());
449 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); 451 provideContextFeaturesToDocumentFrom(*this, *m_frame->page());
450 452
451 m_fetcher = m_frame->loader().documentLoader()->fetcher(); 453 m_fetcher = m_frame->loader().documentLoader()->fetcher();
454 m_timers.setTimerTaskRunner(m_frame->frameScheduler()->timerTaskRunner() );
452 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); 455 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this);
453 } else if (m_importsController) { 456 } else if (m_importsController) {
454 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr); 457 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr);
455 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); 458 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this);
456 } else { 459 } else {
457 m_fetcher = ResourceFetcher::create(nullptr); 460 m_fetcher = ResourceFetcher::create(nullptr);
458 } 461 }
459 462
460 // We depend on the url getting immediately set in subframes, but we 463 // We depend on the url getting immediately set in subframes, but we
461 // also depend on the url NOT getting immediately set in opened windows. 464 // also depend on the url NOT getting immediately set in opened windows.
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 // the context in the case where multiple Documents end up associated with 2200 // the context in the case where multiple Documents end up associated with
2198 // a single DocumentLoader (e.g., navigating to a javascript: url). 2201 // a single DocumentLoader (e.g., navigating to a javascript: url).
2199 if (!loader()) 2202 if (!loader())
2200 m_fetcher->clearContext(); 2203 m_fetcher->clearContext();
2201 // If this document is the master for an HTMLImportsController, sever that 2204 // If this document is the master for an HTMLImportsController, sever that
2202 // relationship. This ensures that we don't leave import loads in flight, 2205 // relationship. This ensures that we don't leave import loads in flight,
2203 // thinking they should have access to a valid frame when they don't. 2206 // thinking they should have access to a valid frame when they don't.
2204 if (m_importsController) 2207 if (m_importsController)
2205 HTMLImportsController::removeFrom(*this); 2208 HTMLImportsController::removeFrom(*this);
2206 2209
2210 m_timers.setTimerTaskRunner(Platform::current()->currentThread()->scheduler( )->timerTaskRunner());
2211
2207 // This is required, as our LocalFrame might delete itself as soon as it det aches 2212 // This is required, as our LocalFrame might delete itself as soon as it det aches
2208 // us. However, this violates Node::detach() semantics, as it's never 2213 // us. However, this violates Node::detach() semantics, as it's never
2209 // possible to re-attach. Eventually Document::detach() should be renamed, 2214 // possible to re-attach. Eventually Document::detach() should be renamed,
2210 // or this setting of the frame to 0 could be made explicit in each of the 2215 // or this setting of the frame to 0 could be made explicit in each of the
2211 // callers of Document::detach(). 2216 // callers of Document::detach().
2212 m_frame = nullptr; 2217 m_frame = nullptr;
2213 2218
2214 if (m_mediaQueryMatcher) 2219 if (m_mediaQueryMatcher)
2215 m_mediaQueryMatcher->documentDetached(); 2220 m_mediaQueryMatcher->documentDetached();
2216 2221
(...skipping 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after
4832 void Document::updateSecurityOrigin(PassRefPtr<SecurityOrigin> origin) 4837 void Document::updateSecurityOrigin(PassRefPtr<SecurityOrigin> origin)
4833 { 4838 {
4834 setSecurityOrigin(origin); 4839 setSecurityOrigin(origin);
4835 didUpdateSecurityOrigin(); 4840 didUpdateSecurityOrigin();
4836 } 4841 }
4837 4842
4838 void Document::didUpdateSecurityOrigin() 4843 void Document::didUpdateSecurityOrigin()
4839 { 4844 {
4840 if (!m_frame) 4845 if (!m_frame)
4841 return; 4846 return;
4847 m_frame->updateFrameSecurityOrigin();
4842 m_frame->script().updateSecurityOrigin(securityOrigin()); 4848 m_frame->script().updateSecurityOrigin(securityOrigin());
4843 } 4849 }
4844 4850
4845 bool Document::isContextThread() const 4851 bool Document::isContextThread() const
4846 { 4852 {
4847 return isMainThread(); 4853 return isMainThread();
4848 } 4854 }
4849 4855
4850 void Document::updateFocusAppearanceSoon(bool restorePreviousSelection) 4856 void Document::updateFocusAppearanceSoon(bool restorePreviousSelection)
4851 { 4857 {
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
5745 #ifndef NDEBUG 5751 #ifndef NDEBUG
5746 using namespace blink; 5752 using namespace blink;
5747 void showLiveDocumentInstances() 5753 void showLiveDocumentInstances()
5748 { 5754 {
5749 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5755 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5750 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5756 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5751 for (Document* document : set) 5757 for (Document* document : set)
5752 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5758 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5753 } 5759 }
5754 #endif 5760 #endif
OLDNEW
« no previous file with comments | « media/blink/run_all_unittests.cc ('k') | third_party/WebKit/Source/core/frame/DOMTimer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698