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

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

Issue 2002883002: ServiceWorker: Store the existence of fetch event handler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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_register_job.h" 5 #include "content/browser/service_worker/service_worker_register_job.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 422
423 void ServiceWorkerRegisterJob::DispatchInstallEvent() { 423 void ServiceWorkerRegisterJob::DispatchInstallEvent() {
424 DCHECK_EQ(ServiceWorkerVersion::INSTALLING, new_version()->status()) 424 DCHECK_EQ(ServiceWorkerVersion::INSTALLING, new_version()->status())
425 << new_version()->status(); 425 << new_version()->status();
426 DCHECK_EQ(ServiceWorkerVersion::RUNNING, new_version()->running_status()) 426 DCHECK_EQ(ServiceWorkerVersion::RUNNING, new_version()->running_status())
427 << "Worker stopped too soon after it was started."; 427 << "Worker stopped too soon after it was started.";
428 int request_id = new_version()->StartRequest( 428 int request_id = new_version()->StartRequest(
429 ServiceWorkerMetrics::EventType::INSTALL, 429 ServiceWorkerMetrics::EventType::INSTALL,
430 base::Bind(&ServiceWorkerRegisterJob::OnInstallFinished, 430 base::Bind(&ServiceWorkerRegisterJob::OnInstallFinished,
431 weak_factory_.GetWeakPtr())); 431 weak_factory_.GetWeakPtr()));
432 new_version()->DispatchSimpleEvent<ServiceWorkerHostMsg_InstallEventFinished>( 432 new_version()->DispatchInstallEvent(request_id);
433 request_id, ServiceWorkerMsg_InstallEvent(request_id));
434 } 433 }
435 434
436 void ServiceWorkerRegisterJob::OnInstallFinished( 435 void ServiceWorkerRegisterJob::OnInstallFinished(
437 ServiceWorkerStatusCode status) { 436 ServiceWorkerStatusCode status) {
438 ServiceWorkerMetrics::RecordInstallEventStatus(status); 437 ServiceWorkerMetrics::RecordInstallEventStatus(status);
439 438
440 if (status != SERVICE_WORKER_OK) { 439 if (status != SERVICE_WORKER_OK) {
441 // "8. If installFailed is true, then:..." 440 // "8. If installFailed is true, then:..."
442 Complete(status, std::string("ServiceWorker failed to install: ") + 441 Complete(status, std::string("ServiceWorker failed to install: ") +
443 ServiceWorkerStatusToString(status)); 442 ServiceWorkerStatusToString(status));
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 new_version()->force_bypass_cache_for_scripts() || 601 new_version()->force_bypass_cache_for_scripts() ||
603 registration()->last_update_check().is_null()) { 602 registration()->last_update_check().is_null()) {
604 registration()->set_last_update_check(base::Time::Now()); 603 registration()->set_last_update_check(base::Time::Now());
605 604
606 if (registration()->has_installed_version()) 605 if (registration()->has_installed_version())
607 context_->storage()->UpdateLastUpdateCheckTime(registration()); 606 context_->storage()->UpdateLastUpdateCheckTime(registration());
608 } 607 }
609 } 608 }
610 609
611 } // namespace content 610 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698