diff options
Diffstat (limited to 'third_party/WebKit/Source')
25 files changed, 50 insertions, 123 deletions
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp index 7c178f9..d38e6cc 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp @@ -18,7 +18,6 @@ #include "platform/ThreadSafeFunctional.h" #include "platform/TraceEvent.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include "wtf/MainThread.h" #include "wtf/text/TextEncodingRegistry.h" @@ -163,7 +162,7 @@ private: class SourceStream : public v8::ScriptCompiler::ExternalSourceStream { WTF_MAKE_NONCOPYABLE(SourceStream); public: - explicit SourceStream(WebTaskRunner* loadingTaskRunner) + SourceStream() : v8::ScriptCompiler::ExternalSourceStream() , m_cancelled(false) , m_finished(false) @@ -171,7 +170,6 @@ public: , m_queueTailPosition(0) , m_bookmarkPosition(0) , m_lengthOfBOM(0) - , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone())) { } @@ -221,7 +219,7 @@ public: } // Inform main thread to re-queue the data. - m_loadingTaskRunner->postTask( + Platform::current()->mainThread()->taskRunner()->postTask( FROM_HERE, bind(&SourceStream::fetchDataFromResourceBuffer, this, 0)); } @@ -372,18 +370,16 @@ private: // We store this separately, to avoid having to guard all // m_queueLeadPosition references with a mutex. unsigned m_lengthOfBOM; // Used by both threads; guarded by m_mutex. - - OwnPtr<WebTaskRunner> m_loadingTaskRunner; }; size_t ScriptStreamer::kSmallScriptThreshold = 30 * 1024; -void ScriptStreamer::startStreaming(PendingScript& script, PendingScript::Type scriptType, Settings* settings, ScriptState* scriptState, WebTaskRunner* loadingTaskRunner) +void ScriptStreamer::startStreaming(PendingScript& script, PendingScript::Type scriptType, Settings* settings, ScriptState* scriptState) { // We don't yet know whether the script will really be streamed. E.g., // suppressing streaming for short scripts is done later. Record only the // sure negative cases here. - bool startedStreaming = startStreamingInternal(script, scriptType, settings, scriptState, loadingTaskRunner); + bool startedStreaming = startStreamingInternal(script, scriptType, settings, scriptState); if (!startedStreaming) Platform::current()->histogramEnumeration(startedStreamingHistogramName(scriptType), 0, 2); } @@ -425,7 +421,7 @@ void ScriptStreamer::streamingCompleteOnBackgroundThread() // notifyFinished might already be called, or it might be called in the // future (if the parsing finishes earlier because of a parse error). - m_loadingTaskRunner->postTask(FROM_HERE, threadSafeBind(&ScriptStreamer::streamingComplete, AllowCrossThreadAccess(this))); + Platform::current()->mainThread()->taskRunner()->postTask(FROM_HERE, threadSafeBind(&ScriptStreamer::streamingComplete, AllowCrossThreadAccess(this))); // The task might delete ScriptStreamer, so it's not safe to do anything // after posting it. Note that there's no way to guarantee that this @@ -517,7 +513,7 @@ void ScriptStreamer::notifyAppendData(ScriptResource* resource) ASSERT(!m_stream); ASSERT(!m_source); - m_stream = new SourceStream(m_loadingTaskRunner.get()); + m_stream = new SourceStream(); // m_source takes ownership of m_stream. m_source = adoptPtr(new v8::ScriptCompiler::StreamedSource(m_stream, m_encoding)); @@ -568,7 +564,7 @@ void ScriptStreamer::notifyFinished(Resource* resource) notifyFinishedToClient(); } -ScriptStreamer::ScriptStreamer(ScriptResource* resource, PendingScript::Type scriptType, ScriptState* scriptState, v8::ScriptCompiler::CompileOptions compileOptions, WebTaskRunner* loadingTaskRunner) +ScriptStreamer::ScriptStreamer(ScriptResource* resource, PendingScript::Type scriptType, ScriptState* scriptState, v8::ScriptCompiler::CompileOptions compileOptions) : m_resource(resource) , m_detached(false) , m_stream(0) @@ -581,7 +577,6 @@ ScriptStreamer::ScriptStreamer(ScriptResource* resource, PendingScript::Type scr , m_scriptState(scriptState) , m_scriptType(scriptType) , m_encoding(v8::ScriptCompiler::StreamedSource::TWO_BYTE) // Unfortunately there's no dummy encoding value in the enum; let's use one we don't stream. - , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone())) { } @@ -637,7 +632,7 @@ void ScriptStreamer::notifyFinishedToClient() m_client->notifyFinished(m_resource); } -bool ScriptStreamer::startStreamingInternal(PendingScript& script, PendingScript::Type scriptType, Settings* settings, ScriptState* scriptState, WebTaskRunner* loadingTaskRunner) +bool ScriptStreamer::startStreamingInternal(PendingScript& script, PendingScript::Type scriptType, Settings* settings, ScriptState* scriptState) { ASSERT(isMainThread()); ASSERT(scriptState->contextIsValid()); @@ -670,7 +665,7 @@ bool ScriptStreamer::startStreamingInternal(PendingScript& script, PendingScript // The Resource might go out of scope if the script is no longer // needed. This makes PendingScript notify the ScriptStreamer when it is // destroyed. - script.setStreamer(ScriptStreamer::create(resource, scriptType, scriptState, compileOption, loadingTaskRunner)); + script.setStreamer(ScriptStreamer::create(resource, scriptType, scriptState, compileOption)); return true; } diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.h b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.h index c002175..e3eb425 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.h @@ -21,7 +21,6 @@ class ScriptResourceClient; class ScriptState; class Settings; class SourceStream; -class WebTaskRunner; // ScriptStreamer streams incomplete script data to V8 so that it can be parsed // while it's loaded. PendingScript holds a reference to ScriptStreamer. At the @@ -33,9 +32,9 @@ class WebTaskRunner; class CORE_EXPORT ScriptStreamer final : public RefCountedWillBeRefCountedGarbageCollected<ScriptStreamer> { WTF_MAKE_NONCOPYABLE(ScriptStreamer); public: - static PassRefPtrWillBeRawPtr<ScriptStreamer> create(ScriptResource* resource, PendingScript::Type scriptType, ScriptState* scriptState, v8::ScriptCompiler::CompileOptions compileOptions, WebTaskRunner* loadingTaskRunner) + static PassRefPtrWillBeRawPtr<ScriptStreamer> create(ScriptResource* resource, PendingScript::Type scriptType, ScriptState* scriptState, v8::ScriptCompiler::CompileOptions compileOptions) { - return adoptRefWillBeNoop(new ScriptStreamer(resource, scriptType, scriptState, compileOptions, loadingTaskRunner)); + return adoptRefWillBeNoop(new ScriptStreamer(resource, scriptType, scriptState, compileOptions)); } ~ScriptStreamer(); @@ -43,7 +42,7 @@ public: // Launches a task (on a background thread) which will stream the given // PendingScript into V8 as it loads. - static void startStreaming(PendingScript&, PendingScript::Type, Settings*, ScriptState*, WebTaskRunner*); + static void startStreaming(PendingScript&, PendingScript::Type, Settings*, ScriptState*); // Returns false if we cannot stream the given encoding. static bool convertEncoding(const char* encodingName, v8::ScriptCompiler::StreamedSource::Encoding*); @@ -108,12 +107,12 @@ private: // streamed. Non-const for testing. static size_t kSmallScriptThreshold; - ScriptStreamer(ScriptResource*, PendingScript::Type, ScriptState*, v8::ScriptCompiler::CompileOptions, WebTaskRunner*); + ScriptStreamer(ScriptResource*, PendingScript::Type, ScriptState*, v8::ScriptCompiler::CompileOptions); void streamingComplete(); void notifyFinishedToClient(); - static bool startStreamingInternal(PendingScript&, PendingScript::Type, Settings*, ScriptState*, WebTaskRunner*); + static bool startStreamingInternal(PendingScript&, PendingScript::Type, Settings*, ScriptState*); // This pointer is weak. If PendingScript and its Resource are deleted // before ScriptStreamer, PendingScript will notify ScriptStreamer of its @@ -150,8 +149,6 @@ private: // Encoding of the streamed script. Saved for sanity checking purposes. v8::ScriptCompiler::StreamedSource::Encoding m_encoding; - - OwnPtr<WebTaskRunner> m_loadingTaskRunner; }; } // namespace blink diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp index cbfdd8c..62d9c84 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp @@ -18,7 +18,6 @@ #include "platform/heap/Handle.h" #include "platform/testing/UnitTestHelpers.h" #include "public/platform/Platform.h" -#include "public/platform/WebScheduler.h" #include <gtest/gtest.h> #include <v8.h> @@ -65,8 +64,7 @@ private: class ScriptStreamingTest : public ::testing::Test { public: ScriptStreamingTest() - : m_loadingTaskRunner(Platform::current()->currentThread()->scheduler()->loadingTaskRunner()) - , m_scope(v8::Isolate::GetCurrent()) + : m_scope(v8::Isolate::GetCurrent()) , m_settings(Settings::create()) , m_resourceRequest("http://www.streaming-test.com/") , m_resource(new ScriptResource(m_resourceRequest, "UTF-8")) @@ -118,7 +116,6 @@ protected: testing::runPendingTasks(); } - WebTaskRunner* m_loadingTaskRunner; // NOT OWNED V8TestingScope m_scope; OwnPtr<Settings> m_settings; // The Resource and PendingScript where we stream from. These don't really @@ -145,7 +142,7 @@ private: TEST_F(ScriptStreamingTest, CompilingStreamedScript) { // Test that we can successfully compile a streamed script. - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState()); TestScriptResourceClient client; pendingScript().watchForLoad(&client); @@ -176,7 +173,7 @@ TEST_F(ScriptStreamingTest, CompilingStreamedScriptWithParseError) // Test that scripts with parse errors are handled properly. In those cases, // the V8 side typically finished before loading finishes: make sure we // handle it gracefully. - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState()); TestScriptResourceClient client; pendingScript().watchForLoad(&client); appendData("function foo() {"); @@ -208,7 +205,7 @@ TEST_F(ScriptStreamingTest, CancellingStreaming) { // Test that the upper layers (PendingScript and up) can be ramped down // while streaming is ongoing, and ScriptStreamer handles it gracefully. - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState()); TestScriptResourceClient client; pendingScript().watchForLoad(&client); appendData("function foo() {"); @@ -237,7 +234,7 @@ TEST_F(ScriptStreamingTest, SuppressingStreaming) // is suppressed (V8 doesn't parse while the script is loading), and the // upper layer (ScriptResourceClient) should get a notification when the // script is loaded. - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState()); TestScriptResourceClient client; pendingScript().watchForLoad(&client); appendData("function foo() {"); @@ -266,7 +263,7 @@ TEST_F(ScriptStreamingTest, EmptyScripts) // Empty scripts should also be streamed properly, that is, the upper layer // (ScriptResourceClient) should be notified when an empty script has been // loaded. - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState()); TestScriptResourceClient client; pendingScript().watchForLoad(&client); @@ -287,7 +284,7 @@ TEST_F(ScriptStreamingTest, SmallScripts) // Small scripts shouldn't be streamed. ScriptStreamer::setSmallScriptThresholdForTesting(100); - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState()); TestScriptResourceClient client; pendingScript().watchForLoad(&client); @@ -311,7 +308,7 @@ TEST_F(ScriptStreamingTest, ScriptsWithSmallFirstChunk) // chunk is small. ScriptStreamer::setSmallScriptThresholdForTesting(100); - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState()); TestScriptResourceClient client; pendingScript().watchForLoad(&client); @@ -341,7 +338,7 @@ TEST_F(ScriptStreamingTest, EncodingChanges) // loading it. m_resource->setEncoding("windows-1252"); - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState()); TestScriptResourceClient client; pendingScript().watchForLoad(&client); @@ -370,7 +367,7 @@ TEST_F(ScriptStreamingTest, EncodingFromBOM) // will also affect encoding detection. m_resource->setEncoding("windows-1252"); // This encoding is wrong on purpose. - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState()); TestScriptResourceClient client; pendingScript().watchForLoad(&client); diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index 34b8f70..f057388 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp @@ -5685,13 +5685,6 @@ bool Document::isSecureContext(String& errorMessage, const SecureContextCheck pr return true; } -WebTaskRunner* Document::loadingTaskRunner() const -{ - if (frame()) - return frame()->frameScheduler()->loadingTaskRunner(); - return Platform::current()->currentThread()->scheduler()->loadingTaskRunner(); -} - DEFINE_TRACE(Document) { #if ENABLE(OILPAN) diff --git a/third_party/WebKit/Source/core/dom/Document.h b/third_party/WebKit/Source/core/dom/Document.h index 511c567..926381d 100644 --- a/third_party/WebKit/Source/core/dom/Document.h +++ b/third_party/WebKit/Source/core/dom/Document.h @@ -1049,8 +1049,6 @@ public: using WeakDocumentSet = WillBeHeapHashSet<RawPtrWillBeWeakMember<Document>>; static WeakDocumentSet& liveDocumentSet(); - WebTaskRunner* loadingTaskRunner() const; - protected: Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass); diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp index 8f8b617..e63ea29 100644 --- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp @@ -50,7 +50,6 @@ #include "core/svg/SVGScriptElement.h" #include "platform/MIMETypeRegistry.h" #include "platform/weborigin/SecurityOrigin.h" -#include "public/platform/WebFrameScheduler.h" #include "wtf/StdLibExtras.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/StringHash.h" @@ -260,7 +259,7 @@ bool ScriptLoader::prepareScript(const TextPosition& scriptStartPosition, Legacy if (frame) { ScriptState* scriptState = ScriptState::forMainWorld(frame); if (scriptState->contextIsValid()) - ScriptStreamer::startStreaming(m_pendingScript, PendingScript::Async, frame->settings(), scriptState, frame->frameScheduler()->loadingTaskRunner()); + ScriptStreamer::startStreaming(m_pendingScript, PendingScript::Async, frame->settings(), scriptState); } contextDocument->scriptRunner()->queueScriptForExecution(this, ScriptRunner::ASYNC_EXECUTION); // Note that watchForLoad can immediately call notifyFinished. diff --git a/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp b/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp index 68adfdf..f5cf582 100644 --- a/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp @@ -72,7 +72,7 @@ public: explicit MockWebTaskRunner(Deque<OwnPtr<WebTaskRunner::Task>>* tasks) : m_tasks(tasks) { } ~MockWebTaskRunner() override { } - void postTask(const WebTraceLocation&, Task* task) override + virtual void postTask(const WebTraceLocation&, Task* task) { m_tasks->append(adoptPtr(task)); } @@ -82,12 +82,6 @@ public: ASSERT_NOT_REACHED(); } - WebTaskRunner* clone() override - { - ASSERT_NOT_REACHED(); - return nullptr; - } - Deque<OwnPtr<WebTaskRunner::Task>>* m_tasks; // NOT OWNED }; diff --git a/third_party/WebKit/Source/core/fetch/FetchContext.h b/third_party/WebKit/Source/core/fetch/FetchContext.h index 243bf2b..dbcb39b 100644 --- a/third_party/WebKit/Source/core/fetch/FetchContext.h +++ b/third_party/WebKit/Source/core/fetch/FetchContext.h @@ -48,7 +48,6 @@ class ResourceLoader; class ResourceResponse; class ResourceRequest; class ResourceTimingInfo; -class WebTaskRunner; enum FetchResourceType { FetchMainResource, @@ -107,7 +106,6 @@ public: virtual bool fetchIncreasePriorities() const { return false; } virtual ResourceLoadPriority modifyPriorityForExperiments(ResourceLoadPriority priority, Resource::Type, const FetchRequest&) { return priority; } - virtual WebTaskRunner* loadingTaskRunner() const { return nullptr; } protected: FetchContext() { } diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp index bea44b3..8e09575 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp +++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp @@ -172,14 +172,6 @@ ResourceFetcher::~ResourceFetcher() #endif } -WebTaskRunner* ResourceFetcher::loadingTaskRunner() -{ - if (!m_context) - return nullptr; - - return m_context->loadingTaskRunner(); -} - Resource* ResourceFetcher::cachedResource(const KURL& resourceURL) const { KURL url = MemoryCache::removeFragmentIdentifierIfNeeded(resourceURL); diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.h b/third_party/WebKit/Source/core/fetch/ResourceFetcher.h index 26cdfdc..670f1ca 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.h +++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.h @@ -147,8 +147,6 @@ public: bool clientDefersImage(const KURL&) const; void determineRequestContext(ResourceRequest&, Resource::Type); - WebTaskRunner* loadingTaskRunner(); - private: friend class ResourceCacheValidationSuppressor; diff --git a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp index 2305adf..be3969e 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp +++ b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp @@ -142,7 +142,6 @@ void ResourceLoader::start() m_loader = adoptPtr(Platform::current()->createURLLoader()); ASSERT(m_loader); - m_loader->setLoadingTaskRunner(m_fetcher->loadingTaskRunner()); WrappedResourceRequest wrappedRequest(m_request); m_loader->loadAsynchronously(wrappedRequest, this); } diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp index e069d7b..3589b67 100644 --- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp +++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp @@ -33,7 +33,7 @@ #include "platform/Task.h" #include "platform/ThreadSafeFunctional.h" #include "public/platform/Platform.h" -#include "public/platform/WebTaskRunner.h" +#include "public/platform/WebScheduler.h" #include "wtf/text/TextPosition.h" namespace blink { @@ -81,9 +81,9 @@ static void checkThatXSSInfosAreSafeToSendToAnotherThread(const XSSInfoStream& i #endif -void BackgroundHTMLParser::start(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, WebTaskRunner* loadingTaskRunner) +void BackgroundHTMLParser::start(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, WebScheduler* scheduler) { - new BackgroundHTMLParser(reference, config, loadingTaskRunner); + new BackgroundHTMLParser(reference, config, scheduler); // Caller must free by calling stop(). } @@ -93,7 +93,7 @@ BackgroundHTMLParser::Configuration::Configuration() { } -BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, WebTaskRunner* loadingTaskRunner) +BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, WebScheduler* scheduler) : m_weakFactory(reference, this) , m_token(adoptPtr(new HTMLToken)) , m_tokenizer(HTMLTokenizer::create(config->options)) @@ -106,7 +106,7 @@ BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHT , m_xssAuditor(config->xssAuditor.release()) , m_preloadScanner(config->preloadScanner.release()) , m_decoder(config->decoder.release()) - , m_loadingTaskRunner(loadingTaskRunner) + , m_scheduler(scheduler) , m_startingScript(false) { ASSERT(m_outstandingTokenLimit > 0); @@ -157,7 +157,7 @@ void BackgroundHTMLParser::updateDocument(const String& decodedData) m_lastSeenEncodingData = encodingData; m_xssAuditor->setEncoding(encodingData.encoding()); - m_loadingTaskRunner->postTask( + m_scheduler->loadingTaskRunner()->postTask( FROM_HERE, threadSafeBind(&HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser, AllowCrossThreadAccess(m_parser), encodingData)); } @@ -291,7 +291,7 @@ void BackgroundHTMLParser::sendTokensToMainThread() chunk->startingScript = m_startingScript; m_startingScript = false; - m_loadingTaskRunner->postTask( + m_scheduler->loadingTaskRunner()->postTask( FROM_HERE, new Task(threadSafeBind(&HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser, AllowCrossThreadAccess(m_parser), chunk.release()))); diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h index 6430f31..6922c31 100644 --- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h +++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h @@ -42,7 +42,7 @@ namespace blink { class HTMLDocumentParser; class XSSAuditor; -class WebTaskRunner; +class WebScheduler; class BackgroundHTMLParser { WTF_MAKE_FAST_ALLOCATED(BackgroundHTMLParser); @@ -63,7 +63,7 @@ public: size_t pendingTokenLimit; }; - static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPtr<Configuration>, WebTaskRunner*); + static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPtr<Configuration>, WebScheduler*); struct Checkpoint { WTF_MAKE_FAST_ALLOCATED(CheckPoint); @@ -90,7 +90,7 @@ public: void forcePlaintextForTextDocument(); private: - BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPtr<Configuration>, WebTaskRunner*); + BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPtr<Configuration>, WebScheduler*); ~BackgroundHTMLParser(); void appendDecodedBytes(const String&); @@ -118,7 +118,7 @@ private: OwnPtr<TokenPreloadScanner> m_preloadScanner; OwnPtr<TextResourceDecoder> m_decoder; DocumentEncodingData m_lastSeenEncodingData; - WebTaskRunner* m_loadingTaskRunner; // NOT OWNED, task runner will outlive BackgroundHTMLParserr + WebScheduler* m_scheduler; // NOT OWNED, scheduler will outlive BackgroundHTMLParser bool m_startingScript; }; diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp index 6a9670d..868e71e 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp @@ -50,7 +50,6 @@ #include "platform/TraceEvent.h" #include "platform/heap/Handle.h" #include "public/platform/Platform.h" -#include "public/platform/WebFrameScheduler.h" #include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "wtf/RefCounted.h" @@ -144,8 +143,7 @@ HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, bool reportErrors , m_tokenizer(syncPolicy == ForceSynchronousParsing ? HTMLTokenizer::create(m_options) : nullptr) , m_scriptRunner(HTMLScriptRunner::create(&document, this)) , m_treeBuilder(HTMLTreeBuilder::create(this, &document, parserContentPolicy(), reportErrors, m_options)) - , m_loadingTaskRunner(adoptPtr(document.loadingTaskRunner()->clone())) - , m_parserScheduler(HTMLParserScheduler::create(this, m_loadingTaskRunner.get())) + , m_parserScheduler(HTMLParserScheduler::create(this)) , m_xssAuditorDelegate(&document) , m_weakFactory(this) , m_preloader(HTMLResourcePreloader::create(document)) @@ -168,7 +166,6 @@ HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* cont , m_token(adoptPtr(new HTMLToken)) , m_tokenizer(HTMLTokenizer::create(m_options)) , m_treeBuilder(HTMLTreeBuilder::create(this, fragment, contextElement, this->parserContentPolicy(), m_options)) - , m_loadingTaskRunner(adoptPtr(fragment->document().loadingTaskRunner()->clone())) , m_xssAuditorDelegate(&fragment->document()) , m_weakFactory(this) , m_shouldUseThreading(false) @@ -804,7 +801,7 @@ void HTMLDocumentParser::startBackgroundParser() ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); ASSERT(config->preloadScanner->isSafeToSendToAnotherThread()); HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::start, reference.release(), config.release(), - AllowCrossThreadAccess(m_loadingTaskRunner.get()))); + AllowCrossThreadAccess(Platform::current()->currentThread()->scheduler()))); } void HTMLDocumentParser::stopBackgroundParser() diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h index f41d9b03..8fba554 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h @@ -187,7 +187,6 @@ private: OwnPtrWillBeMember<HTMLTreeBuilder> m_treeBuilder; OwnPtr<HTMLPreloadScanner> m_preloadScanner; OwnPtr<HTMLPreloadScanner> m_insertionPreloadScanner; - OwnPtr<WebTaskRunner> m_loadingTaskRunner; OwnPtr<HTMLParserScheduler> m_parserScheduler; HTMLSourceTracker m_sourceTracker; TextPosition m_textPosition; diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp index 58a3ded..c15e43b5 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp @@ -82,9 +82,9 @@ void SpeculationsPumpSession::addedElementTokens(size_t count) m_processedElementTokens += count; } -HTMLParserScheduler::HTMLParserScheduler(HTMLDocumentParser* parser, WebTaskRunner* loadingTaskRunner) +HTMLParserScheduler::HTMLParserScheduler(HTMLDocumentParser* parser) : m_parser(parser) - , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone())) + , m_loadingTaskRunner(Platform::current()->currentThread()->scheduler()->loadingTaskRunner()) , m_cancellableContinueParse(CancellableTaskFactory::create(this, &HTMLParserScheduler::continueParsing)) , m_isSuspendedWithActiveTimer(false) { diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h index ad3ccaa..d7878db 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h @@ -36,7 +36,6 @@ namespace blink { class Document; class HTMLDocumentParser; -class WebTaskRunner; class ActiveParserSession : public NestingLevelIncrementer { STACK_ALLOCATED(); @@ -73,9 +72,9 @@ private: class HTMLParserScheduler { WTF_MAKE_NONCOPYABLE(HTMLParserScheduler); WTF_MAKE_FAST_ALLOCATED(HTMLParserScheduler); public: - static PassOwnPtr<HTMLParserScheduler> create(HTMLDocumentParser* parser, WebTaskRunner* loadingTaskRunner) + static PassOwnPtr<HTMLParserScheduler> create(HTMLDocumentParser* parser) { - return adoptPtr(new HTMLParserScheduler(parser, loadingTaskRunner)); + return adoptPtr(new HTMLParserScheduler(parser)); } ~HTMLParserScheduler(); @@ -99,13 +98,13 @@ public: void detach(); // Clear active tasks if any. private: - HTMLParserScheduler(HTMLDocumentParser*, WebTaskRunner*); + explicit HTMLParserScheduler(HTMLDocumentParser*); bool shouldYield(const SpeculationsPumpSession&, bool startingScript) const; void continueParsing(); HTMLDocumentParser* m_parser; - OwnPtr<WebTaskRunner> m_loadingTaskRunner; + WebTaskRunner* m_loadingTaskRunner; // NOT OWNED OwnPtr<CancellableTaskFactory> m_cancellableContinueParse; bool m_isSuspendedWithActiveTimer; diff --git a/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp index 35b1258..3d80848 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp @@ -40,7 +40,6 @@ #include "core/html/parser/NestingLevelIncrementer.h" #include "platform/NotImplemented.h" #include "public/platform/Platform.h" -#include "public/platform/WebFrameScheduler.h" namespace blink { @@ -288,7 +287,7 @@ void HTMLScriptRunner::requestParsingBlockingScript(Element* element) if (m_document->frame()) { ScriptState* scriptState = ScriptState::forMainWorld(m_document->frame()); if (scriptState->contextIsValid()) - ScriptStreamer::startStreaming(m_parserBlockingScript, PendingScript::ParsingBlocking, m_document->frame()->settings(), scriptState, m_document->loadingTaskRunner()); + ScriptStreamer::startStreaming(m_parserBlockingScript, PendingScript::ParsingBlocking, m_document->frame()->settings(), scriptState); } m_parserBlockingScript.watchForLoad(this); @@ -304,7 +303,7 @@ void HTMLScriptRunner::requestDeferredScript(Element* element) if (m_document->frame() && !pendingScript.isReady()) { ScriptState* scriptState = ScriptState::forMainWorld(m_document->frame()); if (scriptState->contextIsValid()) - ScriptStreamer::startStreaming(pendingScript, PendingScript::Deferred, m_document->frame()->settings(), scriptState, m_document->loadingTaskRunner()); + ScriptStreamer::startStreaming(pendingScript, PendingScript::Deferred, m_document->frame()->settings(), scriptState); } ASSERT(pendingScript.resource()); diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp index 5fb9d1e..527a8d1 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp @@ -64,7 +64,6 @@ #include "platform/network/ResourceTimingInfo.h" #include "platform/weborigin/SchemeRegistry.h" #include "platform/weborigin/SecurityPolicy.h" -#include "public/platform/WebFrameScheduler.h" #include <algorithm> @@ -733,11 +732,6 @@ ResourceLoadPriority FrameFetchContext::modifyPriorityForExperiments(ResourceLoa return static_cast<ResourceLoadPriority>(modifiedPriority); } -WebTaskRunner* FrameFetchContext::loadingTaskRunner() const -{ - return frame()->frameScheduler()->loadingTaskRunner(); -} - DEFINE_TRACE(FrameFetchContext) { visitor->trace(m_document); diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.h b/third_party/WebKit/Source/core/loader/FrameFetchContext.h index a71afae..de5c516 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.h +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.h @@ -109,8 +109,6 @@ public: void countClientHintsResourceWidth() override; void countClientHintsViewportWidth() override; - WebTaskRunner* loadingTaskRunner() const override; - DECLARE_VIRTUAL_TRACE(); private: diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp index e25c9cb..05fe067 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp +++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp @@ -1072,8 +1072,7 @@ bool FrameLoader::prepareForCommit() if (m_frame->document()) m_frame->document()->detach(); m_documentLoader = m_provisionalDocumentLoader.release(); - m_frame->updateFrameSecurityOrigin(); - + return true; } diff --git a/third_party/WebKit/Source/platform/TimerTest.cpp b/third_party/WebKit/Source/platform/TimerTest.cpp index 6db91cb..9a0900c 100644 --- a/third_party/WebKit/Source/platform/TimerTest.cpp +++ b/third_party/WebKit/Source/platform/TimerTest.cpp @@ -77,7 +77,7 @@ public: explicit MockWebTaskRunner(std::priority_queue<DelayedTask>* timerTasks) : m_timerTasks(timerTasks) { } ~MockWebTaskRunner() override { } - void postTask(const WebTraceLocation&, Task* task) override + virtual void postTask(const WebTraceLocation&, Task* task) { m_timerTasks->push(DelayedTask(task, 0)); } @@ -87,12 +87,6 @@ public: m_timerTasks->push(DelayedTask(task, delayMs * 0.001)); } - WebTaskRunner* clone() override - { - ASSERT_NOT_REACHED(); - return nullptr; - } - std::priority_queue<DelayedTask>* m_timerTasks; // NOT OWNED }; diff --git a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp index abc94b7..8cf1c04 100644 --- a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp @@ -260,7 +260,7 @@ private: MockWebTaskRunner() : m_task(0) { } ~MockWebTaskRunner() override { } - void postTask(const WebTraceLocation&, Task* task) override + virtual void postTask(const WebTraceLocation&, Task* task) { EXPECT_EQ((Task*)0, m_task); m_task = task; @@ -268,12 +268,6 @@ private: void postDelayedTask(const WebTraceLocation&, Task*, double delayMs) override { ASSERT_NOT_REACHED(); }; - WebTaskRunner* clone() override - { - ASSERT_NOT_REACHED(); - return nullptr; - } - Task* m_task; }; diff --git a/third_party/WebKit/Source/web/AssociatedURLLoader.cpp b/third_party/WebKit/Source/web/AssociatedURLLoader.cpp index a167fc4..bd33455 100644 --- a/third_party/WebKit/Source/web/AssociatedURLLoader.cpp +++ b/third_party/WebKit/Source/web/AssociatedURLLoader.cpp @@ -383,9 +383,4 @@ void AssociatedURLLoader::setDefersLoading(bool defersLoading) m_loader->setDefersLoading(defersLoading); } -void AssociatedURLLoader::setLoadingTaskRunner(blink::WebTaskRunner*) -{ - // TODO(alexclarke): Maybe support this one day if it proves worthwhile. -} - } // namespace blink diff --git a/third_party/WebKit/Source/web/AssociatedURLLoader.h b/third_party/WebKit/Source/web/AssociatedURLLoader.h index 6dcd06e..41b0c26 100644 --- a/third_party/WebKit/Source/web/AssociatedURLLoader.h +++ b/third_party/WebKit/Source/web/AssociatedURLLoader.h @@ -54,7 +54,6 @@ public: void loadAsynchronously(const WebURLRequest&, WebURLLoaderClient*) override; void cancel() override; void setDefersLoading(bool) override; - void setLoadingTaskRunner(blink::WebTaskRunner*) override; private: |