| OLD | NEW |
| 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 "base/time/time.h" |
| 10 #include "content/child/background_sync/background_sync_type_converters.h" | 10 #include "content/child/background_sync/background_sync_type_converters.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 mojo::InterfaceRequest<blink::mojom::BackgroundSyncServiceClient> request) { | 21 mojo::InterfaceRequest<blink::mojom::BackgroundSyncServiceClient> request) { |
| 22 mojo::MakeStrongBinding(base::WrapUnique(new BackgroundSyncClientImpl), | 22 mojo::MakeStrongBinding(base::WrapUnique(new BackgroundSyncClientImpl), |
| 23 std::move(request)); | 23 std::move(request)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 BackgroundSyncClientImpl::~BackgroundSyncClientImpl() {} | 26 BackgroundSyncClientImpl::~BackgroundSyncClientImpl() {} |
| 27 | 27 |
| 28 BackgroundSyncClientImpl::BackgroundSyncClientImpl() {} | 28 BackgroundSyncClientImpl::BackgroundSyncClientImpl() {} |
| 29 | 29 |
| 30 void BackgroundSyncClientImpl::Sync( | 30 void BackgroundSyncClientImpl::Sync( |
| 31 const mojo::String& tag, | 31 const std::string& tag, |
| 32 blink::mojom::BackgroundSyncEventLastChance last_chance, | 32 blink::mojom::BackgroundSyncEventLastChance last_chance, |
| 33 const SyncCallback& callback) { | 33 const SyncCallback& callback) { |
| 34 DCHECK(!blink::Platform::current()->mainThread()->isCurrentThread()); | 34 DCHECK(!blink::Platform::current()->mainThread()->isCurrentThread()); |
| 35 | 35 |
| 36 ServiceWorkerContextClient* client = | 36 ServiceWorkerContextClient* client = |
| 37 ServiceWorkerContextClient::ThreadSpecificInstance(); | 37 ServiceWorkerContextClient::ThreadSpecificInstance(); |
| 38 if (!client) { | 38 if (!client) { |
| 39 callback.Run(blink::mojom::ServiceWorkerEventStatus::ABORTED, | 39 callback.Run(blink::mojom::ServiceWorkerEventStatus::ABORTED, |
| 40 base::Time::Now()); | 40 base::Time::Now()); |
| 41 return; | 41 return; |
| 42 } | 42 } |
| 43 | 43 |
| 44 blink::WebServiceWorkerContextProxy::LastChanceOption web_last_chance = | 44 blink::WebServiceWorkerContextProxy::LastChanceOption web_last_chance = |
| 45 mojo::ConvertTo<blink::WebServiceWorkerContextProxy::LastChanceOption>( | 45 mojo::ConvertTo<blink::WebServiceWorkerContextProxy::LastChanceOption>( |
| 46 last_chance); | 46 last_chance); |
| 47 | 47 |
| 48 client->DispatchSyncEvent(tag, web_last_chance, callback); | 48 client->DispatchSyncEvent(tag, web_last_chance, callback); |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace content | 51 } // namespace content |
| OLD | NEW |