OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
jam
2013/10/28 17:05:50
why are all these new files in content/child inste
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | |
6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | |
7 | |
8 #include "base/id_map.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/strings/string16.h" | |
11 #include "third_party/WebKit/public/platform/WebServiceWorkerProvider.h" | |
12 #include "webkit/child/worker_task_runner.h" | |
13 | |
14 class GURL; | |
15 | |
16 namespace WebKit { | |
17 class WebURL; | |
18 } | |
19 | |
20 namespace IPC { | |
21 class Message; | |
22 } | |
23 | |
24 namespace content { | |
25 class ThreadSafeSender; | |
26 class ServiceWorkerMessageFilter; | |
jam
2013/10/28 17:26:55
nit: order
alecflett
2013/10/28 21:11:43
Done.
| |
27 class WebServiceWorkerImpl; | |
28 | |
29 class ServiceWorkerDispatcher : public webkit_glue::WorkerTaskRunner::Observer { | |
jam
2013/10/28 17:26:55
nit: please add a small comment to each new class
| |
30 public: | |
31 explicit ServiceWorkerDispatcher(ThreadSafeSender* thread_safe_sender); | |
32 virtual ~ServiceWorkerDispatcher(); | |
33 | |
34 void OnMessageReceived(const IPC::Message& msg); | |
35 bool Send(IPC::Message* msg); | |
36 | |
37 void RegisterServiceWorker( | |
jam
2013/10/28 17:26:55
nit: document methods as well
alecflett
2013/10/28 21:11:43
Done.
| |
38 const GURL& pattern, | |
39 const GURL& script_url, | |
40 WebKit::WebServiceWorkerProvider::WebServiceWorkerCallbacks* callbacks); | |
41 void UnregisterServiceWorker( | |
42 const GURL& pattern, | |
43 WebKit::WebServiceWorkerProvider::WebServiceWorkerCallbacks* callbacks); | |
44 | |
45 // |thread_safe_sender| needs to be passed in because if the call leads to | |
46 // construction it will be needed. | |
47 static ServiceWorkerDispatcher* ThreadSpecificInstance( | |
48 ThreadSafeSender* thread_safe_sender); | |
49 | |
50 private: | |
51 // webkit_glue::WorkerTaskRunner::Observer implementation. | |
52 virtual void OnWorkerRunLoopStopped() OVERRIDE; | |
53 | |
54 void OnServiceWorkerRegistered(int32 thread_id, | |
55 int32 request_id, | |
56 int64 service_worker_id); | |
57 void OnServiceWorkerUnregistered(int32 thread_id, | |
58 int32 request_id); | |
59 | |
60 IDMap<WebKit::WebServiceWorkerProvider::WebServiceWorkerCallbacks, | |
61 IDMapOwnPointer> pending_callbacks_; | |
62 | |
63 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | |
64 | |
65 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); | |
66 }; | |
67 | |
68 } // namespace content | |
69 | |
70 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | |
OLD | NEW |