| OLD | NEW |
| 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 "platform/TraceEvent.h" | 8 #include "platform/TraceEvent.h" |
| 9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
| 10 #include "public/platform/WebTaskRunner.h" | 10 #include "public/platform/WebTaskRunner.h" |
| 11 #include "public/platform/WebTraceLocation.h" | 11 #include "public/platform/WebTraceLocation.h" |
| 12 #include "wtf/MainThread.h" | |
| 13 | 12 |
| 14 namespace blink { | 13 namespace blink { |
| 15 | 14 |
| 16 static ScriptStreamerThread* s_sharedThread = 0; | 15 static ScriptStreamerThread* s_sharedThread = 0; |
| 17 // Guards s_sharedThread. s_sharedThread is initialized and deleted in the main | 16 // Guards s_sharedThread. s_sharedThread is initialized and deleted in the main |
| 18 // thread, but also used by the streamer thread. Races can occur during | 17 // thread, but also used by the streamer thread. Races can occur during |
| 19 // shutdown. | 18 // shutdown. |
| 20 static Mutex* s_mutex = 0; | 19 static Mutex* s_mutex = 0; |
| 21 | 20 |
| 22 void ScriptStreamerThread::init() | 21 void ScriptStreamerThread::init() |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 task->Run(); | 83 task->Run(); |
| 85 streamer->streamingCompleteOnBackgroundThread(); | 84 streamer->streamingCompleteOnBackgroundThread(); |
| 86 MutexLocker locker(*s_mutex); | 85 MutexLocker locker(*s_mutex); |
| 87 ScriptStreamerThread* thread = shared(); | 86 ScriptStreamerThread* thread = shared(); |
| 88 if (thread) | 87 if (thread) |
| 89 thread->taskDone(); | 88 thread->taskDone(); |
| 90 // If thread is 0, we're shutting down. | 89 // If thread is 0, we're shutting down. |
| 91 } | 90 } |
| 92 | 91 |
| 93 } // namespace blink | 92 } // namespace blink |
| OLD | NEW |