| 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 "content/child/background_sync/background_sync_provider.h" | 9 #include "content/child/background_sync/background_sync_provider.h" |
| 10 #include "content/child/background_sync/background_sync_type_converters.h" | 10 #include "content/child/background_sync/background_sync_type_converters.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 int64_t callback_id, | 63 int64_t callback_id, |
| 64 content::BackgroundSyncEventLastChance last_chance, | 64 content::BackgroundSyncEventLastChance last_chance, |
| 65 BackgroundSyncError error, | 65 BackgroundSyncError error, |
| 66 SyncRegistrationPtr registration) { | 66 SyncRegistrationPtr registration) { |
| 67 SyncCallback callback; | 67 SyncCallback callback; |
| 68 auto it = sync_callbacks_.find(callback_id); | 68 auto it = sync_callbacks_.find(callback_id); |
| 69 DCHECK(it != sync_callbacks_.end()); | 69 DCHECK(it != sync_callbacks_.end()); |
| 70 callback = it->second; | 70 callback = it->second; |
| 71 sync_callbacks_.erase(it); | 71 sync_callbacks_.erase(it); |
| 72 | 72 |
| 73 if (error != BACKGROUND_SYNC_ERROR_NONE) { | 73 if (error != BackgroundSyncError::NONE) { |
| 74 callback.Run(SERVICE_WORKER_EVENT_STATUS_ABORTED); | 74 callback.Run(ServiceWorkerEventStatus::ABORTED); |
| 75 return; | 75 return; |
| 76 } | 76 } |
| 77 | 77 |
| 78 ServiceWorkerContextClient* client = | 78 ServiceWorkerContextClient* client = |
| 79 ServiceWorkerContextClient::ThreadSpecificInstance(); | 79 ServiceWorkerContextClient::ThreadSpecificInstance(); |
| 80 if (!client) { | 80 if (!client) { |
| 81 callback.Run(SERVICE_WORKER_EVENT_STATUS_ABORTED); | 81 callback.Run(ServiceWorkerEventStatus::ABORTED); |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 | 84 |
| 85 scoped_ptr<blink::WebSyncRegistration> web_registration = | 85 scoped_ptr<blink::WebSyncRegistration> web_registration = |
| 86 mojo::ConvertTo<scoped_ptr<blink::WebSyncRegistration>>(registration); | 86 mojo::ConvertTo<scoped_ptr<blink::WebSyncRegistration>>(registration); |
| 87 | 87 |
| 88 blink::WebServiceWorkerContextProxy::LastChanceOption web_last_chance = | 88 blink::WebServiceWorkerContextProxy::LastChanceOption web_last_chance = |
| 89 mojo::ConvertTo<blink::WebServiceWorkerContextProxy::LastChanceOption>( | 89 mojo::ConvertTo<blink::WebServiceWorkerContextProxy::LastChanceOption>( |
| 90 last_chance); | 90 last_chance); |
| 91 | 91 |
| 92 client->DispatchSyncEvent(*web_registration, web_last_chance, callback); | 92 client->DispatchSyncEvent(*web_registration, web_last_chance, callback); |
| 93 } | 93 } |
| 94 | 94 |
| 95 } // namespace content | 95 } // namespace content |
| OLD | NEW |