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

Side by Side Diff: extensions/renderer/worker_thread_dispatcher.h

Issue 2512233002: [Extensions Bindings] Add ExtensionBindingsSystem interface; hook it up (Closed)
Patch Set: lazyboys Created 4 years 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 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_RENDERER_WORKER_THREAD_DISPATCHER_H_ 5 #ifndef EXTENSIONS_RENDERER_WORKER_THREAD_DISPATCHER_H_
6 #define EXTENSIONS_RENDERER_WORKER_THREAD_DISPATCHER_H_ 6 #define EXTENSIONS_RENDERER_WORKER_THREAD_DISPATCHER_H_
7 7
8 #include "base/synchronization/lock.h" 8 #include "base/synchronization/lock.h"
9 #include "content/public/renderer/render_thread_observer.h" 9 #include "content/public/renderer/render_thread_observer.h"
10 #include "ipc/ipc_sync_message_filter.h" 10 #include "ipc/ipc_sync_message_filter.h"
11 11
12 namespace base { 12 namespace base {
13 class ListValue; 13 class ListValue;
14 } 14 }
15 15
16 namespace content { 16 namespace content {
17 class RenderThread; 17 class RenderThread;
18 } 18 }
19 19
20 namespace extensions { 20 namespace extensions {
21 class ExtensionBindingsSystem;
22 class ResourceBundleSourceMap;
21 class RequestSender; 23 class RequestSender;
22 class ServiceWorkerRequestSender; 24 class ServiceWorkerRequestSender;
23 class V8SchemaRegistry; 25 class V8SchemaRegistry;
24 26
25 // Sends and receives IPC in an extension Service Worker. 27 // Sends and receives IPC in an extension Service Worker.
26 // TODO(lazyboy): This class should really be a combination of the following 28 // TODO(lazyboy): This class should really be a combination of the following
27 // two: 29 // two:
28 // 1) A content::WorkerThreadMessageFilter, so that we can receive IPC directly 30 // 1) A content::WorkerThreadMessageFilter, so that we can receive IPC directly
29 // on worker thread. 31 // on worker thread.
30 // 2) A content::ThreadSafeSender, so we can safely send IPC from worker thread. 32 // 2) A content::ThreadSafeSender, so we can safely send IPC from worker thread.
31 class WorkerThreadDispatcher : public content::RenderThreadObserver { 33 class WorkerThreadDispatcher : public content::RenderThreadObserver {
32 public: 34 public:
33 WorkerThreadDispatcher(); 35 WorkerThreadDispatcher();
34 ~WorkerThreadDispatcher() override; 36 ~WorkerThreadDispatcher() override;
35 37
36 // Thread safe. 38 // Thread safe.
37 static WorkerThreadDispatcher* Get(); 39 static WorkerThreadDispatcher* Get();
40 static ExtensionBindingsSystem* GetBindingsSystem();
38 static ServiceWorkerRequestSender* GetRequestSender(); 41 static ServiceWorkerRequestSender* GetRequestSender();
42 static V8SchemaRegistry* GetV8SchemaRegistry();
39 43
40 void Init(content::RenderThread* render_thread); 44 void Init(content::RenderThread* render_thread);
41 bool Send(IPC::Message* message); 45 bool Send(IPC::Message* message);
42 void AddWorkerData(int64_t service_worker_version_id); 46 void AddWorkerData(int64_t service_worker_version_id,
47 ResourceBundleSourceMap* source_map);
43 void RemoveWorkerData(int64_t service_worker_version_id); 48 void RemoveWorkerData(int64_t service_worker_version_id);
44 V8SchemaRegistry* GetV8SchemaRegistry();
45 49
46 private: 50 private:
47 // content::RenderThreadObserver: 51 // content::RenderThreadObserver:
48 bool OnControlMessageReceived(const IPC::Message& message) override; 52 bool OnControlMessageReceived(const IPC::Message& message) override;
49 53
50 // IPC handlers. 54 // IPC handlers.
51 void OnResponseWorker(int worker_thread_id, 55 void OnResponseWorker(int worker_thread_id,
52 int request_id, 56 int request_id,
53 bool succeeded, 57 bool succeeded,
54 const base::ListValue& response, 58 const base::ListValue& response,
55 const std::string& error); 59 const std::string& error);
56 60
57 // IPC sender. Belongs to the render thread, but thread safe. 61 // IPC sender. Belongs to the render thread, but thread safe.
58 scoped_refptr<IPC::SyncMessageFilter> message_filter_; 62 scoped_refptr<IPC::SyncMessageFilter> message_filter_;
59 63
60 DISALLOW_COPY_AND_ASSIGN(WorkerThreadDispatcher); 64 DISALLOW_COPY_AND_ASSIGN(WorkerThreadDispatcher);
61 }; 65 };
62 66
63 } // namespace extensions 67 } // namespace extensions
64 68
65 #endif // EXTENSIONS_RENDERER_WORKER_THREAD_DISPATCHER_H_ 69 #endif // EXTENSIONS_RENDERER_WORKER_THREAD_DISPATCHER_H_
OLDNEW
« no previous file with comments | « extensions/renderer/service_worker_data.cc ('k') | extensions/renderer/worker_thread_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698