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

Side by Side Diff: content/browser/shared_worker/shared_worker_host.h

Issue 223123003: Make DevTools support for the embedded SharedWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed version Created 6 years, 8 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 // 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 <list> 8 #include <list>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 10 matching lines...) Expand all
21 } 21 }
22 22
23 namespace content { 23 namespace content {
24 class SharedWorkerMessageFilter; 24 class SharedWorkerMessageFilter;
25 class SharedWorkerInstance; 25 class SharedWorkerInstance;
26 26
27 // The SharedWorkerHost is the interface that represents the browser side of 27 // The SharedWorkerHost is the interface that represents the browser side of
28 // the browser <-> worker communication channel. 28 // the browser <-> worker communication channel.
29 class SharedWorkerHost { 29 class SharedWorkerHost {
30 public: 30 public:
31 explicit SharedWorkerHost(SharedWorkerInstance* instance); 31 SharedWorkerHost(SharedWorkerInstance* instance,
32 SharedWorkerMessageFilter* filter);
32 ~SharedWorkerHost(); 33 ~SharedWorkerHost();
33 34
34 // Sends |message| to the SharedWorker. 35 // Sends |message| to the SharedWorker.
35 bool Send(IPC::Message* message); 36 bool Send(IPC::Message* message);
36 37
37 // Starts the SharedWorker in the renderer process which is associated with 38 // Starts the SharedWorker in the renderer process which is associated with
38 // |filter|. 39 // |filter_|.
39 void Init(SharedWorkerMessageFilter* filter); 40 void Start(bool pause_on_start);
40 41
41 // Returns true iff the given message from a renderer process was forwarded to 42 // Returns true iff the given message from a renderer process was forwarded to
42 // the worker. 43 // the worker.
43 bool FilterMessage(const IPC::Message& message, 44 bool FilterMessage(const IPC::Message& message,
44 SharedWorkerMessageFilter* filter); 45 SharedWorkerMessageFilter* filter);
45 46
46 // Handles the shutdown of the filter. If the worker has no other client, 47 // Handles the shutdown of the filter. If the worker has no other client,
47 // sends TerminateWorkerContext message to shut it down. 48 // sends TerminateWorkerContext message to shut it down.
48 void FilterShutdown(SharedWorkerMessageFilter* filter); 49 void FilterShutdown(SharedWorkerMessageFilter* filter);
49 50
(...skipping 22 matching lines...) Expand all
72 73
73 void AddFilter(SharedWorkerMessageFilter* filter, int route_id); 74 void AddFilter(SharedWorkerMessageFilter* filter, int route_id);
74 75
75 SharedWorkerInstance* instance() { return instance_.get(); } 76 SharedWorkerInstance* instance() { return instance_.get(); }
76 WorkerDocumentSet* worker_document_set() const { 77 WorkerDocumentSet* worker_document_set() const {
77 return worker_document_set_.get(); 78 return worker_document_set_.get();
78 } 79 }
79 SharedWorkerMessageFilter* container_render_filter() const { 80 SharedWorkerMessageFilter* container_render_filter() const {
80 return container_render_filter_; 81 return container_render_filter_;
81 } 82 }
82 int process_id() const { 83 int process_id() const { return worker_process_id_; }
83 return container_render_filter_->render_process_id();
84 }
85 int worker_route_id() const { return worker_route_id_; } 84 int worker_route_id() const { return worker_route_id_; }
86 bool load_failed() const { return load_failed_; } 85 bool load_failed() const { return load_failed_; }
87 bool closed() const { return closed_; } 86 bool closed() const { return closed_; }
88 87
89 private: 88 private:
90 // Unique identifier for a worker client. 89 // Unique identifier for a worker client.
91 class FilterInfo { 90 class FilterInfo {
92 public: 91 public:
93 FilterInfo(SharedWorkerMessageFilter* filter, int route_id) 92 FilterInfo(SharedWorkerMessageFilter* filter, int route_id)
94 : filter_(filter), route_id_(route_id), message_port_id_(0) {} 93 : filter_(filter), route_id_(route_id), message_port_id_(0) {}
(...skipping 21 matching lines...) Expand all
116 void RemoveFilters(SharedWorkerMessageFilter* filter); 115 void RemoveFilters(SharedWorkerMessageFilter* filter);
117 bool HasFilter(SharedWorkerMessageFilter* filter, int route_id) const; 116 bool HasFilter(SharedWorkerMessageFilter* filter, int route_id) const;
118 void SetMessagePortID(SharedWorkerMessageFilter* filter, 117 void SetMessagePortID(SharedWorkerMessageFilter* filter,
119 int route_id, 118 int route_id,
120 int message_port_id); 119 int message_port_id);
121 120
122 scoped_ptr<SharedWorkerInstance> instance_; 121 scoped_ptr<SharedWorkerInstance> instance_;
123 scoped_refptr<WorkerDocumentSet> worker_document_set_; 122 scoped_refptr<WorkerDocumentSet> worker_document_set_;
124 FilterList filters_; 123 FilterList filters_;
125 SharedWorkerMessageFilter* container_render_filter_; 124 SharedWorkerMessageFilter* container_render_filter_;
125 int worker_process_id_;
126 int worker_route_id_; 126 int worker_route_id_;
127 bool load_failed_; 127 bool load_failed_;
128 bool closed_; 128 bool closed_;
129 const base::TimeTicks creation_time_; 129 const base::TimeTicks creation_time_;
130 DISALLOW_COPY_AND_ASSIGN(SharedWorkerHost); 130 DISALLOW_COPY_AND_ASSIGN(SharedWorkerHost);
131 }; 131 };
132 } // namespace content 132 } // namespace content
133 133
134 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ 134 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/devtools/worker_devtools_manager.cc ('k') | content/browser/shared_worker/shared_worker_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698