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

Side by Side Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 140743012: Start EmbeddedWorker during registration - take 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update to ToT Created 6 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 | 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 #include "content/browser/service_worker/service_worker_dispatcher_host.h" 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/service_worker/embedded_worker_registry.h" 8 #include "content/browser/service_worker/embedded_worker_registry.h"
9 #include "content/browser/service_worker/service_worker_context_core.h" 9 #include "content/browser/service_worker/service_worker_context_core.h"
10 #include "content/browser/service_worker/service_worker_context_wrapper.h" 10 #include "content/browser/service_worker/service_worker_context_wrapper.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 thread_id, 107 thread_id,
108 request_id, 108 request_id,
109 WebServiceWorkerError::SecurityError, 109 WebServiceWorkerError::SecurityError,
110 base::ASCIIToUTF16(kDomainMismatchErrorMessage))); 110 base::ASCIIToUTF16(kDomainMismatchErrorMessage)));
111 return; 111 return;
112 } 112 }
113 113
114 context_->RegisterServiceWorker( 114 context_->RegisterServiceWorker(
115 pattern, 115 pattern,
116 script_url, 116 script_url,
117 render_process_id_,
117 base::Bind(&ServiceWorkerDispatcherHost::RegistrationComplete, 118 base::Bind(&ServiceWorkerDispatcherHost::RegistrationComplete,
118 this, 119 this,
119 thread_id, 120 thread_id,
120 request_id)); 121 request_id));
121 } 122 }
122 123
123 void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker( 124 void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker(
124 int32 thread_id, 125 int32 thread_id,
125 int32 request_id, 126 int32 request_id,
126 const GURL& pattern) { 127 const GURL& pattern) {
127 // TODO(alecflett): This check is insufficient for release. Add a 128 // TODO(alecflett): This check is insufficient for release. Add a
128 // ServiceWorker-specific policy query in 129 // ServiceWorker-specific policy query in
129 // ChildProcessSecurityImpl. See http://crbug.com/311631. 130 // ChildProcessSecurityImpl. See http://crbug.com/311631.
130 if (!context_ || !context_->IsEnabled()) { 131 if (!context_ || !context_->IsEnabled()) {
131 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( 132 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
132 thread_id, 133 thread_id,
133 request_id, 134 request_id,
134 blink::WebServiceWorkerError::DisabledError, 135 blink::WebServiceWorkerError::DisabledError,
135 base::ASCIIToUTF16(kDisabledErrorMessage))); 136 base::ASCIIToUTF16(kDisabledErrorMessage)));
136 return; 137 return;
137 } 138 }
138 139
139 context_->UnregisterServiceWorker( 140 context_->UnregisterServiceWorker(
140 pattern, 141 pattern,
142 render_process_id_,
141 base::Bind(&ServiceWorkerDispatcherHost::UnregistrationComplete, 143 base::Bind(&ServiceWorkerDispatcherHost::UnregistrationComplete,
142 this, 144 this,
143 thread_id, 145 thread_id,
144 request_id)); 146 request_id));
145 } 147 }
146 148
147 void ServiceWorkerDispatcherHost::OnProviderCreated(int provider_id) { 149 void ServiceWorkerDispatcherHost::OnProviderCreated(int provider_id) {
148 if (!context_) 150 if (!context_)
149 return; 151 return;
150 if (context_->GetProviderHost(render_process_id_, provider_id)) { 152 if (context_->GetProviderHost(render_process_id_, provider_id)) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 ServiceWorkerStatusCode status) { 225 ServiceWorkerStatusCode status) {
224 base::string16 error_message; 226 base::string16 error_message;
225 blink::WebServiceWorkerError::ErrorType error_type; 227 blink::WebServiceWorkerError::ErrorType error_type;
226 GetServiceWorkerRegistrationStatusResponse( 228 GetServiceWorkerRegistrationStatusResponse(
227 status, &error_type, &error_message); 229 status, &error_type, &error_message);
228 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( 230 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
229 thread_id, request_id, error_type, error_message)); 231 thread_id, request_id, error_type, error_message));
230 } 232 }
231 233
232 } // namespace content 234 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698