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

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

Issue 2601893002: SharedWorker: Remove message forwarding mechanism (Closed)
Patch Set: style fix Created 3 years, 11 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
« no previous file with comments | « no previous file | content/browser/shared_worker/shared_worker_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 27 matching lines...) Expand all
38 38
39 // Sends |message| to the SharedWorker. 39 // Sends |message| to the SharedWorker.
40 bool Send(IPC::Message* message); 40 bool Send(IPC::Message* message);
41 41
42 // Starts the SharedWorker in the renderer process which is associated with 42 // Starts the SharedWorker in the renderer process which is associated with
43 // |filter_|. 43 // |filter_|.
44 void Start(bool pause_on_start); 44 void Start(bool pause_on_start);
45 45
46 // Returns true iff the given message from a renderer process was forwarded to 46 // Returns true iff the given message from a renderer process was forwarded to
47 // the worker. 47 // the worker.
48 bool FilterMessage(const IPC::Message& message, 48 bool FilterConnectionMessage(int route_id,
49 SharedWorkerMessageFilter* filter); 49 int sent_message_port_id,
50 SharedWorkerMessageFilter* incoming_filter);
50 51
51 // Handles the shutdown of the filter. If the worker has no other client, 52 // Handles the shutdown of the filter. If the worker has no other client,
52 // sends TerminateWorkerContext message to shut it down. 53 // sends TerminateWorkerContext message to shut it down.
53 void FilterShutdown(SharedWorkerMessageFilter* filter); 54 void FilterShutdown(SharedWorkerMessageFilter* filter);
54 55
55 // Shuts down any shared workers that are no longer referenced by active 56 // Shuts down any shared workers that are no longer referenced by active
56 // documents. 57 // documents.
57 void DocumentDetached(SharedWorkerMessageFilter* filter, 58 void DocumentDetached(SharedWorkerMessageFilter* filter,
58 unsigned long long document_id); 59 unsigned long long document_id);
59 60
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 void set_message_port_id(int id) { message_port_id_ = id; } 103 void set_message_port_id(int id) { message_port_id_ = id; }
103 104
104 private: 105 private:
105 SharedWorkerMessageFilter* filter_; 106 SharedWorkerMessageFilter* filter_;
106 const int route_id_; 107 const int route_id_;
107 int message_port_id_; 108 int message_port_id_;
108 }; 109 };
109 110
110 using FilterList = std::list<FilterInfo>; 111 using FilterList = std::list<FilterInfo>;
111 112
112 // Relays |message| to the SharedWorker. Takes care of parsing the message if
113 // it contains a message port and sending it a valid route id.
114 void RelayMessage(const IPC::Message& message,
115 SharedWorkerMessageFilter* incoming_filter);
116
117 // Return a vector of all the render process/render frame IDs. 113 // Return a vector of all the render process/render frame IDs.
118 std::vector<std::pair<int, int> > GetRenderFrameIDsForWorker(); 114 std::vector<std::pair<int, int> > GetRenderFrameIDsForWorker();
119 115
120 void RemoveFilters(SharedWorkerMessageFilter* filter); 116 void RemoveFilters(SharedWorkerMessageFilter* filter);
121 bool HasFilter(SharedWorkerMessageFilter* filter, int route_id) const; 117 bool HasFilter(SharedWorkerMessageFilter* filter, int route_id) const;
118 void Connect(int route_id,
119 int sent_message_port_id,
120 SharedWorkerMessageFilter* incoming_filter);
122 void SetMessagePortID(SharedWorkerMessageFilter* filter, 121 void SetMessagePortID(SharedWorkerMessageFilter* filter,
123 int route_id, 122 int route_id,
124 int message_port_id); 123 int message_port_id);
125 void AllowFileSystemResponse(std::unique_ptr<IPC::Message> reply_msg, 124 void AllowFileSystemResponse(std::unique_ptr<IPC::Message> reply_msg,
126 bool allowed); 125 bool allowed);
126
127 std::unique_ptr<SharedWorkerInstance> instance_; 127 std::unique_ptr<SharedWorkerInstance> instance_;
128 scoped_refptr<WorkerDocumentSet> worker_document_set_; 128 scoped_refptr<WorkerDocumentSet> worker_document_set_;
129 FilterList filters_; 129 FilterList filters_;
130 SharedWorkerMessageFilter* container_render_filter_; 130 SharedWorkerMessageFilter* container_render_filter_;
131 const int worker_process_id_; 131 const int worker_process_id_;
132 const int worker_route_id_; 132 const int worker_route_id_;
133 bool termination_message_sent_; 133 bool termination_message_sent_;
134 bool closed_; 134 bool closed_;
135 const base::TimeTicks creation_time_; 135 const base::TimeTicks creation_time_;
136 136
137 base::WeakPtrFactory<SharedWorkerHost> weak_factory_; 137 base::WeakPtrFactory<SharedWorkerHost> weak_factory_;
138 138
139 DISALLOW_COPY_AND_ASSIGN(SharedWorkerHost); 139 DISALLOW_COPY_AND_ASSIGN(SharedWorkerHost);
140 }; 140 };
141 } // namespace content 141 } // namespace content
142 142
143 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ 143 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/shared_worker/shared_worker_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698