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

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

Issue 2039743003: Introduce ServiceWorker.ActivatedWorkerPreparationForMainFrame.Time UMA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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_dispatcher_host.h" 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/profiler/scoped_tracker.h" 12 #include "base/profiler/scoped_tracker.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
15 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
16 #include "content/browser/bad_message.h" 16 #include "content/browser/bad_message.h"
17 #include "content/browser/message_port_message_filter.h" 17 #include "content/browser/message_port_message_filter.h"
18 #include "content/browser/message_port_service.h" 18 #include "content/browser/message_port_service.h"
19 #include "content/browser/service_worker/embedded_worker_registry.h" 19 #include "content/browser/service_worker/embedded_worker_registry.h"
20 #include "content/browser/service_worker/embedded_worker_status.h"
20 #include "content/browser/service_worker/service_worker_client_utils.h" 21 #include "content/browser/service_worker/service_worker_client_utils.h"
21 #include "content/browser/service_worker/service_worker_context_core.h" 22 #include "content/browser/service_worker/service_worker_context_core.h"
22 #include "content/browser/service_worker/service_worker_context_wrapper.h" 23 #include "content/browser/service_worker/service_worker_context_wrapper.h"
23 #include "content/browser/service_worker/service_worker_handle.h" 24 #include "content/browser/service_worker/service_worker_handle.h"
24 #include "content/browser/service_worker/service_worker_navigation_handle_core.h " 25 #include "content/browser/service_worker/service_worker_navigation_handle_core.h "
25 #include "content/browser/service_worker/service_worker_registration.h" 26 #include "content/browser/service_worker/service_worker_registration.h"
26 #include "content/browser/service_worker/service_worker_registration_handle.h" 27 #include "content/browser/service_worker/service_worker_registration_handle.h"
27 #include "content/common/service_worker/embedded_worker_messages.h" 28 #include "content/common/service_worker/embedded_worker_messages.h"
28 #include "content/common/service_worker/service_worker_messages.h" 29 #include "content/common/service_worker/service_worker_messages.h"
29 #include "content/common/service_worker/service_worker_types.h" 30 #include "content/common/service_worker/service_worker_types.h"
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 bad_message::ReceivedBadMessage( 825 bad_message::ReceivedBadMessage(
825 this, bad_message::SWDH_SET_HOSTED_VERSION_NO_HOST); 826 this, bad_message::SWDH_SET_HOSTED_VERSION_NO_HOST);
826 return; 827 return;
827 } 828 }
828 if (!provider_host->IsContextAlive()) 829 if (!provider_host->IsContextAlive())
829 return; 830 return;
830 831
831 // We might not be STARTING if the stop sequence was entered (STOPPING) or 832 // We might not be STARTING if the stop sequence was entered (STOPPING) or
832 // ended up being detached (STOPPED). 833 // ended up being detached (STOPPED).
833 ServiceWorkerVersion* version = GetContext()->GetLiveVersion(version_id); 834 ServiceWorkerVersion* version = GetContext()->GetLiveVersion(version_id);
834 if (!version || version->running_status() != ServiceWorkerVersion::STARTING) 835 if (!version || version->running_status() != EmbeddedWorkerStatus::STARTING)
835 return; 836 return;
836 837
837 if (!provider_host->SetHostedVersion(version)) { 838 if (!provider_host->SetHostedVersion(version)) {
838 bad_message::ReceivedBadMessage(this, bad_message::SWDH_SET_HOSTED_VERSION); 839 bad_message::ReceivedBadMessage(this, bad_message::SWDH_SET_HOSTED_VERSION);
839 return; 840 return;
840 } 841 }
841 842
842 // Retrieve the registration associated with |version|. The registration 843 // Retrieve the registration associated with |version|. The registration
843 // must be alive because the version keeps it during starting worker. 844 // must be alive because the version keeps it during starting worker.
844 ServiceWorkerRegistration* registration = 845 ServiceWorkerRegistration* registration =
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 if (!handle) { 1407 if (!handle) {
1407 bad_message::ReceivedBadMessage(this, 1408 bad_message::ReceivedBadMessage(this,
1408 bad_message::SWDH_TERMINATE_BAD_HANDLE); 1409 bad_message::SWDH_TERMINATE_BAD_HANDLE);
1409 return; 1410 return;
1410 } 1411 }
1411 handle->version()->StopWorker( 1412 handle->version()->StopWorker(
1412 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 1413 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
1413 } 1414 }
1414 1415
1415 } // namespace content 1416 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698