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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // Factory method for creating a new worker context for the thread. | 114 // Factory method for creating a new worker context for the thread. |
116 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa
ssOwnPtr<WorkerThreadStartupData>) = 0; | 115 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa
ssOwnPtr<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 |
| 124 // This is protected virtual for testing. |
| 125 virtual bool doIdleGc(double deadlineSeconds); |
| 126 |
| 127 WebThreadSupportingGC* threadForTesting() const |
| 128 { |
| 129 return m_thread.get(); |
| 130 } |
| 131 |
125 private: | 132 private: |
126 friend class WorkerSharedTimer; | 133 friend class WorkerThreadIdleTask; |
127 friend class WorkerThreadShutdownFinishTask; | 134 friend class WorkerThreadShutdownFinishTask; |
128 | 135 |
129 void stopInShutdownSequence(); | 136 void stopInShutdownSequence(); |
130 void stopInternal(); | 137 void stopInternal(); |
131 | 138 |
132 void initialize(); | 139 void initialize(); |
133 void cleanup(); | 140 void cleanup(); |
134 void idleHandler(); | 141 void idleTask(double deadlineSeconds); |
135 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs); | 142 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs); |
136 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas
k>, long long delayMs); | 143 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas
k>, long long delayMs); |
137 | 144 |
138 bool m_terminated; | 145 bool m_terminated; |
139 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue; | 146 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue; |
140 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; | 147 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; |
141 | 148 |
142 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; | 149 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; |
143 WorkerReportingProxy& m_workerReportingProxy; | 150 WorkerReportingProxy& m_workerReportingProxy; |
144 | 151 |
(...skipping 17 matching lines...) Expand all Loading... |
162 // WorkerThread might get deleted before it had a chance to properly | 169 // WorkerThread might get deleted before it had a chance to properly |
163 // shut down. By deleting the WebThread first, we can guarantee that | 170 // 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 | 171 // no pending tasks on the thread might want to access any of the other |
165 // members during the WorkerThread's destruction. | 172 // members during the WorkerThread's destruction. |
166 OwnPtr<WebThreadSupportingGC> m_thread; | 173 OwnPtr<WebThreadSupportingGC> m_thread; |
167 }; | 174 }; |
168 | 175 |
169 } // namespace blink | 176 } // namespace blink |
170 | 177 |
171 #endif // WorkerThread_h | 178 #endif // WorkerThread_h |
OLD | NEW |