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

Side by Side Diff: content/browser/service_worker/service_worker_dispatcher_host.h

Issue 189253002: Implement ServiceWorker::postMessage() [Chromium] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reup Created 6 years, 9 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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "content/browser/service_worker/service_worker_registration_status.h" 9 #include "content/browser/service_worker/service_worker_registration_status.h"
10 #include "content/public/browser/browser_message_filter.h" 10 #include "content/public/browser/browser_message_filter.h"
11 11
12 class GURL; 12 class GURL;
13 13
14 namespace content { 14 namespace content {
15 15
16 class MessagePortMessageFilter;
16 class ServiceWorkerContextCore; 17 class ServiceWorkerContextCore;
17 class ServiceWorkerContextWrapper; 18 class ServiceWorkerContextWrapper;
18 class ServiceWorkerProviderHost; 19 class ServiceWorkerProviderHost;
20 class ServiceWorkerRegistration;
19 21
20 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { 22 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter {
21 public: 23 public:
22 explicit ServiceWorkerDispatcherHost(int render_process_id); 24 ServiceWorkerDispatcherHost(
25 int render_process_id,
26 MessagePortMessageFilter* message_port_message_filter);
23 27
24 void Init(ServiceWorkerContextWrapper* context_wrapper); 28 void Init(ServiceWorkerContextWrapper* context_wrapper);
25 29
26 // BrowserIOMessageFilter implementation 30 // BrowserIOMessageFilter implementation
27 virtual void OnDestruct() const OVERRIDE; 31 virtual void OnDestruct() const OVERRIDE;
28 virtual bool OnMessageReceived(const IPC::Message& message, 32 virtual bool OnMessageReceived(const IPC::Message& message,
29 bool* message_was_ok) OVERRIDE; 33 bool* message_was_ok) OVERRIDE;
30 34
31 protected: 35 protected:
32 virtual ~ServiceWorkerDispatcherHost(); 36 virtual ~ServiceWorkerDispatcherHost();
(...skipping 14 matching lines...) Expand all
47 void OnProviderCreated(int provider_id); 51 void OnProviderCreated(int provider_id);
48 void OnProviderDestroyed(int provider_id); 52 void OnProviderDestroyed(int provider_id);
49 void OnAddScriptClient(int thread_id, int provider_id); 53 void OnAddScriptClient(int thread_id, int provider_id);
50 void OnRemoveScriptClient(int thread_id, int provider_id); 54 void OnRemoveScriptClient(int thread_id, int provider_id);
51 void OnWorkerStarted(int thread_id, 55 void OnWorkerStarted(int thread_id,
52 int embedded_worker_id); 56 int embedded_worker_id);
53 void OnWorkerStopped(int embedded_worker_id); 57 void OnWorkerStopped(int embedded_worker_id);
54 void OnSendMessageToBrowser(int embedded_worker_id, 58 void OnSendMessageToBrowser(int embedded_worker_id,
55 int request_id, 59 int request_id,
56 const IPC::Message& message); 60 const IPC::Message& message);
61 void OnPostMessage(int64 registration_id,
62 base::string16 message,
63 std::vector<int> sent_message_port_ids);
64
65 void PostMessageFoundRegistration(
66 base::string16 message,
67 std::vector<int> sent_message_port_ids,
68 ServiceWorkerStatusCode status,
69 const scoped_refptr<ServiceWorkerRegistration>& result);
57 70
58 // Callbacks from ServiceWorkerContextCore 71 // Callbacks from ServiceWorkerContextCore
59 void RegistrationComplete(int32 thread_id, 72 void RegistrationComplete(int32 thread_id,
60 int32 request_id, 73 int32 request_id,
61 ServiceWorkerStatusCode status, 74 ServiceWorkerStatusCode status,
62 int64 registration_id); 75 int64 registration_id);
63 76
64 void UnregistrationComplete(int32 thread_id, 77 void UnregistrationComplete(int32 thread_id,
65 int32 request_id, 78 int32 request_id,
66 ServiceWorkerStatusCode status); 79 ServiceWorkerStatusCode status);
67 80
68 void SendRegistrationError(int32 thread_id, 81 void SendRegistrationError(int32 thread_id,
69 int32 request_id, 82 int32 request_id,
70 ServiceWorkerStatusCode status); 83 ServiceWorkerStatusCode status);
84
71 int render_process_id_; 85 int render_process_id_;
86 MessagePortMessageFilter* const message_port_message_filter_;
michaeln 2014/03/11 23:17:34 is this really safe?
87
72 base::WeakPtr<ServiceWorkerContextCore> context_; 88 base::WeakPtr<ServiceWorkerContextCore> context_;
73 }; 89 };
74 90
75 } // namespace content 91 } // namespace content
76 92
77 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ 93 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698