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

Side by Side Diff: content/browser/background_sync/background_sync_manager.cc

Issue 2218943002: Introduce ServiceWorker.EventDispatchingDelay UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated mpearson@'s comment Created 4 years, 4 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
« no previous file with comments | « no previous file | content/browser/service_worker/embedded_worker_test_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/background_sync/background_sync_manager.h" 5 #include "content/browser/background_sync/background_sync_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/barrier_closure.h" 9 #include "base/barrier_closure.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
15 #include "base/time/default_clock.h" 15 #include "base/time/default_clock.h"
16 #include "base/time/time.h"
16 #include "build/build_config.h" 17 #include "build/build_config.h"
17 #include "content/browser/background_sync/background_sync_metrics.h" 18 #include "content/browser/background_sync/background_sync_metrics.h"
18 #include "content/browser/background_sync/background_sync_network_observer.h" 19 #include "content/browser/background_sync/background_sync_network_observer.h"
19 #include "content/browser/background_sync/background_sync_registration_options.h " 20 #include "content/browser/background_sync/background_sync_registration_options.h "
20 #include "content/browser/service_worker/embedded_worker_status.h" 21 #include "content/browser/service_worker/embedded_worker_status.h"
21 #include "content/browser/service_worker/service_worker_context_wrapper.h" 22 #include "content/browser/service_worker/service_worker_context_wrapper.h"
22 #include "content/browser/service_worker/service_worker_storage.h" 23 #include "content/browser/service_worker/service_worker_storage.h"
23 #include "content/browser/storage_partition_impl.h" 24 #include "content/browser/storage_partition_impl.h"
24 #include "content/common/service_worker/service_worker_type_converters.h" 25 #include "content/common/service_worker/service_worker_type_converters.h"
25 #include "content/public/browser/background_sync_controller.h" 26 #include "content/public/browser/background_sync_controller.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 return parameters; 143 return parameters;
143 } 144 }
144 145
145 background_sync_controller->GetParameterOverrides(parameters.get()); 146 background_sync_controller->GetParameterOverrides(parameters.get());
146 return parameters; 147 return parameters;
147 } 148 }
148 149
149 void OnSyncEventFinished(scoped_refptr<ServiceWorkerVersion> active_version, 150 void OnSyncEventFinished(scoped_refptr<ServiceWorkerVersion> active_version,
150 int request_id, 151 int request_id,
151 const ServiceWorkerVersion::StatusCallback& callback, 152 const ServiceWorkerVersion::StatusCallback& callback,
152 blink::mojom::ServiceWorkerEventStatus status) { 153 blink::mojom::ServiceWorkerEventStatus status,
154 double dispatch_event_time) {
153 if (!active_version->FinishRequest( 155 if (!active_version->FinishRequest(
154 request_id, 156 request_id,
155 status == blink::mojom::ServiceWorkerEventStatus::COMPLETED)) { 157 status == blink::mojom::ServiceWorkerEventStatus::COMPLETED,
158 base::Time::FromDoubleT(dispatch_event_time))) {
156 return; 159 return;
157 } 160 }
158 callback.Run(mojo::ConvertTo<ServiceWorkerStatusCode>(status)); 161 callback.Run(mojo::ConvertTo<ServiceWorkerStatusCode>(status));
159 } 162 }
160 163
161 } // namespace 164 } // namespace
162 165
163 BackgroundSyncManager::BackgroundSyncRegistrations:: 166 BackgroundSyncManager::BackgroundSyncRegistrations::
164 BackgroundSyncRegistrations() 167 BackgroundSyncRegistrations()
165 : next_id(BackgroundSyncRegistration::kInitialId) { 168 : next_id(BackgroundSyncRegistration::kInitialId) {
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 parameters_->max_sync_attempts = max_attempts; 1191 parameters_->max_sync_attempts = max_attempts;
1189 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); 1192 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback);
1190 } 1193 }
1191 1194
1192 base::Closure BackgroundSyncManager::MakeEmptyCompletion() { 1195 base::Closure BackgroundSyncManager::MakeEmptyCompletion() {
1193 DCHECK_CURRENTLY_ON(BrowserThread::IO); 1196 DCHECK_CURRENTLY_ON(BrowserThread::IO);
1194 return op_scheduler_.WrapCallbackToRunNext(base::Bind(&base::DoNothing)); 1197 return op_scheduler_.WrapCallbackToRunNext(base::Bind(&base::DoNothing));
1195 } 1198 }
1196 1199
1197 } // namespace content 1200 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/embedded_worker_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698