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

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: Use int64 for workers, remove policy check Created 7 years, 1 month 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/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;
27 class WebServiceWorkerImpl;
28
29 class ServiceWorkerDispatcher : public webkit_glue::WorkerTaskRunner::Observer {
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(
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698