Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 40 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
| 41 #include "wtf/RefCounted.h" | 41 #include "wtf/RefCounted.h" |
| 42 #include <v8.h> | 42 #include <v8.h> |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 class WebWaitableEvent; | 46 class WebWaitableEvent; |
| 47 class WorkerGlobalScope; | 47 class WorkerGlobalScope; |
| 48 class WorkerInspectorController; | 48 class WorkerInspectorController; |
| 49 class WorkerReportingProxy; | 49 class WorkerReportingProxy; |
| 50 class WorkerSharedTimer; | |
| 51 class WorkerThreadShutdownFinishTask; | 50 class WorkerThreadShutdownFinishTask; |
| 52 class WorkerThreadStartupData; | 51 class WorkerThreadStartupData; |
| 53 class WorkerThreadTask; | 52 class WorkerThreadTask; |
| 54 | 53 |
| 55 enum WorkerThreadStartMode { | 54 enum WorkerThreadStartMode { |
| 56 DontPauseWorkerGlobalScopeOnStart, | 55 DontPauseWorkerGlobalScopeOnStart, |
| 57 PauseWorkerGlobalScopeOnStart | 56 PauseWorkerGlobalScopeOnStart |
| 58 }; | 57 }; |
| 59 | 58 |
| 60 class CORE_EXPORT WorkerThread : public RefCounted<WorkerThread> { | 59 class CORE_EXPORT WorkerThread : public RefCounted<WorkerThread> { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa ssOwnPtrWillBeRawPtr<WorkerThreadStartupData>) = 0; | 115 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa ssOwnPtrWillBeRawPtr<WorkerThreadStartupData>) = 0; |
| 117 | 116 |
| 118 virtual void postInitialize() { } | 117 virtual void postInitialize() { } |
| 119 | 118 |
| 120 virtual v8::Isolate* initializeIsolate(); | 119 virtual v8::Isolate* initializeIsolate(); |
| 121 virtual void willDestroyIsolate(); | 120 virtual void willDestroyIsolate(); |
| 122 virtual void destroyIsolate(); | 121 virtual void destroyIsolate(); |
| 123 virtual void terminateV8Execution(); | 122 virtual void terminateV8Execution(); |
| 124 | 123 |
| 125 private: | 124 private: |
| 126 friend class WorkerSharedTimer; | 125 friend class WorkerThreadIdleTask; |
| 127 friend class WorkerThreadShutdownFinishTask; | 126 friend class WorkerThreadShutdownFinishTask; |
| 127 friend class WorkerThreadWaitUntilIdleTask; | |
| 128 friend class WorkerThreadWakeupIdleTask; | |
| 128 | 129 |
| 129 void stopInShutdownSequence(); | 130 void stopInShutdownSequence(); |
| 130 void stopInternal(); | 131 void stopInternal(); |
| 131 | 132 |
| 132 void initialize(); | 133 void initialize(); |
| 133 void cleanup(); | 134 void cleanup(); |
| 134 void idleHandler(); | 135 void dontStartIdleTaskYet(); |
|
Sami
2015/04/02 10:59:20
Should these be talking about the idle period inst
| |
| 136 void maybeStartIdleTask(); | |
| 137 void idleTask(double deadlineSeconds); | |
| 135 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs); | 138 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs); |
| 136 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas k>, long long delayMs); | 139 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas k>, long long delayMs); |
| 137 | 140 |
| 138 bool m_terminated; | 141 bool m_terminated; |
| 139 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue; | 142 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue; |
| 140 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; | 143 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; |
| 141 | 144 |
| 142 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; | 145 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; |
| 143 WorkerReportingProxy& m_workerReportingProxy; | 146 WorkerReportingProxy& m_workerReportingProxy; |
| 144 | 147 |
| 145 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle r; | 148 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle r; |
| 146 Mutex m_workerInspectorControllerMutex; | 149 Mutex m_workerInspectorControllerMutex; |
| 147 | 150 |
| 148 Mutex m_threadCreationMutex; | 151 Mutex m_threadCreationMutex; |
| 149 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; | 152 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; |
| 150 OwnPtrWillBePersistent<WorkerThreadStartupData> m_startupData; | 153 OwnPtrWillBePersistent<WorkerThreadStartupData> m_startupData; |
| 151 | 154 |
| 152 v8::Isolate* m_isolate; | 155 v8::Isolate* m_isolate; |
| 153 OwnPtr<V8IsolateInterruptor> m_interruptor; | 156 OwnPtr<V8IsolateInterruptor> m_interruptor; |
| 154 | 157 |
| 155 // Used to signal thread shutdown. | 158 // Used to signal thread shutdown. |
| 156 OwnPtr<WebWaitableEvent> m_shutdownEvent; | 159 OwnPtr<WebWaitableEvent> m_shutdownEvent; |
| 157 | 160 |
| 158 // Used to signal thread termination. | 161 // Used to signal thread termination. |
| 159 OwnPtr<WebWaitableEvent> m_terminationEvent; | 162 OwnPtr<WebWaitableEvent> m_terminationEvent; |
| 160 | 163 |
| 164 bool m_dontStartIdleTaskYet; | |
| 165 | |
| 161 // FIXME: This has to be last because of crbug.com/401397 - the | 166 // FIXME: This has to be last because of crbug.com/401397 - the |
| 162 // WorkerThread might get deleted before it had a chance to properly | 167 // WorkerThread might get deleted before it had a chance to properly |
| 163 // shut down. By deleting the WebThread first, we can guarantee that | 168 // shut down. By deleting the WebThread first, we can guarantee that |
| 164 // no pending tasks on the thread might want to access any of the other | 169 // no pending tasks on the thread might want to access any of the other |
| 165 // members during the WorkerThread's destruction. | 170 // members during the WorkerThread's destruction. |
| 166 OwnPtr<WebThreadSupportingGC> m_thread; | 171 OwnPtr<WebThreadSupportingGC> m_thread; |
| 167 }; | 172 }; |
| 168 | 173 |
| 169 } // namespace blink | 174 } // namespace blink |
| 170 | 175 |
| 171 #endif // WorkerThread_h | 176 #endif // WorkerThread_h |
| OLD | NEW |