OLD | NEW |
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_context_wrapper.h" | 5 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 const ResultCallback& callback, | 334 const ResultCallback& callback, |
335 ServiceWorkerStatusCode status, | 335 ServiceWorkerStatusCode status, |
336 scoped_refptr<ServiceWorkerRegistration> registration) { | 336 scoped_refptr<ServiceWorkerRegistration> registration) { |
337 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 337 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
338 if (status != SERVICE_WORKER_OK || !registration->active_version()) { | 338 if (status != SERVICE_WORKER_OK || !registration->active_version()) { |
339 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 339 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
340 base::Bind(callback, false)); | 340 base::Bind(callback, false)); |
341 return; | 341 return; |
342 } | 342 } |
343 | 343 |
| 344 if (registration->active_version()->fetch_handler_existence() == |
| 345 ServiceWorkerVersion::FetchHandlerExistence::DOES_NOT_EXIST) { |
| 346 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 347 base::Bind(callback, false)); |
| 348 return; |
| 349 } |
| 350 |
344 // Add the process reference of |render_process_id| not to launch a new | 351 // Add the process reference of |render_process_id| not to launch a new |
345 // renderer process for the service worker. | 352 // renderer process for the service worker. |
346 context_core_->process_manager()->AddProcessReferenceToPattern( | 353 context_core_->process_manager()->AddProcessReferenceToPattern( |
347 registration->pattern(), render_process_id); | 354 registration->pattern(), render_process_id); |
348 | 355 |
349 registration->active_version()->StartWorker( | 356 registration->active_version()->StartWorker( |
350 GetNavigationHintEventType(type), | 357 GetNavigationHintEventType(type), |
351 base::Bind( | 358 base::Bind( |
352 &ServiceWorkerContextWrapper::DidStartServiceWorkerForNavigationHint, | 359 &ServiceWorkerContextWrapper::DidStartServiceWorkerForNavigationHint, |
353 this, registration->pattern(), render_process_id, callback)); | 360 this, registration->pattern(), render_process_id, callback)); |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 observer_list_->Notify(FROM_HERE, | 845 observer_list_->Notify(FROM_HERE, |
839 &ServiceWorkerContextObserver::OnStorageWiped); | 846 &ServiceWorkerContextObserver::OnStorageWiped); |
840 } | 847 } |
841 | 848 |
842 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { | 849 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { |
843 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 850 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
844 return context_core_.get(); | 851 return context_core_.get(); |
845 } | 852 } |
846 | 853 |
847 } // namespace content | 854 } // namespace content |
OLD | NEW |