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

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

Issue 958523002: ServiceWorker: Use scheduler's default task queue for posting tasks on main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | content/renderer/service_worker/embedded_worker_context_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 MessageLoopProxy; 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 } 24 }
25 25
26 namespace content { 26 namespace content {
27 27
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 blink::WebMessagePortChannelArray* channels); 123 blink::WebMessagePortChannelArray* channels);
124 virtual void focus(int client_id, 124 virtual void focus(int client_id,
125 blink::WebServiceWorkerClientCallbacks*); 125 blink::WebServiceWorkerClientCallbacks*);
126 virtual void skipWaiting( 126 virtual void skipWaiting(
127 blink::WebServiceWorkerSkipWaitingCallbacks* callbacks); 127 blink::WebServiceWorkerSkipWaitingCallbacks* callbacks);
128 virtual void claim(blink::WebServiceWorkerClientsClaimCallbacks* callbacks); 128 virtual void claim(blink::WebServiceWorkerClientsClaimCallbacks* callbacks);
129 129
130 // TODO: Implement DevTools related method overrides. 130 // TODO: Implement DevTools related method overrides.
131 131
132 int embedded_worker_id() const { return embedded_worker_id_; } 132 int embedded_worker_id() const { return embedded_worker_id_; }
133 base::MessageLoopProxy* main_thread_proxy() const { 133 base::SingleThreadTaskRunner* main_thread_task_runner() const {
134 return main_thread_proxy_.get(); 134 return main_thread_task_runner_.get();
135 } 135 }
136 ThreadSafeSender* thread_safe_sender() { return sender_.get(); } 136 ThreadSafeSender* thread_safe_sender() { return sender_.get(); }
137 137
138 private: 138 private:
139 void OnMessageToWorker(int thread_id, 139 void OnMessageToWorker(int thread_id,
140 int embedded_worker_id, 140 int embedded_worker_id,
141 const IPC::Message& message); 141 const IPC::Message& message);
142 void SendWorkerStarted(); 142 void SendWorkerStarted();
143 void SetRegistrationInServiceWorkerGlobalScope(); 143 void SetRegistrationInServiceWorkerGlobalScope();
144 144
145 const int embedded_worker_id_; 145 const int embedded_worker_id_;
146 const int64 service_worker_version_id_; 146 const int64 service_worker_version_id_;
147 const GURL service_worker_scope_; 147 const GURL service_worker_scope_;
148 const GURL script_url_; 148 const GURL script_url_;
149 const int worker_devtools_agent_route_id_; 149 const int worker_devtools_agent_route_id_;
150 scoped_refptr<ThreadSafeSender> sender_; 150 scoped_refptr<ThreadSafeSender> sender_;
151 scoped_refptr<base::MessageLoopProxy> main_thread_proxy_; 151 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
152 scoped_refptr<base::TaskRunner> worker_task_runner_; 152 scoped_refptr<base::TaskRunner> worker_task_runner_;
153 153
154 scoped_ptr<ServiceWorkerScriptContext> script_context_; 154 scoped_ptr<ServiceWorkerScriptContext> script_context_;
155 scoped_refptr<ServiceWorkerProviderContext> provider_context_; 155 scoped_refptr<ServiceWorkerProviderContext> provider_context_;
156 156
157 base::WeakPtrFactory<EmbeddedWorkerContextClient> weak_factory_; 157 base::WeakPtrFactory<EmbeddedWorkerContextClient> weak_factory_;
158 158
159 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerContextClient); 159 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerContextClient);
160 }; 160 };
161 161
162 } // namespace content 162 } // namespace content
163 163
164 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ 164 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/service_worker/embedded_worker_context_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698