OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ |
6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ | 6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "content/browser/shared_worker/shared_worker_message_filter.h" | 12 #include "content/browser/shared_worker/shared_worker_message_filter.h" |
13 | 13 |
14 class GURL; | 14 class GURL; |
15 | 15 |
16 namespace IPC { | 16 namespace IPC { |
17 class Message; | 17 class Message; |
18 } | 18 } |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class SharedWorkerMessageFilter; | 21 class SharedWorkerMessageFilter; |
22 class SharedWorkerInstance; | 22 class SharedWorkerInstance; |
| 23 class WorkerDevToolsMessageHandler; |
23 | 24 |
24 // The SharedWorkerHost is the interface that represents the browser side of | 25 // The SharedWorkerHost is the interface that represents the browser side of |
25 // the browser <-> worker communication channel. | 26 // the browser <-> worker communication channel. |
26 class SharedWorkerHost { | 27 class SharedWorkerHost { |
27 public: | 28 public: |
28 explicit SharedWorkerHost(SharedWorkerInstance* instance); | 29 explicit SharedWorkerHost(SharedWorkerInstance* instance); |
29 ~SharedWorkerHost(); | 30 ~SharedWorkerHost(); |
30 | 31 |
31 // Sends |message| to the SharedWorker. | 32 // Sends |message| to the SharedWorker. |
32 bool Send(IPC::Message* message); | 33 bool Send(IPC::Message* message); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 const base::string16& name, | 65 const base::string16& name, |
65 bool* result); | 66 bool* result); |
66 | 67 |
67 // Terminates the given worker, i.e. based on a UI action. | 68 // Terminates the given worker, i.e. based on a UI action. |
68 void TerminateWorker(); | 69 void TerminateWorker(); |
69 | 70 |
70 SharedWorkerInstance* instance() { return instance_.get(); } | 71 SharedWorkerInstance* instance() { return instance_.get(); } |
71 SharedWorkerMessageFilter* container_render_filter() const { | 72 SharedWorkerMessageFilter* container_render_filter() const { |
72 return container_render_filter_; | 73 return container_render_filter_; |
73 } | 74 } |
74 int process_id() const { | 75 int process_id() const { return worker_process_id_; } |
75 return container_render_filter_->render_process_id(); | |
76 } | |
77 int worker_route_id() const { return worker_route_id_; } | 76 int worker_route_id() const { return worker_route_id_; } |
78 | 77 |
79 private: | 78 private: |
80 // Relays |message| to the SharedWorker. Takes care of parsing the message if | 79 // Relays |message| to the SharedWorker. Takes care of parsing the message if |
81 // it contains a message port and sending it a valid route id. | 80 // it contains a message port and sending it a valid route id. |
82 void RelayMessage(const IPC::Message& message, | 81 void RelayMessage(const IPC::Message& message, |
83 SharedWorkerMessageFilter* incoming_filter); | 82 SharedWorkerMessageFilter* incoming_filter); |
84 | 83 |
85 // Return a vector of all the render process/render frame IDs. | 84 // Return a vector of all the render process/render frame IDs. |
86 std::vector<std::pair<int, int> > GetRenderFrameIDsForWorker(); | 85 std::vector<std::pair<int, int> > GetRenderFrameIDsForWorker(); |
87 | 86 |
88 scoped_ptr<SharedWorkerInstance> instance_; | 87 scoped_ptr<SharedWorkerInstance> instance_; |
| 88 scoped_refptr<WorkerDevToolsMessageHandler> dev_tools_handler_; |
89 SharedWorkerMessageFilter* container_render_filter_; | 89 SharedWorkerMessageFilter* container_render_filter_; |
| 90 int worker_process_id_; |
90 int worker_route_id_; | 91 int worker_route_id_; |
91 DISALLOW_COPY_AND_ASSIGN(SharedWorkerHost); | 92 DISALLOW_COPY_AND_ASSIGN(SharedWorkerHost); |
92 }; | 93 }; |
93 } // namespace content | 94 } // namespace content |
94 | 95 |
95 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ | 96 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ |
OLD | NEW |