| 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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Now it's safe to delete s_mutex, since there are no tasks that could | 46 // Now it's safe to delete s_mutex, since there are no tasks that could |
| 47 // access it later. | 47 // access it later. |
| 48 delete s_mutex; | 48 delete s_mutex; |
| 49 } | 49 } |
| 50 | 50 |
| 51 ScriptStreamerThread* ScriptStreamerThread::shared() | 51 ScriptStreamerThread* ScriptStreamerThread::shared() |
| 52 { | 52 { |
| 53 return s_sharedThread; | 53 return s_sharedThread; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void ScriptStreamerThread::postTask(PassOwnPtr<Closure> task) | 56 void ScriptStreamerThread::postTask(PassOwnPtr<CrossThreadClosure> task) |
| 57 { | 57 { |
| 58 ASSERT(isMainThread()); | 58 ASSERT(isMainThread()); |
| 59 MutexLocker locker(m_mutex); | 59 MutexLocker locker(m_mutex); |
| 60 ASSERT(!m_runningTask); | 60 ASSERT(!m_runningTask); |
| 61 m_runningTask = true; | 61 m_runningTask = true; |
| 62 platformThread().getWebTaskRunner()->postTask(BLINK_FROM_HERE, task); | 62 platformThread().getWebTaskRunner()->postTask(BLINK_FROM_HERE, task); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void ScriptStreamerThread::taskDone() | 65 void ScriptStreamerThread::taskDone() |
| 66 { | 66 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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 |
| OLD | NEW |