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" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
393 | 393 |
394 void ServiceWorkerRegisterJob::OnInstallFinished( | 394 void ServiceWorkerRegisterJob::OnInstallFinished( |
395 ServiceWorkerStatusCode status) { | 395 ServiceWorkerStatusCode status) { |
396 if (status != SERVICE_WORKER_OK) { | 396 if (status != SERVICE_WORKER_OK) { |
397 // "8. If installFailed is true, then:..." | 397 // "8. If installFailed is true, then:..." |
398 Complete(status); | 398 Complete(status); |
399 return; | 399 return; |
400 } | 400 } |
401 | 401 |
402 SetPhase(STORE); | 402 SetPhase(STORE); |
403 registration()->set_last_update_check(base::Time::Now()); | 403 const base::Time now = base::Time::Now(); |
404 registration()->set_last_update_check(now); | |
405 registration()->installing_version()->set_update_time(now); | |
falken
2015/03/30 00:46:29
Update is an operation on registration, not versio
| |
404 context_->storage()->StoreRegistration( | 406 context_->storage()->StoreRegistration( |
405 registration(), | 407 registration(), |
406 new_version(), | 408 new_version(), |
407 base::Bind(&ServiceWorkerRegisterJob::OnStoreRegistrationComplete, | 409 base::Bind(&ServiceWorkerRegisterJob::OnStoreRegistrationComplete, |
408 weak_factory_.GetWeakPtr())); | 410 weak_factory_.GetWeakPtr())); |
409 } | 411 } |
410 | 412 |
411 void ServiceWorkerRegisterJob::OnStoreRegistrationComplete( | 413 void ServiceWorkerRegisterJob::OnStoreRegistrationComplete( |
412 ServiceWorkerStatusCode status) { | 414 ServiceWorkerStatusCode status) { |
413 if (status != SERVICE_WORKER_OK) { | 415 if (status != SERVICE_WORKER_OK) { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
560 if (host->IsHostToRunningServiceWorker()) | 562 if (host->IsHostToRunningServiceWorker()) |
561 continue; | 563 continue; |
562 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), | 564 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), |
563 host->document_url())) | 565 host->document_url())) |
564 continue; | 566 continue; |
565 host->AddMatchingRegistration(registration); | 567 host->AddMatchingRegistration(registration); |
566 } | 568 } |
567 } | 569 } |
568 | 570 |
569 } // namespace content | 571 } // namespace content |
OLD | NEW |