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/child/background_sync/background_sync_provider.h" | 5 #include "content/child/background_sync/background_sync_provider.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 // base::Unretained is safe here, as the mojo channel will be deleted (and | 118 // base::Unretained is safe here, as the mojo channel will be deleted (and |
119 // will wipe its callbacks) before 'this' is deleted. | 119 // will wipe its callbacks) before 'this' is deleted. |
120 GetBackgroundSyncServicePtr()->GetRegistrations( | 120 GetBackgroundSyncServicePtr()->GetRegistrations( |
121 service_worker_registration_id, | 121 service_worker_registration_id, |
122 base::Bind(&BackgroundSyncProvider::GetRegistrationsCallback, | 122 base::Bind(&BackgroundSyncProvider::GetRegistrationsCallback, |
123 base::Unretained(this), | 123 base::Unretained(this), |
124 base::Passed(std::move(callbacksPtr)))); | 124 base::Passed(std::move(callbacksPtr)))); |
125 } | 125 } |
126 | 126 |
127 void BackgroundSyncProvider::releaseRegistration(int64_t handle_id) { | |
128 GetBackgroundSyncServicePtr()->ReleaseRegistration(handle_id); | |
129 } | |
130 | |
131 void BackgroundSyncProvider::DuplicateRegistrationHandle( | |
132 int64_t handle_id, | |
133 const BackgroundSyncService::DuplicateRegistrationHandleCallback& | |
134 callback) { | |
135 GetBackgroundSyncServicePtr()->DuplicateRegistrationHandle(handle_id, | |
136 callback); | |
137 } | |
138 | |
139 void BackgroundSyncProvider::WillStopCurrentWorkerThread() { | 127 void BackgroundSyncProvider::WillStopCurrentWorkerThread() { |
140 delete this; | 128 delete this; |
141 } | 129 } |
142 | 130 |
143 void BackgroundSyncProvider::RegisterCallback( | 131 void BackgroundSyncProvider::RegisterCallback( |
144 scoped_ptr<blink::WebSyncRegistrationCallbacks> callbacks, | 132 scoped_ptr<blink::WebSyncRegistrationCallbacks> callbacks, |
145 BackgroundSyncError error, | 133 BackgroundSyncError error, |
146 const SyncRegistrationPtr& options) { | 134 const SyncRegistrationPtr& options) { |
147 // TODO(iclelland): Determine the correct error message to return in each case | 135 // TODO(iclelland): Determine the correct error message to return in each case |
148 scoped_ptr<blink::WebSyncRegistration> result; | 136 scoped_ptr<blink::WebSyncRegistration> result; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 mojo::InterfaceRequest<BackgroundSyncService> request = | 205 mojo::InterfaceRequest<BackgroundSyncService> request = |
218 mojo::GetProxy(&background_sync_service_); | 206 mojo::GetProxy(&background_sync_service_); |
219 main_thread_task_runner_->PostTask( | 207 main_thread_task_runner_->PostTask( |
220 FROM_HERE, | 208 FROM_HERE, |
221 base::Bind(&ConnectToServiceOnMainThread, base::Passed(&request))); | 209 base::Bind(&ConnectToServiceOnMainThread, base::Passed(&request))); |
222 } | 210 } |
223 return background_sync_service_; | 211 return background_sync_service_; |
224 } | 212 } |
225 | 213 |
226 } // namespace content | 214 } // namespace content |
OLD | NEW |