| Index: content/browser/background_sync/background_sync_service_impl.cc
|
| diff --git a/content/browser/background_sync/background_sync_service_impl.cc b/content/browser/background_sync/background_sync_service_impl.cc
|
| index 0fb81a464420f5dcbc74dfc328c8f64f95d34c23..5ace41e582cbcde1b908e9dc4aa21c18d75ab8c9 100644
|
| --- a/content/browser/background_sync/background_sync_service_impl.cc
|
| +++ b/content/browser/background_sync/background_sync_service_impl.cc
|
| @@ -86,29 +86,8 @@ COMPILE_ASSERT_MATCHING_ENUM(BACKGROUND_SYNC_PERIODICITY_ONE_SHOT,
|
| COMPILE_ASSERT_MATCHING_ENUM(BACKGROUND_SYNC_PERIODICITY_MAX,
|
| SyncPeriodicity::SYNC_ONE_SHOT);
|
|
|
| -// static
|
| -void BackgroundSyncServiceImpl::Create(
|
| - const scoped_refptr<BackgroundSyncContextImpl>& background_sync_context,
|
| - mojo::InterfaceRequest<BackgroundSyncService> request) {
|
| - DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| - BrowserThread::PostTask(
|
| - BrowserThread::IO, FROM_HERE,
|
| - base::Bind(&BackgroundSyncServiceImpl::CreateOnIOThread,
|
| - background_sync_context, base::Passed(&request)));
|
| -}
|
| -
|
| BackgroundSyncServiceImpl::~BackgroundSyncServiceImpl() {
|
| - // Should always be destroyed on the IO thread, but can't check that with
|
| - // DCHECK_CURRENTLY_ON because this class could be destroyed during thread
|
| - // shutdown, at which point that check doesn't work.
|
| -}
|
| -
|
| -// static
|
| -void BackgroundSyncServiceImpl::CreateOnIOThread(
|
| - const scoped_refptr<BackgroundSyncContextImpl>& background_sync_context,
|
| - mojo::InterfaceRequest<BackgroundSyncService> request) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| - new BackgroundSyncServiceImpl(background_sync_context, request.Pass());
|
| }
|
|
|
| BackgroundSyncServiceImpl::BackgroundSyncServiceImpl(
|
| @@ -118,6 +97,15 @@ BackgroundSyncServiceImpl::BackgroundSyncServiceImpl(
|
| binding_(this, request.Pass()),
|
| weak_ptr_factory_(this) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| +
|
| + binding_.set_connection_error_handler(
|
| + base::Bind(&BackgroundSyncServiceImpl::OnConnectionError,
|
| + base::Unretained(this) /* the channel is owned by this */));
|
| +}
|
| +
|
| +void BackgroundSyncServiceImpl::OnConnectionError() {
|
| + background_sync_context_->ServiceHadConnectionError(this);
|
| + // |this| is now deleted.
|
| }
|
|
|
| void BackgroundSyncServiceImpl::Register(content::SyncRegistrationPtr options,
|
|
|