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_register_job.h" | 5 #include "content/browser/service_worker/service_worker_register_job.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/browser/service_worker/service_worker_context_core.h" | 10 #include "content/browser/service_worker/service_worker_context_core.h" |
11 #include "content/browser/service_worker/service_worker_job_coordinator.h" | 11 #include "content/browser/service_worker/service_worker_job_coordinator.h" |
| 12 #include "content/browser/service_worker/service_worker_metrics.h" |
12 #include "content/browser/service_worker/service_worker_registration.h" | 13 #include "content/browser/service_worker/service_worker_registration.h" |
13 #include "content/browser/service_worker/service_worker_storage.h" | 14 #include "content/browser/service_worker/service_worker_storage.h" |
14 #include "content/browser/service_worker/service_worker_utils.h" | 15 #include "content/browser/service_worker/service_worker_utils.h" |
15 #include "content/common/service_worker/service_worker_types.h" | 16 #include "content/common/service_worker/service_worker_types.h" |
16 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 379 |
379 // A subsequent registration job may terminate our installing worker. It can | 380 // A subsequent registration job may terminate our installing worker. It can |
380 // only do so after we've started the worker and dispatched the install | 381 // only do so after we've started the worker and dispatched the install |
381 // event, as those are atomic substeps in the [[Install]] algorithm. | 382 // event, as those are atomic substeps in the [[Install]] algorithm. |
382 if (doom_installing_worker_) | 383 if (doom_installing_worker_) |
383 Complete(SERVICE_WORKER_ERROR_INSTALL_WORKER_FAILED); | 384 Complete(SERVICE_WORKER_ERROR_INSTALL_WORKER_FAILED); |
384 } | 385 } |
385 | 386 |
386 void ServiceWorkerRegisterJob::OnInstallFinished( | 387 void ServiceWorkerRegisterJob::OnInstallFinished( |
387 ServiceWorkerStatusCode status) { | 388 ServiceWorkerStatusCode status) { |
| 389 ServiceWorkerMetrics::RecordInstallEventStatus(status); |
| 390 |
388 if (status != SERVICE_WORKER_OK) { | 391 if (status != SERVICE_WORKER_OK) { |
389 // "8. If installFailed is true, then:..." | 392 // "8. If installFailed is true, then:..." |
390 Complete(status); | 393 Complete(status); |
391 return; | 394 return; |
392 } | 395 } |
393 | 396 |
394 SetPhase(STORE); | 397 SetPhase(STORE); |
395 registration()->set_last_update_check(base::Time::Now()); | 398 registration()->set_last_update_check(base::Time::Now()); |
396 context_->storage()->StoreRegistration( | 399 context_->storage()->StoreRegistration( |
397 registration(), | 400 registration(), |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 if (host->IsHostToRunningServiceWorker()) | 556 if (host->IsHostToRunningServiceWorker()) |
554 continue; | 557 continue; |
555 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), | 558 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), |
556 host->document_url())) | 559 host->document_url())) |
557 continue; | 560 continue; |
558 host->AddMatchingRegistration(registration); | 561 host->AddMatchingRegistration(registration); |
559 } | 562 } |
560 } | 563 } |
561 | 564 |
562 } // namespace content | 565 } // namespace content |
OLD | NEW |