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

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

Issue 992353003: Decouple Cache Storage messaging from Service Worker/Embedded Worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 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
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_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_
6 #define CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ 6 #define CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_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 "content/common/service_worker/service_worker_types.h"
12 #include "ipc/ipc_listener.h" 12 #include "ipc/ipc_listener.h"
13 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" 13 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace base { 16 namespace base {
17 class SingleThreadTaskRunner; 17 class SingleThreadTaskRunner;
18 class TaskRunner; 18 class TaskRunner;
19 } 19 }
20 20
21 namespace blink { 21 namespace blink {
22 class WebDataSource; 22 class WebDataSource;
23 class WebServiceWorkerProvider; 23 class WebServiceWorkerProvider;
24 class WebServiceWorkerCacheStorage;
24 } 25 }
25 26
26 namespace content { 27 namespace content {
27 28
28 class ServiceWorkerProviderContext; 29 class ServiceWorkerProviderContext;
29 class ServiceWorkerScriptContext; 30 class ServiceWorkerScriptContext;
30 class ThreadSafeSender; 31 class ThreadSafeSender;
31 32
32 // This class provides access to/from an embedded worker's WorkerGlobalScope. 33 // This class provides access to/from an embedded worker's WorkerGlobalScope.
33 // Unless otherwise noted, all methods are called on the worker thread. 34 // Unless otherwise noted, all methods are called on the worker thread.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 virtual void claim(blink::WebServiceWorkerClientsClaimCallbacks* callbacks); 130 virtual void claim(blink::WebServiceWorkerClientsClaimCallbacks* callbacks);
130 131
131 // TODO: Implement DevTools related method overrides. 132 // TODO: Implement DevTools related method overrides.
132 133
133 int embedded_worker_id() const { return embedded_worker_id_; } 134 int embedded_worker_id() const { return embedded_worker_id_; }
134 base::SingleThreadTaskRunner* main_thread_task_runner() const { 135 base::SingleThreadTaskRunner* main_thread_task_runner() const {
135 return main_thread_task_runner_.get(); 136 return main_thread_task_runner_.get();
136 } 137 }
137 ThreadSafeSender* thread_safe_sender() { return sender_.get(); } 138 ThreadSafeSender* thread_safe_sender() { return sender_.get(); }
138 139
140 // Only needed by ServiceWorkerScriptContext when creating a
141 // WebServiceWorkerCacheStorageImpl
142 // TODO(jsbell): Remove when no longer needed. crbug.com/439389
143 const GURL origin() const { return service_worker_scope_.GetOrigin(); }
144
139 private: 145 private:
140 void OnMessageToWorker(int thread_id, 146 void OnMessageToWorker(int thread_id,
141 int embedded_worker_id, 147 int embedded_worker_id,
142 const IPC::Message& message); 148 const IPC::Message& message);
143 void SendWorkerStarted(); 149 void SendWorkerStarted();
144 void SetRegistrationInServiceWorkerGlobalScope(); 150 void SetRegistrationInServiceWorkerGlobalScope();
145 151
146 const int embedded_worker_id_; 152 const int embedded_worker_id_;
147 const int64 service_worker_version_id_; 153 const int64 service_worker_version_id_;
148 const GURL service_worker_scope_; 154 const GURL service_worker_scope_;
149 const GURL script_url_; 155 const GURL script_url_;
150 const int worker_devtools_agent_route_id_; 156 const int worker_devtools_agent_route_id_;
151 scoped_refptr<ThreadSafeSender> sender_; 157 scoped_refptr<ThreadSafeSender> sender_;
152 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 158 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
153 scoped_refptr<base::TaskRunner> worker_task_runner_; 159 scoped_refptr<base::TaskRunner> worker_task_runner_;
154 160
155 scoped_ptr<ServiceWorkerScriptContext> script_context_; 161 scoped_ptr<ServiceWorkerScriptContext> script_context_;
156 scoped_refptr<ServiceWorkerProviderContext> provider_context_; 162 scoped_refptr<ServiceWorkerProviderContext> provider_context_;
157 163
158 base::WeakPtrFactory<EmbeddedWorkerContextClient> weak_factory_; 164 base::WeakPtrFactory<EmbeddedWorkerContextClient> weak_factory_;
159 165
160 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerContextClient); 166 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerContextClient);
161 }; 167 };
162 168
163 } // namespace content 169 } // namespace content
164 170
165 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ 171 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698