| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 virtual WorkerBackingThread& workerBackingThread() = 0; | 77 virtual WorkerBackingThread& workerBackingThread() = 0; |
| 78 virtual bool shouldAttachThreadDebugger() const { return true; } | 78 virtual bool shouldAttachThreadDebugger() const { return true; } |
| 79 v8::Isolate* isolate(); | 79 v8::Isolate* isolate(); |
| 80 | 80 |
| 81 // Can be used to wait for this worker thread to terminate. | 81 // Can be used to wait for this worker thread to terminate. |
| 82 // (This is signaled on the main thread, so it's assumed to be waited on | 82 // (This is signaled on the main thread, so it's assumed to be waited on |
| 83 // the worker context thread) | 83 // the worker context thread) |
| 84 WaitableEvent* terminationEvent() { return m_terminationEvent.get(); } | 84 WaitableEvent* terminationEvent() { return m_terminationEvent.get(); } |
| 85 | 85 |
| 86 bool isCurrentThread(); | 86 bool isCurrentThread(); |
| 87 |
| 87 WorkerLoaderProxy* workerLoaderProxy() const | 88 WorkerLoaderProxy* workerLoaderProxy() const |
| 88 { | 89 { |
| 89 RELEASE_ASSERT(m_workerLoaderProxy); | 90 RELEASE_ASSERT(m_workerLoaderProxy); |
| 90 return m_workerLoaderProxy.get(); | 91 return m_workerLoaderProxy.get(); |
| 91 } | 92 } |
| 92 | 93 |
| 93 WorkerReportingProxy& workerReportingProxy() const { return m_workerReportin
gProxy; } | 94 WorkerReportingProxy& workerReportingProxy() const { return m_workerReportin
gProxy; } |
| 94 | 95 |
| 95 void postTask(const WebTraceLocation&, std::unique_ptr<ExecutionContextTask>
); | 96 void postTask(const WebTraceLocation&, std::unique_ptr<ExecutionContextTask>
); |
| 96 void appendDebuggerTask(std::unique_ptr<CrossThreadClosure>); | 97 void appendDebuggerTask(std::unique_ptr<CrossThreadClosure>); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 121 virtual WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadSt
artupData>) = 0; | 122 virtual WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadSt
artupData>) = 0; |
| 122 | 123 |
| 123 // Called on the worker thread. | 124 // Called on the worker thread. |
| 124 virtual void postInitialize() { } | 125 virtual void postInitialize() { } |
| 125 | 126 |
| 126 private: | 127 private: |
| 127 class WorkerMicrotaskRunner; | 128 class WorkerMicrotaskRunner; |
| 128 | 129 |
| 129 std::unique_ptr<CrossThreadClosure> createWorkerThreadTask(std::unique_ptr<E
xecutionContextTask>, bool isInstrumented); | 130 std::unique_ptr<CrossThreadClosure> createWorkerThreadTask(std::unique_ptr<E
xecutionContextTask>, bool isInstrumented); |
| 130 | 131 |
| 131 // Called on the worker thread. | 132 void initializeOnWorkerThread(PassOwnPtr<WorkerThreadStartupData>); |
| 132 void initialize(PassOwnPtr<WorkerThreadStartupData>); | 133 void prepareForShutdownOnWorkerThread(); |
| 133 void performTask(std::unique_ptr<ExecutionContextTask>, bool isInstrumented)
; | 134 void performShutdownOnWorkerThread(); |
| 134 void prepareForShutdown(); | 135 void performTaskOnWorkerThread(std::unique_ptr<ExecutionContextTask>, bool i
sInstrumented); |
| 135 void performShutdown(); | 136 void runDebuggerTaskOnWorkerThread(std::unique_ptr<CrossThreadClosure>); |
| 136 void runDebuggerTask(std::unique_ptr<CrossThreadClosure>); | 137 void runDebuggerTaskDontWaitOnWorkerThread(); |
| 137 void runDebuggerTaskDontWait(); | |
| 138 | 138 |
| 139 bool m_started = false; | 139 bool m_started = false; |
| 140 bool m_terminated = false; | 140 bool m_terminated = false; |
| 141 bool m_readyToShutdown = false; | 141 bool m_readyToShutdown = false; |
| 142 bool m_pausedInDebugger = false; | 142 bool m_pausedInDebugger = false; |
| 143 bool m_runningDebuggerTask = false; | 143 bool m_runningDebuggerTask = false; |
| 144 bool m_shouldTerminateV8Execution = false; | 144 bool m_shouldTerminateV8Execution = false; |
| 145 | 145 |
| 146 OwnPtr<InspectorTaskRunner> m_inspectorTaskRunner; | 146 OwnPtr<InspectorTaskRunner> m_inspectorTaskRunner; |
| 147 OwnPtr<WorkerMicrotaskRunner> m_microtaskRunner; | 147 OwnPtr<WorkerMicrotaskRunner> m_microtaskRunner; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 159 // Signaled when the thread starts termination on the main thread. | 159 // Signaled when the thread starts termination on the main thread. |
| 160 OwnPtr<WaitableEvent> m_terminationEvent; | 160 OwnPtr<WaitableEvent> m_terminationEvent; |
| 161 | 161 |
| 162 // Signaled when the thread completes termination on the worker thread. | 162 // Signaled when the thread completes termination on the worker thread. |
| 163 OwnPtr<WaitableEvent> m_shutdownEvent; | 163 OwnPtr<WaitableEvent> m_shutdownEvent; |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 } // namespace blink | 166 } // namespace blink |
| 167 | 167 |
| 168 #endif // WorkerThread_h | 168 #endif // WorkerThread_h |
| OLD | NEW |