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