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

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

Issue 1848443008: Simplify ScriptStreamer lifetime handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "bindings/core/v8/ScriptStreamer.h" 7 #include "bindings/core/v8/ScriptStreamer.h"
8 #include "core/inspector/InspectorTraceEvents.h" 8 #include "core/inspector/InspectorTraceEvents.h"
9 #include "platform/TraceEvent.h" 9 #include "platform/TraceEvent.h"
10 #include "public/platform/Platform.h" 10 #include "public/platform/Platform.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 m_runningTask = false; 69 m_runningTask = false;
70 } 70 }
71 71
72 WebThread& ScriptStreamerThread::platformThread() 72 WebThread& ScriptStreamerThread::platformThread()
73 { 73 {
74 if (!isRunning()) 74 if (!isRunning())
75 m_thread = adoptPtr(Platform::current()->createThread("ScriptStreamerThr ead")); 75 m_thread = adoptPtr(Platform::current()->createThread("ScriptStreamerThr ead"));
76 return *m_thread; 76 return *m_thread;
77 } 77 }
78 78
79 void ScriptStreamerThread::runScriptStreamingTask(WTF::PassOwnPtr<v8::ScriptComp iler::ScriptStreamingTask> task, ScriptStreamer* streamer) 79 void ScriptStreamerThread::runScriptStreamingTask(PassOwnPtr<v8::ScriptCompiler: :ScriptStreamingTask> task, ScriptStreamer* streamer)
80 { 80 {
81 TRACE_EVENT1("v8,devtools.timeline", "v8.parseOnBackground", "data", Inspect orParseScriptEvent::data(streamer->scriptResourceIdentifier(), streamer->scriptU RLString())); 81 TRACE_EVENT1("v8,devtools.timeline", "v8.parseOnBackground", "data", Inspect orParseScriptEvent::data(streamer->scriptResourceIdentifier(), streamer->scriptU RLString()));
82 // Running the task can and will block: SourceStream::GetSomeData will get 82 // Running the task can and will block: SourceStream::GetSomeData will get
83 // called and it will block and wait for data from the network. 83 // called and it will block and wait for data from the network.
84 task->Run(); 84 task->Run();
85 streamer->streamingCompleteOnBackgroundThread(); 85 streamer->streamingCompleteOnBackgroundThread();
86 MutexLocker locker(*s_mutex); 86 MutexLocker locker(*s_mutex);
87 ScriptStreamerThread* thread = shared(); 87 ScriptStreamerThread* thread = shared();
88 if (thread) 88 if (thread)
89 thread->taskDone(); 89 thread->taskDone();
90 // If thread is 0, we're shutting down. 90 // If thread is 0, we're shutting down.
91 } 91 }
92 92
93 } // namespace blink 93 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698