Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Side by Side Diff: Source/core/workers/WorkerThread.h

Issue 1111693003: Remove the concept of a cleanup task (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Don't run tasks if thread was never initialized. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/workers/WorkerGlobalScope.cpp ('k') | Source/core/workers/WorkerThread.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 28 matching lines...) Expand all
39 #include "wtf/OwnPtr.h" 39 #include "wtf/OwnPtr.h"
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 WorkerMicrotaskRunner;
49 class WorkerReportingProxy; 50 class WorkerReportingProxy;
50 class WorkerSharedTimer; 51 class WorkerSharedTimer;
51 class WorkerThreadShutdownFinishTask;
52 class WorkerThreadStartupData; 52 class WorkerThreadStartupData;
53 class WorkerThreadTask; 53 class WorkerThreadTask;
54 54
55 enum WorkerThreadStartMode { 55 enum WorkerThreadStartMode {
56 DontPauseWorkerGlobalScopeOnStart, 56 DontPauseWorkerGlobalScopeOnStart,
57 PauseWorkerGlobalScopeOnStart 57 PauseWorkerGlobalScopeOnStart
58 }; 58 };
59 59
60 // TODO(sadrul): Rename to WorkerScript. 60 // TODO(sadrul): Rename to WorkerScript.
61 class CORE_EXPORT WorkerThread : public RefCounted<WorkerThread> { 61 class CORE_EXPORT WorkerThread : public RefCounted<WorkerThread> {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 virtual void postInitialize() { } 124 virtual void postInitialize() { }
125 125
126 virtual v8::Isolate* initializeIsolate(); 126 virtual v8::Isolate* initializeIsolate();
127 virtual void willDestroyIsolate(); 127 virtual void willDestroyIsolate();
128 virtual void destroyIsolate(); 128 virtual void destroyIsolate();
129 virtual void terminateV8Execution(); 129 virtual void terminateV8Execution();
130 130
131 private: 131 private:
132 friend class WorkerSharedTimer; 132 friend class WorkerSharedTimer;
133 friend class WorkerThreadShutdownFinishTask; 133 friend class WorkerMicrotaskRunner;
134 134
135 void stopInShutdownSequence(); 135 void stopInShutdownSequence();
136 void stopInternal(); 136 void stopInternal();
137 137
138 void initialize(); 138 void initialize();
139 void cleanup(); 139 void shutdown();
140 void idleHandler(); 140 void idleHandler();
141 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs); 141 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs);
142 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas k>, long long delayMs); 142 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas k>, long long delayMs);
143 143
144 bool m_started; 144 bool m_started;
145 bool m_terminated; 145 bool m_terminated;
146 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue; 146 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue;
147 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; 147 OwnPtr<WebThread::TaskObserver> m_microtaskRunner;
148 148
149 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; 149 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy;
150 WorkerReportingProxy& m_workerReportingProxy; 150 WorkerReportingProxy& m_workerReportingProxy;
151 151
152 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle r; 152 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle r;
153 Mutex m_workerInspectorControllerMutex; 153 Mutex m_workerInspectorControllerMutex;
154 154
155 Mutex m_threadCreationMutex; 155 // This lock protects |m_workerGlobalScope|, |m_terminated|, |m_isolate| and |m_microtaskRunner|.
156 Mutex m_threadStateMutex;
157
156 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; 158 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope;
157 OwnPtr<WorkerThreadStartupData> m_startupData; 159 OwnPtr<WorkerThreadStartupData> m_startupData;
158 160
159 v8::Isolate* m_isolate; 161 v8::Isolate* m_isolate;
160 OwnPtr<V8IsolateInterruptor> m_interruptor; 162 OwnPtr<V8IsolateInterruptor> m_interruptor;
161 163
162 // Used to signal thread shutdown. 164 // Used to signal thread shutdown.
163 OwnPtr<WebWaitableEvent> m_shutdownEvent; 165 OwnPtr<WebWaitableEvent> m_shutdownEvent;
164 166
165 // Used to signal thread termination. 167 // Used to signal thread termination.
166 OwnPtr<WebWaitableEvent> m_terminationEvent; 168 OwnPtr<WebWaitableEvent> m_terminationEvent;
167 }; 169 };
168 170
169 } // namespace blink 171 } // namespace blink
170 172
171 #endif // WorkerThread_h 173 #endif // WorkerThread_h
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerGlobalScope.cpp ('k') | Source/core/workers/WorkerThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698