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_registration.h" | 5 #include "content/browser/service_worker/service_worker_registration.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
| 9 #include "content/browser/service_worker/embedded_worker_status.h" |
9 #include "content/browser/service_worker/service_worker_context_core.h" | 10 #include "content/browser/service_worker/service_worker_context_core.h" |
10 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 11 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
11 #include "content/browser/service_worker/service_worker_info.h" | 12 #include "content/browser/service_worker/service_worker_info.h" |
12 #include "content/browser/service_worker/service_worker_metrics.h" | 13 #include "content/browser/service_worker/service_worker_metrics.h" |
13 #include "content/browser/service_worker/service_worker_register_job.h" | 14 #include "content/browser/service_worker/service_worker_register_job.h" |
14 #include "content/common/service_worker/service_worker_messages.h" | 15 #include "content/common/service_worker/service_worker_messages.h" |
15 #include "content/common/service_worker/service_worker_utils.h" | 16 #include "content/common/service_worker/service_worker_utils.h" |
16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
17 | 18 |
18 namespace content { | 19 namespace content { |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 } | 374 } |
374 | 375 |
375 void ServiceWorkerRegistration::DispatchActivateEvent( | 376 void ServiceWorkerRegistration::DispatchActivateEvent( |
376 scoped_refptr<ServiceWorkerVersion> activating_version) { | 377 scoped_refptr<ServiceWorkerVersion> activating_version) { |
377 if (activating_version != active_version()) { | 378 if (activating_version != active_version()) { |
378 OnActivateEventFinished(activating_version, SERVICE_WORKER_ERROR_FAILED); | 379 OnActivateEventFinished(activating_version, SERVICE_WORKER_ERROR_FAILED); |
379 return; | 380 return; |
380 } | 381 } |
381 | 382 |
382 DCHECK_EQ(ServiceWorkerVersion::ACTIVATING, activating_version->status()); | 383 DCHECK_EQ(ServiceWorkerVersion::ACTIVATING, activating_version->status()); |
383 DCHECK_EQ(ServiceWorkerVersion::RUNNING, activating_version->running_status()) | 384 DCHECK_EQ(EmbeddedWorkerStatus::RUNNING, activating_version->running_status()) |
384 << "Worker stopped too soon after it was started."; | 385 << "Worker stopped too soon after it was started."; |
385 int request_id = activating_version->StartRequest( | 386 int request_id = activating_version->StartRequest( |
386 ServiceWorkerMetrics::EventType::ACTIVATE, | 387 ServiceWorkerMetrics::EventType::ACTIVATE, |
387 base::Bind(&ServiceWorkerRegistration::OnActivateEventFinished, this, | 388 base::Bind(&ServiceWorkerRegistration::OnActivateEventFinished, this, |
388 activating_version)); | 389 activating_version)); |
389 activating_version | 390 activating_version |
390 ->DispatchSimpleEvent<ServiceWorkerHostMsg_ActivateEventFinished>( | 391 ->DispatchSimpleEvent<ServiceWorkerHostMsg_ActivateEventFinished>( |
391 request_id, ServiceWorkerMsg_ActivateEvent(request_id)); | 392 request_id, ServiceWorkerMsg_ActivateEvent(request_id)); |
392 } | 393 } |
393 | 394 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 if (!context_) { | 473 if (!context_) { |
473 callback.Run(SERVICE_WORKER_ERROR_ABORT); | 474 callback.Run(SERVICE_WORKER_ERROR_ABORT); |
474 return; | 475 return; |
475 } | 476 } |
476 context_->storage()->NotifyDoneInstallingRegistration( | 477 context_->storage()->NotifyDoneInstallingRegistration( |
477 this, version.get(), status); | 478 this, version.get(), status); |
478 callback.Run(status); | 479 callback.Run(status); |
479 } | 480 } |
480 | 481 |
481 } // namespace content | 482 } // namespace content |
OLD | NEW |