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

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

Issue 2846843002: [blink] Unique pointers in Platform.h (Closed)
Patch Set: fix compilation (and again) Created 3 years, 7 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/ScriptStreamer.h"
9 #include "core/inspector/InspectorTraceEvents.h" 9 #include "core/inspector/InspectorTraceEvents.h"
10 #include "platform/WebTaskRunner.h" 10 #include "platform/WebTaskRunner.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 45
46 void ScriptStreamerThread::TaskDone() { 46 void ScriptStreamerThread::TaskDone() {
47 MutexLocker locker(mutex_); 47 MutexLocker locker(mutex_);
48 DCHECK(running_task_); 48 DCHECK(running_task_);
49 running_task_ = false; 49 running_task_ = false;
50 } 50 }
51 51
52 WebThread& ScriptStreamerThread::PlatformThread() { 52 WebThread& ScriptStreamerThread::PlatformThread() {
53 if (!IsRunning()) { 53 if (!IsRunning()) {
54 thread_ = WTF::WrapUnique( 54 thread_ = Platform::Current()->CreateThread("ScriptStreamerThread");
55 Platform::Current()->CreateThread("ScriptStreamerThread"));
56 } 55 }
57 return *thread_; 56 return *thread_;
58 } 57 }
59 58
60 void ScriptStreamerThread::RunScriptStreamingTask( 59 void ScriptStreamerThread::RunScriptStreamingTask(
61 std::unique_ptr<v8::ScriptCompiler::ScriptStreamingTask> task, 60 std::unique_ptr<v8::ScriptCompiler::ScriptStreamingTask> task,
62 ScriptStreamer* streamer) { 61 ScriptStreamer* streamer) {
63 TRACE_EVENT1( 62 TRACE_EVENT1(
64 "v8,devtools.timeline", "v8.parseOnBackground", "data", 63 "v8,devtools.timeline", "v8.parseOnBackground", "data",
65 InspectorParseScriptEvent::Data(streamer->ScriptResourceIdentifier(), 64 InspectorParseScriptEvent::Data(streamer->ScriptResourceIdentifier(),
66 streamer->ScriptURLString())); 65 streamer->ScriptURLString()));
67 // Running the task can and will block: SourceStream::GetSomeData will get 66 // Running the task can and will block: SourceStream::GetSomeData will get
68 // called and it will block and wait for data from the network. 67 // called and it will block and wait for data from the network.
69 task->Run(); 68 task->Run();
70 streamer->StreamingCompleteOnBackgroundThread(); 69 streamer->StreamingCompleteOnBackgroundThread();
71 MutexLocker locker(*g_mutex); 70 MutexLocker locker(*g_mutex);
72 ScriptStreamerThread* thread = Shared(); 71 ScriptStreamerThread* thread = Shared();
73 if (thread) 72 if (thread)
74 thread->TaskDone(); 73 thread->TaskDone();
75 // If thread is 0, we're shutting down. 74 // If thread is 0, we're shutting down.
76 } 75 }
77 76
78 } // namespace blink 77 } // namespace blink
OLDNEW
« no previous file with comments | « content/test/test_blink_web_unit_test_support.cc ('k') | third_party/WebKit/Source/core/dom/SecurityContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698