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

Side by Side Diff: content/renderer/background_sync/background_sync_client_impl.cc

Issue 2490623005: Remove InterfaceRegistry/Provider from service workers (Closed)
Patch Set: rebase/fix comment Created 4 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/renderer/background_sync/background_sync_client_impl.h"
6
7 #include <utility>
8
9 #include "base/time/time.h"
10 #include "content/child/background_sync/background_sync_type_converters.h"
11 #include "content/renderer/service_worker/service_worker_context_client.h"
12 #include "mojo/public/cpp/bindings/strong_binding.h"
13 #include "third_party/WebKit/public/platform/Platform.h"
14 #include "third_party/WebKit/public/platform/WebThread.h"
15 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextProxy.h"
16
17 namespace content {
18
19 // static
20 void BackgroundSyncClientImpl::Create(
21 mojo::InterfaceRequest<blink::mojom::BackgroundSyncServiceClient> request) {
22 mojo::MakeStrongBinding(base::WrapUnique(new BackgroundSyncClientImpl),
23 std::move(request));
24 }
25
26 BackgroundSyncClientImpl::~BackgroundSyncClientImpl() {}
27
28 BackgroundSyncClientImpl::BackgroundSyncClientImpl() {}
29
30 void BackgroundSyncClientImpl::Sync(
31 const std::string& tag,
32 blink::mojom::BackgroundSyncEventLastChance last_chance,
33 const SyncCallback& callback) {
34 DCHECK(!blink::Platform::current()->mainThread()->isCurrentThread());
35
36 ServiceWorkerContextClient* client =
37 ServiceWorkerContextClient::ThreadSpecificInstance();
38 if (!client) {
39 callback.Run(blink::mojom::ServiceWorkerEventStatus::ABORTED,
40 base::Time::Now());
41 return;
42 }
43
44 blink::WebServiceWorkerContextProxy::LastChanceOption web_last_chance =
45 mojo::ConvertTo<blink::WebServiceWorkerContextProxy::LastChanceOption>(
46 last_chance);
47
48 client->DispatchSyncEvent(tag, web_last_chance, callback);
49 }
50
51 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/background_sync/background_sync_client_impl.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698