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

Side by Side Diff: content/renderer/service_worker/embedded_worker_context_client.h

Issue 178343011: Support dispatching ServiceWorker FetchEvent and receiving response (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use const for result on failure 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_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_CLIENT_H_ 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_CLIENT_H_
6 #define CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_CLIENT_H_ 6 #define CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_CLIENT_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "content/common/service_worker/service_worker_types.h"
11 #include "ipc/ipc_listener.h" 12 #include "ipc/ipc_listener.h"
12 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" 13 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h"
13 #include "url/gurl.h" 14 #include "url/gurl.h"
14 15
15 namespace base { 16 namespace base {
16 class MessageLoopProxy; 17 class MessageLoopProxy;
17 class TaskRunner; 18 class TaskRunner;
18 } 19 }
19 20
20 namespace content { 21 namespace content {
(...skipping 28 matching lines...) Expand all
49 50
50 void SendMessageToBrowser(int request_id, const IPC::Message& message); 51 void SendMessageToBrowser(int request_id, const IPC::Message& message);
51 52
52 // WebServiceWorkerContextClient overrides, some of them are just dispatched 53 // WebServiceWorkerContextClient overrides, some of them are just dispatched
53 // on to script_context_. 54 // on to script_context_.
54 virtual void workerContextFailedToStart(); 55 virtual void workerContextFailedToStart();
55 virtual void workerContextStarted(blink::WebServiceWorkerContextProxy* proxy); 56 virtual void workerContextStarted(blink::WebServiceWorkerContextProxy* proxy);
56 virtual void workerContextDestroyed(); 57 virtual void workerContextDestroyed();
57 virtual void didHandleInstallEvent(int request_id); 58 virtual void didHandleInstallEvent(int request_id);
58 virtual void didHandleFetchEvent(int request_id); 59 virtual void didHandleFetchEvent(int request_id);
60 virtual void didHandleFetchEvent(
61 int request_id,
62 const blink::WebServiceWorkerResponse& response);
59 63
60 // TODO: Implement DevTools related method overrides. 64 // TODO: Implement DevTools related method overrides.
61 65
62 int embedded_worker_id() const { return embedded_worker_id_; } 66 int embedded_worker_id() const { return embedded_worker_id_; }
63 67
64 private: 68 private:
65 void OnSendMessageToWorker(int thread_id, 69 void OnSendMessageToWorker(int thread_id,
66 int embedded_worker_id, 70 int embedded_worker_id,
67 int request_id, 71 int request_id,
68 const IPC::Message& message); 72 const IPC::Message& message);
69 void SendWorkerStarted(); 73 void SendWorkerStarted();
70 74
71 const int embedded_worker_id_; 75 const int embedded_worker_id_;
72 const int64 service_worker_version_id_; 76 const int64 service_worker_version_id_;
73 const GURL script_url_; 77 const GURL script_url_;
74 scoped_refptr<ThreadSafeSender> sender_; 78 scoped_refptr<ThreadSafeSender> sender_;
75 scoped_refptr<base::MessageLoopProxy> main_thread_proxy_; 79 scoped_refptr<base::MessageLoopProxy> main_thread_proxy_;
76 scoped_refptr<base::TaskRunner> worker_task_runner_; 80 scoped_refptr<base::TaskRunner> worker_task_runner_;
77 81
78 scoped_ptr<ServiceWorkerScriptContext> script_context_; 82 scoped_ptr<ServiceWorkerScriptContext> script_context_;
79 83
80 base::WeakPtrFactory<EmbeddedWorkerContextClient> weak_factory_; 84 base::WeakPtrFactory<EmbeddedWorkerContextClient> weak_factory_;
81 85
82 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerContextClient); 86 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerContextClient);
83 }; 87 };
84 88
85 } // namespace content 89 } // namespace content
86 90
87 #endif // CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_CLIENT_H_ 91 #endif // CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698