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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.cpp

Issue 2830533002: Split ScriptStreamer and ScriptStreamerImpl, preparing for unit testing (Closed)
Patch Set: Rebase Created 3 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ScriptStreamerThread.h" 5 #include "bindings/core/v8/ScriptStreamerThread.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "bindings/core/v8/ScriptStreamer.h" 8 #include "bindings/core/v8/ScriptStreamerImpl.h"
9 #include "core/inspector/InspectorTraceEvents.h" 9 #include "core/inspector/InspectorTraceEvents.h"
10 #include "platform/WebTaskRunner.h" 10 #include "platform/WebTaskRunner.h"
11 #include "platform/instrumentation/tracing/TraceEvent.h" 11 #include "platform/instrumentation/tracing/TraceEvent.h"
12 #include "platform/wtf/PtrUtil.h" 12 #include "platform/wtf/PtrUtil.h"
13 #include "public/platform/Platform.h" 13 #include "public/platform/Platform.h"
14 #include "public/platform/WebTraceLocation.h" 14 #include "public/platform/WebTraceLocation.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 static ScriptStreamerThread* g_shared_thread = 0; 18 static ScriptStreamerThread* g_shared_thread = 0;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 WebThread& ScriptStreamerThread::PlatformThread() { 52 WebThread& ScriptStreamerThread::PlatformThread() {
53 if (!IsRunning()) { 53 if (!IsRunning()) {
54 thread_ = WTF::WrapUnique( 54 thread_ = WTF::WrapUnique(
55 Platform::Current()->CreateThread("ScriptStreamerThread")); 55 Platform::Current()->CreateThread("ScriptStreamerThread"));
56 } 56 }
57 return *thread_; 57 return *thread_;
58 } 58 }
59 59
60 void ScriptStreamerThread::RunScriptStreamingTask( 60 void ScriptStreamerThread::RunScriptStreamingTask(
61 std::unique_ptr<v8::ScriptCompiler::ScriptStreamingTask> task, 61 std::unique_ptr<v8::ScriptCompiler::ScriptStreamingTask> task,
62 ScriptStreamer* streamer) { 62 ScriptStreamerImpl* streamer) {
63 TRACE_EVENT1( 63 TRACE_EVENT1(
64 "v8,devtools.timeline", "v8.parseOnBackground", "data", 64 "v8,devtools.timeline", "v8.parseOnBackground", "data",
65 InspectorParseScriptEvent::Data(streamer->ScriptResourceIdentifier(), 65 InspectorParseScriptEvent::Data(streamer->ScriptResourceIdentifier(),
66 streamer->ScriptURLString())); 66 streamer->ScriptURLString()));
67 // Running the task can and will block: SourceStream::GetSomeData will get 67 // Running the task can and will block: SourceStream::GetSomeData will get
68 // called and it will block and wait for data from the network. 68 // called and it will block and wait for data from the network.
69 task->Run(); 69 task->Run();
70 streamer->StreamingCompleteOnBackgroundThread(); 70 streamer->StreamingCompleteOnBackgroundThread();
71 MutexLocker locker(*g_mutex); 71 MutexLocker locker(*g_mutex);
72 ScriptStreamerThread* thread = Shared(); 72 ScriptStreamerThread* thread = Shared();
73 if (thread) 73 if (thread)
74 thread->TaskDone(); 74 thread->TaskDone();
75 // If thread is 0, we're shutting down. 75 // If thread is 0, we're shutting down.
76 } 76 }
77 77
78 } // namespace blink 78 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698