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

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

Issue 25008006: Flush out initial [un]registerServiceWorker roundtrip (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
(Empty)
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
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/WebServiceWorkerRegistry.h"
12 #include "webkit/child/worker_task_runner.h"
13
14 class GURL;
15
16 namespace IPC {
17 class Message;
18 }
19
20 namespace content {
21 class ThreadSafeSender;
22 class ServiceWorkerMessageFilter;
23 class WebServiceWorkerImpl;
24
25 class ServiceWorkerDispatcher : public webkit_glue::WorkerTaskRunner::Observer {
26 public:
27 explicit ServiceWorkerDispatcher(ThreadSafeSender* thread_safe_sender,
28 ServiceWorkerMessageFilter* message_filter);
29 virtual ~ServiceWorkerDispatcher();
30
31 // webkit_glue::WorkerTaskRunner::Observer implementation.
32 virtual void OnWorkerRunLoopStopped() OVERRIDE;
33
34 void OnMessageReceived(const IPC::Message& msg);
35 bool Send(IPC::Message* msg);
36
37 void RegisterServiceWorker(
38 const string16& pattern,
39 const GURL& scriptUrl,
40 WebKit::WebServiceWorkerRegistry::WebServiceWorkerCallbacks* callbacks);
41 void UnregisterServiceWorker(
42 const string16& pattern,
43 WebKit::WebServiceWorkerRegistry::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 ServiceWorkerMessageFilter* message_filter);
50
51 private:
52 void OnServiceWorkerRegistered(int32 request_id, int32 worker_id);
53 void OnServiceWorkerUnregistered(int32 request_id, int32 worker_id);
54
55 IDMap<WebKit::WebServiceWorkerRegistry::WebServiceWorkerCallbacks,
56 IDMapOwnPointer> pending_callbacks_;
57 IDMap<WebServiceWorkerImpl, IDMapOwnPointer> workers_;
kinuko 2013/09/30 12:41:17 (oh, ok these are all owned here)
58
59 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
60 scoped_refptr<ServiceWorkerMessageFilter> message_filter_;
61
62 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher);
63 };
64
65 } // namespace content
66
67 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698