| 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/browser/background_sync/background_sync_manager.h" | 5 #include "content/browser/background_sync/background_sync_manager.h" |
| 6 | 6 |
| 7 #include "base/barrier_closure.h" | 7 #include "base/barrier_closure.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 9 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 10 #include "content/browser/service_worker/service_worker_storage.h" | 10 #include "content/browser/service_worker/service_worker_storage.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 op_scheduler_.ScheduleOperation(base::Bind( | 67 op_scheduler_.ScheduleOperation(base::Bind( |
| 68 &BackgroundSyncManager::RegisterImpl, weak_ptr_factory_.GetWeakPtr(), | 68 &BackgroundSyncManager::RegisterImpl, weak_ptr_factory_.GetWeakPtr(), |
| 69 origin, sw_registration_id, sync_registration, | 69 origin, sw_registration_id, sync_registration, |
| 70 MakeStatusAndRegistrationCompletion(callback))); | 70 MakeStatusAndRegistrationCompletion(callback))); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void BackgroundSyncManager::Unregister( | 73 void BackgroundSyncManager::Unregister( |
| 74 const GURL& origin, | 74 const GURL& origin, |
| 75 int64 sw_registration_id, | 75 int64 sw_registration_id, |
| 76 const std::string& sync_registration_name, | 76 const std::string& sync_registration_tag, |
| 77 BackgroundSyncRegistration::RegistrationId sync_registration_id, | 77 BackgroundSyncRegistration::RegistrationId sync_registration_id, |
| 78 const StatusCallback& callback) { | 78 const StatusCallback& callback) { |
| 79 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 79 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 80 | 80 |
| 81 if (disabled_) { | 81 if (disabled_) { |
| 82 base::MessageLoop::current()->PostTask( | 82 base::MessageLoop::current()->PostTask( |
| 83 FROM_HERE, base::Bind(callback, ERROR_TYPE_STORAGE)); | 83 FROM_HERE, base::Bind(callback, ERROR_TYPE_STORAGE)); |
| 84 return; | 84 return; |
| 85 } | 85 } |
| 86 | 86 |
| 87 op_scheduler_.ScheduleOperation(base::Bind( | 87 op_scheduler_.ScheduleOperation(base::Bind( |
| 88 &BackgroundSyncManager::UnregisterImpl, weak_ptr_factory_.GetWeakPtr(), | 88 &BackgroundSyncManager::UnregisterImpl, weak_ptr_factory_.GetWeakPtr(), |
| 89 origin, sw_registration_id, sync_registration_name, sync_registration_id, | 89 origin, sw_registration_id, sync_registration_tag, sync_registration_id, |
| 90 MakeStatusCompletion(callback))); | 90 MakeStatusCompletion(callback))); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void BackgroundSyncManager::GetRegistration( | 93 void BackgroundSyncManager::GetRegistration( |
| 94 const GURL& origin, | 94 const GURL& origin, |
| 95 int64 sw_registration_id, | 95 int64 sw_registration_id, |
| 96 const std::string sync_registration_name, | 96 const std::string sync_registration_tag, |
| 97 const StatusAndRegistrationCallback& callback) { | 97 const StatusAndRegistrationCallback& callback) { |
| 98 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 98 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 99 | 99 |
| 100 if (disabled_) { | 100 if (disabled_) { |
| 101 base::MessageLoop::current()->PostTask( | 101 base::MessageLoop::current()->PostTask( |
| 102 FROM_HERE, | 102 FROM_HERE, |
| 103 base::Bind(callback, ERROR_TYPE_STORAGE, BackgroundSyncRegistration())); | 103 base::Bind(callback, ERROR_TYPE_STORAGE, BackgroundSyncRegistration())); |
| 104 return; | 104 return; |
| 105 } | 105 } |
| 106 | 106 |
| 107 op_scheduler_.ScheduleOperation(base::Bind( | 107 op_scheduler_.ScheduleOperation(base::Bind( |
| 108 &BackgroundSyncManager::GetRegistrationImpl, | 108 &BackgroundSyncManager::GetRegistrationImpl, |
| 109 weak_ptr_factory_.GetWeakPtr(), origin, sw_registration_id, | 109 weak_ptr_factory_.GetWeakPtr(), origin, sw_registration_id, |
| 110 sync_registration_name, MakeStatusAndRegistrationCompletion(callback))); | 110 sync_registration_tag, MakeStatusAndRegistrationCompletion(callback))); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void BackgroundSyncManager::OnRegistrationDeleted(int64 registration_id, | 113 void BackgroundSyncManager::OnRegistrationDeleted(int64 registration_id, |
| 114 const GURL& pattern) { | 114 const GURL& pattern) { |
| 115 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 115 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 116 | 116 |
| 117 // Operations already in the queue will either fail when they write to storage | 117 // Operations already in the queue will either fail when they write to storage |
| 118 // or return stale results based on registrations loaded in memory. This is | 118 // or return stale results based on registrations loaded in memory. This is |
| 119 // inconsequential since the service worker is gone. | 119 // inconsequential since the service worker is gone. |
| 120 op_scheduler_.ScheduleOperation(base::Bind( | 120 op_scheduler_.ScheduleOperation(base::Bind( |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 ++i) { | 187 ++i) { |
| 188 const BackgroundSyncRegistrationProto& registration_proto = | 188 const BackgroundSyncRegistrationProto& registration_proto = |
| 189 registrations_proto.registration(i); | 189 registrations_proto.registration(i); |
| 190 | 190 |
| 191 if (registration_proto.id() >= registrations->next_id) { | 191 if (registration_proto.id() >= registrations->next_id) { |
| 192 corruption_detected = true; | 192 corruption_detected = true; |
| 193 break; | 193 break; |
| 194 } | 194 } |
| 195 | 195 |
| 196 BackgroundSyncRegistration* registration = | 196 BackgroundSyncRegistration* registration = |
| 197 ®istrations->name_to_registration_map[registration_proto.name()]; | 197 ®istrations->tag_to_registration_map[registration_proto.tag()]; |
| 198 | 198 |
| 199 registration->id = registration_proto.id(); | 199 registration->id = registration_proto.id(); |
| 200 registration->name = registration_proto.name(); | 200 registration->tag = registration_proto.tag(); |
| 201 registration->fire_once = registration_proto.fire_once(); | 201 registration->fire_once = registration_proto.fire_once(); |
| 202 registration->min_period = registration_proto.min_period(); | 202 registration->min_period = registration_proto.min_period(); |
| 203 registration->network_state = registration_proto.network_state(); | 203 registration->network_state = registration_proto.network_state(); |
| 204 registration->power_state = registration_proto.power_state(); | 204 registration->power_state = registration_proto.power_state(); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 if (corruption_detected) | 208 if (corruption_detected) |
| 209 break; | 209 break; |
| 210 } | 210 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 226 const BackgroundSyncRegistration& sync_registration, | 226 const BackgroundSyncRegistration& sync_registration, |
| 227 const StatusAndRegistrationCallback& callback) { | 227 const StatusAndRegistrationCallback& callback) { |
| 228 if (disabled_) { | 228 if (disabled_) { |
| 229 base::MessageLoop::current()->PostTask( | 229 base::MessageLoop::current()->PostTask( |
| 230 FROM_HERE, | 230 FROM_HERE, |
| 231 base::Bind(callback, ERROR_TYPE_STORAGE, BackgroundSyncRegistration())); | 231 base::Bind(callback, ERROR_TYPE_STORAGE, BackgroundSyncRegistration())); |
| 232 return; | 232 return; |
| 233 } | 233 } |
| 234 | 234 |
| 235 BackgroundSyncRegistration existing_registration; | 235 BackgroundSyncRegistration existing_registration; |
| 236 if (LookupRegistration(sw_registration_id, sync_registration.name, | 236 if (LookupRegistration(sw_registration_id, sync_registration.tag, |
| 237 &existing_registration)) { | 237 &existing_registration)) { |
| 238 if (existing_registration.Equals(sync_registration)) { | 238 if (existing_registration.Equals(sync_registration)) { |
| 239 base::MessageLoop::current()->PostTask( | 239 base::MessageLoop::current()->PostTask( |
| 240 FROM_HERE, | 240 FROM_HERE, |
| 241 base::Bind(callback, ERROR_TYPE_OK, existing_registration)); | 241 base::Bind(callback, ERROR_TYPE_OK, existing_registration)); |
| 242 return; | 242 return; |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 | 245 |
| 246 BackgroundSyncRegistration new_registration = sync_registration; | 246 BackgroundSyncRegistration new_registration = sync_registration; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 void BackgroundSyncManager::DisableAndClearManagerClearedOne( | 299 void BackgroundSyncManager::DisableAndClearManagerClearedOne( |
| 300 const base::Closure& barrier_closure, | 300 const base::Closure& barrier_closure, |
| 301 ServiceWorkerStatusCode status) { | 301 ServiceWorkerStatusCode status) { |
| 302 // The status doesn't matter at this point, there is nothing else to be done. | 302 // The status doesn't matter at this point, there is nothing else to be done. |
| 303 base::MessageLoop::current()->PostTask(FROM_HERE, | 303 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 304 base::Bind(barrier_closure)); | 304 base::Bind(barrier_closure)); |
| 305 } | 305 } |
| 306 | 306 |
| 307 bool BackgroundSyncManager::LookupRegistration( | 307 bool BackgroundSyncManager::LookupRegistration( |
| 308 int64 sw_registration_id, | 308 int64 sw_registration_id, |
| 309 const std::string& sync_registration_name, | 309 const std::string& sync_registration_tag, |
| 310 BackgroundSyncRegistration* existing_registration) { | 310 BackgroundSyncRegistration* existing_registration) { |
| 311 SWIdToRegistrationsMap::iterator it = | 311 SWIdToRegistrationsMap::iterator it = |
| 312 sw_to_registrations_map_.find(sw_registration_id); | 312 sw_to_registrations_map_.find(sw_registration_id); |
| 313 if (it == sw_to_registrations_map_.end()) | 313 if (it == sw_to_registrations_map_.end()) |
| 314 return false; | 314 return false; |
| 315 | 315 |
| 316 const BackgroundSyncRegistrations& registrations = it->second; | 316 const BackgroundSyncRegistrations& registrations = it->second; |
| 317 const auto name_and_registration_iter = | 317 const auto tag_and_registration_iter = |
| 318 registrations.name_to_registration_map.find(sync_registration_name); | 318 registrations.tag_to_registration_map.find(sync_registration_tag); |
| 319 if (name_and_registration_iter == | 319 if (tag_and_registration_iter == registrations.tag_to_registration_map.end()) |
| 320 registrations.name_to_registration_map.end()) | |
| 321 return false; | 320 return false; |
| 322 | 321 |
| 323 if (existing_registration) | 322 if (existing_registration) |
| 324 *existing_registration = name_and_registration_iter->second; | 323 *existing_registration = tag_and_registration_iter->second; |
| 325 | 324 |
| 326 return true; | 325 return true; |
| 327 } | 326 } |
| 328 | 327 |
| 329 void BackgroundSyncManager::StoreRegistrations( | 328 void BackgroundSyncManager::StoreRegistrations( |
| 330 const GURL& origin, | 329 const GURL& origin, |
| 331 int64 sw_registration_id, | 330 int64 sw_registration_id, |
| 332 const ServiceWorkerStorage::StatusCallback& callback) { | 331 const ServiceWorkerStorage::StatusCallback& callback) { |
| 333 // Serialize the data. | 332 // Serialize the data. |
| 334 const BackgroundSyncRegistrations& registrations = | 333 const BackgroundSyncRegistrations& registrations = |
| 335 sw_to_registrations_map_[sw_registration_id]; | 334 sw_to_registrations_map_[sw_registration_id]; |
| 336 BackgroundSyncRegistrationsProto registrations_proto; | 335 BackgroundSyncRegistrationsProto registrations_proto; |
| 337 registrations_proto.set_next_registration_id(registrations.next_id); | 336 registrations_proto.set_next_registration_id(registrations.next_id); |
| 338 | 337 |
| 339 for (const auto& name_and_registration : | 338 for (const auto& tag_and_registration : |
| 340 registrations.name_to_registration_map) { | 339 registrations.tag_to_registration_map) { |
| 341 const BackgroundSyncRegistration& registration = | 340 const BackgroundSyncRegistration& registration = |
| 342 name_and_registration.second; | 341 tag_and_registration.second; |
| 343 BackgroundSyncRegistrationProto* registration_proto = | 342 BackgroundSyncRegistrationProto* registration_proto = |
| 344 registrations_proto.add_registration(); | 343 registrations_proto.add_registration(); |
| 345 registration_proto->set_id(registration.id); | 344 registration_proto->set_id(registration.id); |
| 346 registration_proto->set_name(registration.name); | 345 registration_proto->set_tag(registration.tag); |
| 347 registration_proto->set_fire_once(registration.fire_once); | 346 registration_proto->set_fire_once(registration.fire_once); |
| 348 registration_proto->set_min_period(registration.min_period); | 347 registration_proto->set_min_period(registration.min_period); |
| 349 registration_proto->set_network_state(registration.network_state); | 348 registration_proto->set_network_state(registration.network_state); |
| 350 registration_proto->set_power_state(registration.power_state); | 349 registration_proto->set_power_state(registration.power_state); |
| 351 } | 350 } |
| 352 std::string serialized; | 351 std::string serialized; |
| 353 bool success = registrations_proto.SerializeToString(&serialized); | 352 bool success = registrations_proto.SerializeToString(&serialized); |
| 354 DCHECK(success); | 353 DCHECK(success); |
| 355 | 354 |
| 356 StoreDataInBackend(sw_registration_id, origin, kBackgroundSyncUserDataKey, | 355 StoreDataInBackend(sw_registration_id, origin, kBackgroundSyncUserDataKey, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 379 return; | 378 return; |
| 380 } | 379 } |
| 381 | 380 |
| 382 // TODO(jkarlin): Run the registration algorithm. | 381 // TODO(jkarlin): Run the registration algorithm. |
| 383 base::MessageLoop::current()->PostTask( | 382 base::MessageLoop::current()->PostTask( |
| 384 FROM_HERE, base::Bind(callback, ERROR_TYPE_OK, new_registration)); | 383 FROM_HERE, base::Bind(callback, ERROR_TYPE_OK, new_registration)); |
| 385 } | 384 } |
| 386 | 385 |
| 387 void BackgroundSyncManager::RemoveRegistrationFromMap( | 386 void BackgroundSyncManager::RemoveRegistrationFromMap( |
| 388 int64 sw_registration_id, | 387 int64 sw_registration_id, |
| 389 const std::string& sync_registration_name) { | 388 const std::string& sync_registration_tag) { |
| 390 DCHECK( | 389 DCHECK( |
| 391 LookupRegistration(sw_registration_id, sync_registration_name, nullptr)); | 390 LookupRegistration(sw_registration_id, sync_registration_tag, nullptr)); |
| 392 | 391 |
| 393 BackgroundSyncRegistrations* registrations = | 392 BackgroundSyncRegistrations* registrations = |
| 394 &sw_to_registrations_map_[sw_registration_id]; | 393 &sw_to_registrations_map_[sw_registration_id]; |
| 395 | 394 |
| 396 registrations->name_to_registration_map.erase(sync_registration_name); | 395 registrations->tag_to_registration_map.erase(sync_registration_tag); |
| 397 } | 396 } |
| 398 | 397 |
| 399 void BackgroundSyncManager::AddRegistrationToMap( | 398 void BackgroundSyncManager::AddRegistrationToMap( |
| 400 int64 sw_registration_id, | 399 int64 sw_registration_id, |
| 401 const BackgroundSyncRegistration& sync_registration) { | 400 const BackgroundSyncRegistration& sync_registration) { |
| 402 DCHECK_NE(BackgroundSyncRegistration::kInvalidRegistrationId, | 401 DCHECK_NE(BackgroundSyncRegistration::kInvalidRegistrationId, |
| 403 sw_registration_id); | 402 sw_registration_id); |
| 404 | 403 |
| 405 BackgroundSyncRegistrations* registrations = | 404 BackgroundSyncRegistrations* registrations = |
| 406 &sw_to_registrations_map_[sw_registration_id]; | 405 &sw_to_registrations_map_[sw_registration_id]; |
| 407 registrations->name_to_registration_map[sync_registration.name] = | 406 registrations->tag_to_registration_map[sync_registration.tag] = |
| 408 sync_registration; | 407 sync_registration; |
| 409 } | 408 } |
| 410 | 409 |
| 411 void BackgroundSyncManager::StoreDataInBackend( | 410 void BackgroundSyncManager::StoreDataInBackend( |
| 412 int64 sw_registration_id, | 411 int64 sw_registration_id, |
| 413 const GURL& origin, | 412 const GURL& origin, |
| 414 const std::string& key, | 413 const std::string& key, |
| 415 const std::string& data, | 414 const std::string& data, |
| 416 const ServiceWorkerStorage::StatusCallback& callback) { | 415 const ServiceWorkerStorage::StatusCallback& callback) { |
| 417 service_worker_context_->context()->storage()->StoreUserData( | 416 service_worker_context_->context()->storage()->StoreUserData( |
| 418 sw_registration_id, origin, key, data, callback); | 417 sw_registration_id, origin, key, data, callback); |
| 419 } | 418 } |
| 420 | 419 |
| 421 void BackgroundSyncManager::GetDataFromBackend( | 420 void BackgroundSyncManager::GetDataFromBackend( |
| 422 const std::string& key, | 421 const std::string& key, |
| 423 const ServiceWorkerStorage::GetUserDataForAllRegistrationsCallback& | 422 const ServiceWorkerStorage::GetUserDataForAllRegistrationsCallback& |
| 424 callback) { | 423 callback) { |
| 425 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 424 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 426 | 425 |
| 427 service_worker_context_->context()->storage()->GetUserDataForAllRegistrations( | 426 service_worker_context_->context()->storage()->GetUserDataForAllRegistrations( |
| 428 key, callback); | 427 key, callback); |
| 429 } | 428 } |
| 430 | 429 |
| 431 void BackgroundSyncManager::UnregisterImpl( | 430 void BackgroundSyncManager::UnregisterImpl( |
| 432 const GURL& origin, | 431 const GURL& origin, |
| 433 int64 sw_registration_id, | 432 int64 sw_registration_id, |
| 434 const std::string& sync_registration_name, | 433 const std::string& sync_registration_tag, |
| 435 BackgroundSyncRegistration::RegistrationId sync_registration_id, | 434 BackgroundSyncRegistration::RegistrationId sync_registration_id, |
| 436 const StatusCallback& callback) { | 435 const StatusCallback& callback) { |
| 437 if (disabled_) { | 436 if (disabled_) { |
| 438 base::MessageLoop::current()->PostTask( | 437 base::MessageLoop::current()->PostTask( |
| 439 FROM_HERE, base::Bind(callback, ERROR_TYPE_STORAGE)); | 438 FROM_HERE, base::Bind(callback, ERROR_TYPE_STORAGE)); |
| 440 return; | 439 return; |
| 441 } | 440 } |
| 442 | 441 |
| 443 BackgroundSyncRegistration existing_registration; | 442 BackgroundSyncRegistration existing_registration; |
| 444 if (!LookupRegistration(sw_registration_id, sync_registration_name, | 443 if (!LookupRegistration(sw_registration_id, sync_registration_tag, |
| 445 &existing_registration) || | 444 &existing_registration) || |
| 446 existing_registration.id != sync_registration_id) { | 445 existing_registration.id != sync_registration_id) { |
| 447 base::MessageLoop::current()->PostTask( | 446 base::MessageLoop::current()->PostTask( |
| 448 FROM_HERE, base::Bind(callback, ERROR_TYPE_NOT_FOUND)); | 447 FROM_HERE, base::Bind(callback, ERROR_TYPE_NOT_FOUND)); |
| 449 return; | 448 return; |
| 450 } | 449 } |
| 451 | 450 |
| 452 RemoveRegistrationFromMap(sw_registration_id, sync_registration_name); | 451 RemoveRegistrationFromMap(sw_registration_id, sync_registration_tag); |
| 453 | 452 |
| 454 StoreRegistrations( | 453 StoreRegistrations( |
| 455 origin, sw_registration_id, | 454 origin, sw_registration_id, |
| 456 base::Bind(&BackgroundSyncManager::UnregisterDidStore, | 455 base::Bind(&BackgroundSyncManager::UnregisterDidStore, |
| 457 weak_ptr_factory_.GetWeakPtr(), sw_registration_id, callback)); | 456 weak_ptr_factory_.GetWeakPtr(), sw_registration_id, callback)); |
| 458 } | 457 } |
| 459 | 458 |
| 460 void BackgroundSyncManager::UnregisterDidStore( | 459 void BackgroundSyncManager::UnregisterDidStore( |
| 461 int64 sw_registration_id, | 460 int64 sw_registration_id, |
| 462 const StatusCallback& callback, | 461 const StatusCallback& callback, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 476 } | 475 } |
| 477 | 476 |
| 478 // TODO(jkarlin): Run the registration algorithm. | 477 // TODO(jkarlin): Run the registration algorithm. |
| 479 base::MessageLoop::current()->PostTask(FROM_HERE, | 478 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 480 base::Bind(callback, ERROR_TYPE_OK)); | 479 base::Bind(callback, ERROR_TYPE_OK)); |
| 481 } | 480 } |
| 482 | 481 |
| 483 void BackgroundSyncManager::GetRegistrationImpl( | 482 void BackgroundSyncManager::GetRegistrationImpl( |
| 484 const GURL& origin, | 483 const GURL& origin, |
| 485 int64 sw_registration_id, | 484 int64 sw_registration_id, |
| 486 const std::string sync_registration_name, | 485 const std::string sync_registration_tag, |
| 487 const StatusAndRegistrationCallback& callback) { | 486 const StatusAndRegistrationCallback& callback) { |
| 488 if (disabled_) { | 487 if (disabled_) { |
| 489 base::MessageLoop::current()->PostTask( | 488 base::MessageLoop::current()->PostTask( |
| 490 FROM_HERE, | 489 FROM_HERE, |
| 491 base::Bind(callback, ERROR_TYPE_STORAGE, BackgroundSyncRegistration())); | 490 base::Bind(callback, ERROR_TYPE_STORAGE, BackgroundSyncRegistration())); |
| 492 return; | 491 return; |
| 493 } | 492 } |
| 494 | 493 |
| 495 BackgroundSyncRegistration out_registration; | 494 BackgroundSyncRegistration out_registration; |
| 496 if (!LookupRegistration(sw_registration_id, sync_registration_name, | 495 if (!LookupRegistration(sw_registration_id, sync_registration_tag, |
| 497 &out_registration)) { | 496 &out_registration)) { |
| 498 base::MessageLoop::current()->PostTask( | 497 base::MessageLoop::current()->PostTask( |
| 499 FROM_HERE, base::Bind(callback, ERROR_TYPE_NOT_FOUND, | 498 FROM_HERE, base::Bind(callback, ERROR_TYPE_NOT_FOUND, |
| 500 BackgroundSyncRegistration())); | 499 BackgroundSyncRegistration())); |
| 501 return; | 500 return; |
| 502 } | 501 } |
| 503 | 502 |
| 504 base::MessageLoop::current()->PostTask( | 503 base::MessageLoop::current()->PostTask( |
| 505 FROM_HERE, base::Bind(callback, ERROR_TYPE_OK, out_registration)); | 504 FROM_HERE, base::Bind(callback, ERROR_TYPE_OK, out_registration)); |
| 506 } | 505 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 weak_ptr_factory_.GetWeakPtr(), callback); | 562 weak_ptr_factory_.GetWeakPtr(), callback); |
| 564 } | 563 } |
| 565 | 564 |
| 566 BackgroundSyncManager::StatusCallback | 565 BackgroundSyncManager::StatusCallback |
| 567 BackgroundSyncManager::MakeStatusCompletion(const StatusCallback& callback) { | 566 BackgroundSyncManager::MakeStatusCompletion(const StatusCallback& callback) { |
| 568 return base::Bind(&BackgroundSyncManager::PendingStatusCallback, | 567 return base::Bind(&BackgroundSyncManager::PendingStatusCallback, |
| 569 weak_ptr_factory_.GetWeakPtr(), callback); | 568 weak_ptr_factory_.GetWeakPtr(), callback); |
| 570 } | 569 } |
| 571 | 570 |
| 572 } // namespace content | 571 } // namespace content |
| OLD | NEW |