diff options
author | jkarlin <jkarlin@chromium.org> | 2015-08-13 09:34:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-13 16:35:15 +0000 |
commit | 3440155cd4d8bb061f8261f6e01564804bb9f155 (patch) | |
tree | cf0bd1b90ba308faf41baa0b9872eaba2a9a72ae /content/browser/background_sync/background_sync_service_impl.h | |
parent | b58eaaad66463aba894d5c92589e260245e63de2 (diff) | |
download | chromium_src-3440155cd4d8bb061f8261f6e01564804bb9f155.zip chromium_src-3440155cd4d8bb061f8261f6e01564804bb9f155.tar.gz chromium_src-3440155cd4d8bb061f8261f6e01564804bb9f155.tar.bz2 |
Change ownership of BackgroundSyncServiceImpl to BackgroundSyncContextImpl
Previously BackgroundSyncServiceImpl was deleted by mojo very late on
shutdown (on messageloop destruction). This is way too late. Instead, let the BackgroundSyncContextImpl own them.
BUG=517122
Review URL: https://codereview.chromium.org/1283703003
Cr-Commit-Position: refs/heads/master@{#343215}
Diffstat (limited to 'content/browser/background_sync/background_sync_service_impl.h')
-rw-r--r-- | content/browser/background_sync/background_sync_service_impl.h | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/content/browser/background_sync/background_sync_service_impl.h b/content/browser/background_sync/background_sync_service_impl.h index 6d23ea0..4f8ab3d 100644 --- a/content/browser/background_sync/background_sync_service_impl.h +++ b/content/browser/background_sync/background_sync_service_impl.h @@ -10,7 +10,7 @@ #include "base/memory/ref_counted.h" #include "content/browser/background_sync/background_sync_manager.h" #include "content/common/background_sync_service.mojom.h" -#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" +#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" namespace content { @@ -19,8 +19,8 @@ class BackgroundSyncContextImpl; class CONTENT_EXPORT BackgroundSyncServiceImpl : public NON_EXPORTED_BASE(BackgroundSyncService) { public: - static void Create( - const scoped_refptr<BackgroundSyncContextImpl>& background_sync_context, + BackgroundSyncServiceImpl( + BackgroundSyncContextImpl* background_sync_context, mojo::InterfaceRequest<BackgroundSyncService> request); ~BackgroundSyncServiceImpl() override; @@ -28,13 +28,6 @@ class CONTENT_EXPORT BackgroundSyncServiceImpl private: friend class BackgroundSyncServiceImplTest; - static void CreateOnIOThread( - const scoped_refptr<BackgroundSyncContextImpl>& background_sync_context, - mojo::InterfaceRequest<BackgroundSyncService> request); - - explicit BackgroundSyncServiceImpl( - const scoped_refptr<BackgroundSyncContextImpl>& background_sync_context, - mojo::InterfaceRequest<BackgroundSyncService> request); // BackgroundSyncService methods: void Register(content::SyncRegistrationPtr options, @@ -67,8 +60,13 @@ class CONTENT_EXPORT BackgroundSyncServiceImpl BackgroundSyncStatus status, const std::vector<BackgroundSyncRegistration>& result); - scoped_refptr<BackgroundSyncContextImpl> background_sync_context_; - mojo::StrongBinding<BackgroundSyncService> binding_; + // Called when an error is detected on binding_. + void OnConnectionError(); + + // background_sync_context_ owns this. + BackgroundSyncContextImpl* background_sync_context_; + + mojo::Binding<BackgroundSyncService> binding_; base::WeakPtrFactory<BackgroundSyncServiceImpl> weak_ptr_factory_; |