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

Side by Side Diff: content/child/service_worker/service_worker_dispatcher.h

Issue 445883003: ServiceWorker: Consolidate version change messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 11 matching lines...) Expand all
22 class WebURL; 22 class WebURL;
23 } 23 }
24 24
25 namespace IPC { 25 namespace IPC {
26 class Message; 26 class Message;
27 } 27 }
28 28
29 namespace content { 29 namespace content {
30 30
31 class ServiceWorkerMessageFilter; 31 class ServiceWorkerMessageFilter;
32 struct ServiceWorkerObjectInfo;
33 class ServiceWorkerProviderContext; 32 class ServiceWorkerProviderContext;
34 class ThreadSafeSender; 33 class ThreadSafeSender;
35 class WebServiceWorkerImpl; 34 class WebServiceWorkerImpl;
35 struct ServiceWorkerObjectInfo;
36 struct ServiceWorkerVersionAttributes;
36 37
37 // This class manages communication with the browser process about 38 // This class manages communication with the browser process about
38 // registration of the service worker, exposed to renderer and worker 39 // registration of the service worker, exposed to renderer and worker
39 // scripts through methods like navigator.registerServiceWorker(). 40 // scripts through methods like navigator.registerServiceWorker().
40 class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer { 41 class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
41 public: 42 public:
42 typedef blink::WebServiceWorkerProvider::WebServiceWorkerRegistrationCallbacks 43 typedef blink::WebServiceWorkerProvider::WebServiceWorkerRegistrationCallbacks
43 WebServiceWorkerRegistrationCallbacks; 44 WebServiceWorkerRegistrationCallbacks;
44 45
45 explicit ServiceWorkerDispatcher(ThreadSafeSender* thread_safe_sender); 46 explicit ServiceWorkerDispatcher(ThreadSafeSender* thread_safe_sender);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 const ServiceWorkerObjectInfo& info); 117 const ServiceWorkerObjectInfo& info);
117 void OnUnregistered(int thread_id, 118 void OnUnregistered(int thread_id,
118 int request_id); 119 int request_id);
119 void OnRegistrationError(int thread_id, 120 void OnRegistrationError(int thread_id,
120 int request_id, 121 int request_id,
121 blink::WebServiceWorkerError::ErrorType error_type, 122 blink::WebServiceWorkerError::ErrorType error_type,
122 const base::string16& message); 123 const base::string16& message);
123 void OnServiceWorkerStateChanged(int thread_id, 124 void OnServiceWorkerStateChanged(int thread_id,
124 int handle_id, 125 int handle_id,
125 blink::WebServiceWorkerState state); 126 blink::WebServiceWorkerState state);
126 void OnSetInstallingServiceWorker(int thread_id, 127 void OnSetVersionAttributes(int thread_id,
127 int provider_id, 128 int provider_id,
128 const ServiceWorkerObjectInfo& info); 129 int changed_mask,
129 void OnSetWaitingServiceWorker(int thread_id, 130 const ServiceWorkerVersionAttributes& attributes);
130 int provider_id,
131 const ServiceWorkerObjectInfo& info);
132 void OnSetActiveServiceWorker(int thread_id,
133 int provider_id,
134 const ServiceWorkerObjectInfo& info);
135 void OnSetControllerServiceWorker(int thread_id, 131 void OnSetControllerServiceWorker(int thread_id,
136 int provider_id, 132 int provider_id,
137 const ServiceWorkerObjectInfo& info); 133 const ServiceWorkerObjectInfo& info);
138 void OnPostMessage(int thread_id, 134 void OnPostMessage(int thread_id,
139 int provider_id, 135 int provider_id,
140 const base::string16& message, 136 const base::string16& message,
141 const std::vector<int>& sent_message_port_ids, 137 const std::vector<int>& sent_message_port_ids,
142 const std::vector<int>& new_routing_ids); 138 const std::vector<int>& new_routing_ids);
143 139
140 void SetInstallingServiceWorker(
141 int provider_id,
142 const ServiceWorkerObjectInfo& info);
143 void SetWaitingServiceWorker(
144 int provider_id,
145 const ServiceWorkerObjectInfo& info);
146 void SetActiveServiceWorker(
147 int provider_id,
148 const ServiceWorkerObjectInfo& info);
149
144 // Keeps map from handle_id to ServiceWorker object. 150 // Keeps map from handle_id to ServiceWorker object.
145 void AddServiceWorker(int handle_id, WebServiceWorkerImpl* worker); 151 void AddServiceWorker(int handle_id, WebServiceWorkerImpl* worker);
146 void RemoveServiceWorker(int handle_id); 152 void RemoveServiceWorker(int handle_id);
147 153
148 CallbackMap pending_callbacks_; 154 CallbackMap pending_callbacks_;
149 ScriptClientMap script_clients_; 155 ScriptClientMap script_clients_;
150 ProviderContextMap provider_contexts_; 156 ProviderContextMap provider_contexts_;
151 WorkerObjectMap service_workers_; 157 WorkerObjectMap service_workers_;
152 158
153 // A map for ServiceWorkers that are associated to a particular document 159 // A map for ServiceWorkers that are associated to a particular document
154 // (e.g. as .current). 160 // (e.g. as .current).
155 WorkerToProviderMap worker_to_provider_; 161 WorkerToProviderMap worker_to_provider_;
156 162
157 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 163 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
158 164
159 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); 165 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher);
160 }; 166 };
161 167
162 } // namespace content 168 } // namespace content
163 169
164 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ 170 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698