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

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

Issue 474683003: Not for review - Rebase of crrev.com/62833003 Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 6 years, 1 month 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/WorkerObjectProxy.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 24 matching lines...) Expand all
35 #include "platform/weborigin/SecurityOrigin.h" 35 #include "platform/weborigin/SecurityOrigin.h"
36 #include "wtf/Forward.h" 36 #include "wtf/Forward.h"
37 #include "wtf/MessageQueue.h" 37 #include "wtf/MessageQueue.h"
38 #include "wtf/OwnPtr.h" 38 #include "wtf/OwnPtr.h"
39 #include "wtf/PassRefPtr.h" 39 #include "wtf/PassRefPtr.h"
40 #include "wtf/RefCounted.h" 40 #include "wtf/RefCounted.h"
41 41
42 namespace blink { 42 namespace blink {
43 43
44 class KURL; 44 class KURL;
45 class WebTeleporter;
45 class WebWaitableEvent; 46 class WebWaitableEvent;
46 class WorkerGlobalScope; 47 class WorkerGlobalScope;
47 class WorkerInspectorController; 48 class WorkerInspectorController;
48 class WorkerLoaderProxy; 49 class WorkerLoaderProxy;
49 class WorkerReportingProxy; 50 class WorkerReportingProxy;
50 class WorkerSharedTimer; 51 class WorkerSharedTimer;
51 class WorkerThreadShutdownFinishTask; 52 class WorkerThreadShutdownFinishTask;
52 class WorkerThreadStartupData; 53 class WorkerThreadStartupData;
53 class WorkerThreadTask; 54 class WorkerThreadTask;
54 55
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 bool terminated(); 91 bool terminated();
91 92
92 // Number of active worker threads. 93 // Number of active worker threads.
93 static unsigned workerThreadCount(); 94 static unsigned workerThreadCount();
94 95
95 PlatformThreadId platformThreadId() const; 96 PlatformThreadId platformThreadId() const;
96 97
97 void interruptAndDispatchInspectorCommands(); 98 void interruptAndDispatchInspectorCommands();
98 void setWorkerInspectorController(WorkerInspectorController*); 99 void setWorkerInspectorController(WorkerInspectorController*);
99 100
101 void setTeleporter(WebTeleporter*);
102 WebTeleporter* teleporter() const { return m_teleporter; }
103
104 int id() const { return m_compositorId; }
105
100 protected: 106 protected:
101 WorkerThread(WorkerLoaderProxy&, WorkerReportingProxy&, PassOwnPtrWillBeRawP tr<WorkerThreadStartupData>); 107 WorkerThread(WorkerLoaderProxy&, WorkerReportingProxy&, PassOwnPtrWillBeRawP tr<WorkerThreadStartupData>);
102 108
103 // Factory method for creating a new worker context for the thread. 109 // Factory method for creating a new worker context for the thread.
104 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa ssOwnPtrWillBeRawPtr<WorkerThreadStartupData>) = 0; 110 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa ssOwnPtrWillBeRawPtr<WorkerThreadStartupData>) = 0;
105 111
106 virtual void postInitialize() { } 112 virtual void postInitialize() { }
107 113
114 virtual blink::WebWorkerRunLoop getRunLoop();
115
108 private: 116 private:
109 friend class WorkerSharedTimer; 117 friend class WorkerSharedTimer;
110 friend class WorkerThreadShutdownFinishTask; 118 friend class WorkerThreadShutdownFinishTask;
111 119
112 void stopInShutdownSequence(); 120 void stopInShutdownSequence();
113 void stopInternal(); 121 void stopInternal();
114 122
115 void initialize(); 123 void initialize();
116 void cleanup(); 124 void cleanup();
117 void idleHandler(); 125 void idleHandler();
118 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs); 126 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs);
119 127
128 virtual void initializeWebThread();
129 virtual blink::WebThreadSupportingGC* thread() const;
130
131
120 bool m_terminated; 132 bool m_terminated;
121 OwnPtr<WorkerSharedTimer> m_sharedTimer; 133 OwnPtr<WorkerSharedTimer> m_sharedTimer;
122 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue; 134 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue;
123 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; 135 OwnPtr<WebThread::TaskObserver> m_microtaskRunner;
124 136
125 WorkerLoaderProxy& m_workerLoaderProxy; 137 WorkerLoaderProxy& m_workerLoaderProxy;
126 WorkerReportingProxy& m_workerReportingProxy; 138 WorkerReportingProxy& m_workerReportingProxy;
127 139
128 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle r; 140 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle r;
129 Mutex m_workerInspectorControllerMutex; 141 Mutex m_workerInspectorControllerMutex;
130 142
131 Mutex m_threadCreationMutex; 143 Mutex m_threadCreationMutex;
132 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; 144 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope;
133 OwnPtrWillBePersistent<WorkerThreadStartupData> m_startupData; 145 OwnPtrWillBePersistent<WorkerThreadStartupData> m_startupData;
134 146
135 // Used to signal thread shutdown. 147 // Used to signal thread shutdown.
136 OwnPtr<WebWaitableEvent> m_shutdownEvent; 148 OwnPtr<WebWaitableEvent> m_shutdownEvent;
137 149
138 // Used to signal thread termination. 150 // Used to signal thread termination.
139 OwnPtr<WebWaitableEvent> m_terminationEvent; 151 OwnPtr<WebWaitableEvent> m_terminationEvent;
140 152
153 // FIXME: Confirm that there are no thread safety issues here.
154 WebTeleporter* m_teleporter;
155 int m_compositorId;
156
141 // FIXME: This has to be last because of crbug.com/401397 - the 157 // FIXME: This has to be last because of crbug.com/401397 - the
142 // WorkerThread might get deleted before it had a chance to properly 158 // WorkerThread might get deleted before it had a chance to properly
143 // shut down. By deleting the WebThread first, we can guarantee that 159 // shut down. By deleting the WebThread first, we can guarantee that
144 // no pending tasks on the thread might want to access any of the other 160 // no pending tasks on the thread might want to access any of the other
145 // members during the WorkerThread's destruction. 161 // members during the WorkerThread's destruction.
146 OwnPtr<WebThreadSupportingGC> m_thread; 162 OwnPtr<WebThreadSupportingGC> m_thread;
147 }; 163 };
148 164
149 } // namespace blink 165 } // namespace blink
150 166
151 #endif // WorkerThread_h 167 #endif // WorkerThread_h
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerObjectProxy.cpp ('k') | Source/core/workers/WorkerThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698