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 246023007: Chromium-side plumbing for ServiceWorker -> Document postMessage (2/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: message port threading fix Created 6 years, 7 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 10
10 #include "base/id_map.h" 11 #include "base/id_map.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
13 #include "content/child/worker_task_runner.h" 14 #include "content/child/worker_task_runner.h"
14 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" 15 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h"
15 #include "third_party/WebKit/public/platform/WebServiceWorkerProvider.h" 16 #include "third_party/WebKit/public/platform/WebServiceWorkerProvider.h"
16 #include "third_party/WebKit/public/platform/WebServiceWorkerState.h" 17 #include "third_party/WebKit/public/platform/WebServiceWorkerState.h"
17 18
18 class GURL; 19 class GURL;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 void OnRegistrationError(int thread_id, 100 void OnRegistrationError(int thread_id,
100 int request_id, 101 int request_id,
101 blink::WebServiceWorkerError::ErrorType error_type, 102 blink::WebServiceWorkerError::ErrorType error_type,
102 const base::string16& message); 103 const base::string16& message);
103 void OnServiceWorkerStateChanged(int thread_id, 104 void OnServiceWorkerStateChanged(int thread_id,
104 int handle_id, 105 int handle_id,
105 blink::WebServiceWorkerState state); 106 blink::WebServiceWorkerState state);
106 void OnSetCurrentServiceWorker(int thread_id, 107 void OnSetCurrentServiceWorker(int thread_id,
107 int provider_id, 108 int provider_id,
108 const ServiceWorkerObjectInfo& info); 109 const ServiceWorkerObjectInfo& info);
110 void OnPostMessage(int thread_id,
111 int provider_id,
112 const base::string16& message,
113 const std::vector<int>& sent_message_port_ids,
114 const std::vector<int>& new_routing_ids);
109 115
110 // Keeps map from handle_id to ServiceWorker object. 116 // Keeps map from handle_id to ServiceWorker object.
111 void AddServiceWorker(int handle_id, WebServiceWorkerImpl* worker); 117 void AddServiceWorker(int handle_id, WebServiceWorkerImpl* worker);
112 void RemoveServiceWorker(int handle_id); 118 void RemoveServiceWorker(int handle_id);
113 119
114 CallbackMap pending_callbacks_; 120 CallbackMap pending_callbacks_;
115 ScriptClientMap script_clients_; 121 ScriptClientMap script_clients_;
116 ProviderContextMap provider_contexts_; 122 ProviderContextMap provider_contexts_;
117 WorkerObjectMap service_workers_; 123 WorkerObjectMap service_workers_;
118 124
119 // A map for ServiceWorkers that are associated to a particular document 125 // A map for ServiceWorkers that are associated to a particular document
120 // (e.g. as .current). 126 // (e.g. as .current).
121 WorkerToProviderMap worker_to_provider_; 127 WorkerToProviderMap worker_to_provider_;
122 128
123 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 129 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
124 130
125 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); 131 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher);
126 }; 132 };
127 133
128 } // namespace content 134 } // namespace content
129 135
130 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ 136 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698