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

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

Issue 2718643002: Worker: Pass ParentFrameTaskRunners via WorkerThread::start() instead of the ctor (Closed)
Patch Set: Created 3 years, 10 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
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 NotTerminated, 99 NotTerminated,
100 GracefullyTerminated, 100 GracefullyTerminated,
101 SyncForciblyTerminated, 101 SyncForciblyTerminated,
102 AsyncForciblyTerminated, 102 AsyncForciblyTerminated,
103 LastEnum, 103 LastEnum,
104 }; 104 };
105 105
106 virtual ~WorkerThread(); 106 virtual ~WorkerThread();
107 107
108 // Called on the main thread. 108 // Called on the main thread.
109 void start(std::unique_ptr<WorkerThreadStartupData>); 109 void start(std::unique_ptr<WorkerThreadStartupData>, ParentFrameTaskRunners*);
110 void terminate(); 110 void terminate();
111 111
112 // Called on the main thread. Internally calls terminateInternal() and wait 112 // Called on the main thread. Internally calls terminateInternal() and wait
113 // (by *blocking* the calling thread) until the worker(s) is/are shut down. 113 // (by *blocking* the calling thread) until the worker(s) is/are shut down.
114 void terminateAndWait(); 114 void terminateAndWait();
115 static void terminateAndWaitForAllWorkers(); 115 static void terminateAndWaitForAllWorkers();
116 116
117 // WebThread::TaskObserver. 117 // WebThread::TaskObserver.
118 void willProcessTask() override; 118 void willProcessTask() override;
119 void didProcessTask() override; 119 void didProcessTask() override;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 bool isForciblyTerminated(); 169 bool isForciblyTerminated();
170 170
171 void waitForShutdownForTesting() { m_shutdownEvent->wait(); } 171 void waitForShutdownForTesting() { m_shutdownEvent->wait(); }
172 172
173 ParentFrameTaskRunners* getParentFrameTaskRunners() const { 173 ParentFrameTaskRunners* getParentFrameTaskRunners() const {
174 return m_parentFrameTaskRunners.get(); 174 return m_parentFrameTaskRunners.get();
175 } 175 }
176 176
177 protected: 177 protected:
178 WorkerThread(PassRefPtr<WorkerLoaderProxy>, 178 WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&);
179 WorkerReportingProxy&,
180 ParentFrameTaskRunners*);
181 179
182 // Factory method for creating a new worker context for the thread. 180 // Factory method for creating a new worker context for the thread.
183 // Called on the worker thread. 181 // Called on the worker thread.
184 virtual WorkerOrWorkletGlobalScope* createWorkerGlobalScope( 182 virtual WorkerOrWorkletGlobalScope* createWorkerGlobalScope(
185 std::unique_ptr<WorkerThreadStartupData>) = 0; 183 std::unique_ptr<WorkerThreadStartupData>) = 0;
186 184
187 // Returns true when this WorkerThread owns the associated 185 // Returns true when this WorkerThread owns the associated
188 // WorkerBackingThread exclusively. If this function returns true, the 186 // WorkerBackingThread exclusively. If this function returns true, the
189 // WorkerThread initializes / shutdowns the backing thread. Otherwise 187 // WorkerThread initializes / shutdowns the backing thread. Otherwise
190 // workerBackingThread() should be initialized / shutdown properly 188 // workerBackingThread() should be initialized / shutdown properly
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 309
312 // Created on the main thread heap, but will be accessed cross-thread 310 // Created on the main thread heap, but will be accessed cross-thread
313 // when worker thread posts tasks. 311 // when worker thread posts tasks.
314 CrossThreadPersistent<WorkerThreadLifecycleContext> 312 CrossThreadPersistent<WorkerThreadLifecycleContext>
315 m_workerThreadLifecycleContext; 313 m_workerThreadLifecycleContext;
316 }; 314 };
317 315
318 } // namespace blink 316 } // namespace blink
319 317
320 #endif // WorkerThread_h 318 #endif // WorkerThread_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698