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

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

Issue 1795863006: service worker: Attribute purpose to start worker attempts for UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 ResolvePromise(SERVICE_WORKER_OK, std::string(), registration()); 410 ResolvePromise(SERVICE_WORKER_OK, std::string(), registration());
411 411
412 // "Fire a simple event named updatefound..." 412 // "Fire a simple event named updatefound..."
413 registration()->NotifyUpdateFound(); 413 registration()->NotifyUpdateFound();
414 414
415 // "Fire an event named install..." 415 // "Fire an event named install..."
416 new_version()->RunAfterStartWorker( 416 new_version()->RunAfterStartWorker(
417 base::Bind(&ServiceWorkerRegisterJob::DispatchInstallEvent, 417 base::Bind(&ServiceWorkerRegisterJob::DispatchInstallEvent,
418 weak_factory_.GetWeakPtr()), 418 weak_factory_.GetWeakPtr()),
419 base::Bind(&ServiceWorkerRegisterJob::OnInstallFinished, 419 base::Bind(&ServiceWorkerRegisterJob::OnInstallFinished,
420 weak_factory_.GetWeakPtr())); 420 weak_factory_.GetWeakPtr()),
421 ServiceWorkerMetrics::EventType::INSTALL);
421 422
422 // A subsequent registration job may terminate our installing worker. It can 423 // A subsequent registration job may terminate our installing worker. It can
423 // only do so after we've started the worker and dispatched the install 424 // only do so after we've started the worker and dispatched the install
424 // event, as those are atomic substeps in the [[Install]] algorithm. 425 // event, as those are atomic substeps in the [[Install]] algorithm.
425 if (doom_installing_worker_) 426 if (doom_installing_worker_)
426 Complete(SERVICE_WORKER_ERROR_INSTALL_WORKER_FAILED); 427 Complete(SERVICE_WORKER_ERROR_INSTALL_WORKER_FAILED);
427 } 428 }
428 429
429 void ServiceWorkerRegisterJob::DispatchInstallEvent() { 430 void ServiceWorkerRegisterJob::DispatchInstallEvent() {
430 DCHECK_EQ(ServiceWorkerVersion::INSTALLING, new_version()->status()) 431 DCHECK_EQ(ServiceWorkerVersion::INSTALLING, new_version()->status())
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 ResolvePromise(SERVICE_WORKER_OK, std::string(), registration()); 591 ResolvePromise(SERVICE_WORKER_OK, std::string(), registration());
591 Complete(SERVICE_WORKER_ERROR_EXISTS, 592 Complete(SERVICE_WORKER_ERROR_EXISTS,
592 "The updated worker is identical to the incumbent."); 593 "The updated worker is identical to the incumbent.");
593 return; 594 return;
594 } 595 }
595 596
596 new_version()->embedded_worker()->ResumeAfterDownload(); 597 new_version()->embedded_worker()->ResumeAfterDownload();
597 } 598 }
598 599
599 } // namespace content 600 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698