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

Side by Side Diff: third_party/WebKit/Source/modules/worklet/WorkletThread.h

Issue 1992933002: Introduce WorkletGlobalScopeProxy interface. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests. Created 4 years, 6 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WorkletThread_h
6 #define WorkletThread_h
7
8 #include "core/dom/ExecutionContextTask.h"
9 #include "platform/heap/Handle.h"
10 #include "platform/weborigin/KURL.h"
11 #include "wtf/Forward.h"
12 #include "wtf/Functional.h"
13 #include "wtf/ThreadingPrimitives.h"
14 #include "wtf/text/WTFString.h"
15 #include <v8.h>
16
17 namespace blink {
18
19 class SecurityOrigin;
20 class WebTraceLocation;
21 class WorkerBackingThread;
22 class WorkletGlobalScope;
23 class WorkletThreadStartupData;
24
25 class WorkletThread {
26 public:
27 virtual ~WorkletThread();
28
29 // Called on the main thread.
30 void initialize(PassOwnPtr<WorkletThreadStartupData>);
31 void terminate();
32
33 virtual WorkerBackingThread& workerBackingThread() = 0;
34 v8::Isolate* isolate();
35
36 bool isCurrentThread();
37
38 void postTask(const WebTraceLocation&, std::unique_ptr<ExecutionContextTask> );
39
40 // Can be called only on the worklet thread, WorkletGlobalScope is not threa d
41 // safe.
42 WorkletGlobalScope* workletGlobalScope();
43
44 protected:
45 WorkletThread();/*WorkletReportingProxy&*/
46
47 // Factory method for creating a new worklet context for the thread.
48 // Called on the worklet thread.
49 virtual WorkletGlobalScope* createWorkletGlobalScope(const KURL&, const Stri ng& userAgent, PassRefPtr<SecurityOrigin>) = 0;
50
51 private:
52 // Called on the worklet thread.
53 void initializeInternal(PassOwnPtr<WorkletThreadStartupData>);
54 void terminateInternal();
55
56 std::unique_ptr<CrossThreadClosure> createWorkletThreadTask(std::unique_ptr< ExecutionContextTask>, bool isInstrumented);
57 void performTask(std::unique_ptr<ExecutionContextTask>, bool isInstrumented) ;
58
59 bool m_terminated;
60 bool m_shutdown;
61
62 // TODO figure out reporting proxy.
63 // WorkerReportingProxy& m_workerReportingProxy;
64
65 Mutex m_threadStateMutex;
66
67 Persistent<WorkletGlobalScope> m_workletGlobalScope;
68 };
69
70 } // namespace blink
71
72 #endif // WorkletThread_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698