| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef InspectorTaskRunner_h | 5 #ifndef InspectorTaskRunner_h |
| 6 #define InspectorTaskRunner_h | 6 #define InspectorTaskRunner_h |
| 7 | 7 |
| 8 #include "wtf/Forward.h" | 8 #include "wtf/Forward.h" |
| 9 #include "wtf/Noncopyable.h" | 9 #include "wtf/Noncopyable.h" |
| 10 #include "wtf/OwnPtr.h" | 10 #include "wtf/OwnPtr.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class Task { | 22 class Task { |
| 23 public: | 23 public: |
| 24 virtual ~Task() { } | 24 virtual ~Task() { } |
| 25 virtual void run() = 0; | 25 virtual void run() = 0; |
| 26 }; | 26 }; |
| 27 // This method can be called on any thread. It is caller's responsibility to
make sure that | 27 // This method can be called on any thread. It is caller's responsibility to
make sure that |
| 28 // this V8Debugger and corresponding v8::Isolate exist while this method is
running. | 28 // this V8Debugger and corresponding v8::Isolate exist while this method is
running. |
| 29 void interruptAndRun(PassOwnPtr<Task>); | 29 void interruptAndRun(PassOwnPtr<Task>); |
| 30 void runPendingTasks(); | 30 void runPendingTasks(); |
| 31 | 31 |
| 32 void setIgnoreInterrupts(bool ignore) { m_ignoreInterrupts = ignore; } | 32 class IgnoreInterruptsScope final { |
| 33 public: |
| 34 explicit IgnoreInterruptsScope(InspectorTaskRunner*); |
| 35 ~IgnoreInterruptsScope(); |
| 36 |
| 37 private: |
| 38 bool m_wasIgnoring; |
| 39 InspectorTaskRunner* m_taskRunner; |
| 40 }; |
| 33 | 41 |
| 34 private: | 42 private: |
| 35 static void v8InterruptCallback(v8::Isolate*, void* data); | 43 static void v8InterruptCallback(v8::Isolate*, void* data); |
| 36 | 44 |
| 37 v8::Isolate* m_isolate; | 45 v8::Isolate* m_isolate; |
| 38 class ThreadSafeTaskQueue; | 46 class ThreadSafeTaskQueue; |
| 39 OwnPtr<ThreadSafeTaskQueue> m_taskQueue; | 47 OwnPtr<ThreadSafeTaskQueue> m_taskQueue; |
| 40 bool m_ignoreInterrupts; | 48 bool m_ignoreInterrupts; |
| 41 }; | 49 }; |
| 42 | 50 |
| 43 } // namespace blink | 51 } // namespace blink |
| 44 | 52 |
| 45 | 53 |
| 46 #endif // !defined(InspectorTaskRunner_h) | 54 #endif // !defined(InspectorTaskRunner_h) |
| OLD | NEW |