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

Side by Side Diff: content/renderer/background_sync/background_sync_client_impl.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
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/renderer/background_sync/background_sync_client_impl.h" 5 #include "content/renderer/background_sync/background_sync_client_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/time/time.h"
9 #include "content/child/background_sync/background_sync_provider.h" 10 #include "content/child/background_sync/background_sync_provider.h"
10 #include "content/child/background_sync/background_sync_type_converters.h" 11 #include "content/child/background_sync/background_sync_type_converters.h"
11 #include "content/renderer/service_worker/service_worker_context_client.h" 12 #include "content/renderer/service_worker/service_worker_context_client.h"
12 #include "third_party/WebKit/public/platform/Platform.h" 13 #include "third_party/WebKit/public/platform/Platform.h"
13 #include "third_party/WebKit/public/platform/WebThread.h" 14 #include "third_party/WebKit/public/platform/WebThread.h"
14 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncProv ider.h" 15 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncProv ider.h"
15 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi stration.h" 16 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi stration.h"
16 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextProxy.h" 17 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextProxy.h"
17 18
18 namespace content { 19 namespace content {
(...skipping 12 matching lines...) Expand all
31 32
32 void BackgroundSyncClientImpl::Sync( 33 void BackgroundSyncClientImpl::Sync(
33 const mojo::String& tag, 34 const mojo::String& tag,
34 blink::mojom::BackgroundSyncEventLastChance last_chance, 35 blink::mojom::BackgroundSyncEventLastChance last_chance,
35 const SyncCallback& callback) { 36 const SyncCallback& callback) {
36 DCHECK(!blink::Platform::current()->mainThread()->isCurrentThread()); 37 DCHECK(!blink::Platform::current()->mainThread()->isCurrentThread());
37 38
38 ServiceWorkerContextClient* client = 39 ServiceWorkerContextClient* client =
39 ServiceWorkerContextClient::ThreadSpecificInstance(); 40 ServiceWorkerContextClient::ThreadSpecificInstance();
40 if (!client) { 41 if (!client) {
41 callback.Run(blink::mojom::ServiceWorkerEventStatus::ABORTED); 42 callback.Run(blink::mojom::ServiceWorkerEventStatus::ABORTED,
43 base::Time::Now().ToDoubleT());
42 return; 44 return;
43 } 45 }
44 46
45 blink::WebServiceWorkerContextProxy::LastChanceOption web_last_chance = 47 blink::WebServiceWorkerContextProxy::LastChanceOption web_last_chance =
46 mojo::ConvertTo<blink::WebServiceWorkerContextProxy::LastChanceOption>( 48 mojo::ConvertTo<blink::WebServiceWorkerContextProxy::LastChanceOption>(
47 last_chance); 49 last_chance);
48 50
49 client->DispatchSyncEvent(tag, web_last_chance, callback); 51 client->DispatchSyncEvent(tag, web_last_chance, callback);
50 } 52 }
51 53
52 } // namespace content 54 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698