| 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 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_CONTEXT_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_CONTEXT_IMPL_H_ |
| 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_CONTEXT_IMPL_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_CONTEXT_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <set> | 9 #include <set> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "content/common/background_sync_service.mojom.h" | 13 #include "content/common/background_sync_service.mojom.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "content/public/browser/background_sync_context.h" | 15 #include "content/public/browser/background_sync_context.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 class BackgroundSyncManager; | 19 class BackgroundSyncManager; |
| 20 class BackgroundSyncServiceImpl; | 20 class BackgroundSyncServiceImpl; |
| 21 class ServiceWorkerContextWrapper; | 21 class ServiceWorkerContextWrapper; |
| 22 | 22 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 44 // be deleted. Call on the IO thread. | 44 // be deleted. Call on the IO thread. |
| 45 void ServiceHadConnectionError(BackgroundSyncServiceImpl* service); | 45 void ServiceHadConnectionError(BackgroundSyncServiceImpl* service); |
| 46 | 46 |
| 47 // Call on the IO thread. | 47 // Call on the IO thread. |
| 48 BackgroundSyncManager* background_sync_manager() const override; | 48 BackgroundSyncManager* background_sync_manager() const override; |
| 49 | 49 |
| 50 protected: | 50 protected: |
| 51 ~BackgroundSyncContextImpl() override; | 51 ~BackgroundSyncContextImpl() override; |
| 52 | 52 |
| 53 void set_background_sync_manager_for_testing( | 53 void set_background_sync_manager_for_testing( |
| 54 scoped_ptr<BackgroundSyncManager> manager); | 54 std::unique_ptr<BackgroundSyncManager> manager); |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 friend class BackgroundSyncServiceImplTest; | 57 friend class BackgroundSyncServiceImplTest; |
| 58 | 58 |
| 59 virtual void CreateBackgroundSyncManager( | 59 virtual void CreateBackgroundSyncManager( |
| 60 scoped_refptr<ServiceWorkerContextWrapper> context); | 60 scoped_refptr<ServiceWorkerContextWrapper> context); |
| 61 | 61 |
| 62 void CreateServiceOnIOThread( | 62 void CreateServiceOnIOThread( |
| 63 mojo::InterfaceRequest<mojom::BackgroundSyncService> request); | 63 mojo::InterfaceRequest<mojom::BackgroundSyncService> request); |
| 64 | 64 |
| 65 void ShutdownOnIO(); | 65 void ShutdownOnIO(); |
| 66 | 66 |
| 67 // Only accessed on the IO thread. | 67 // Only accessed on the IO thread. |
| 68 scoped_ptr<BackgroundSyncManager> background_sync_manager_; | 68 std::unique_ptr<BackgroundSyncManager> background_sync_manager_; |
| 69 | 69 |
| 70 // The services are owned by this. They're either deleted | 70 // The services are owned by this. They're either deleted |
| 71 // during ShutdownOnIO or when the channel is closed via | 71 // during ShutdownOnIO or when the channel is closed via |
| 72 // ServiceHadConnectionError. Only accessed on the IO thread. | 72 // ServiceHadConnectionError. Only accessed on the IO thread. |
| 73 std::set<BackgroundSyncServiceImpl*> services_; | 73 std::set<BackgroundSyncServiceImpl*> services_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncContextImpl); | 75 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncContextImpl); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace content | 78 } // namespace content |
| 79 | 79 |
| 80 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_CONTEXT_IMPL_H_ | 80 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_CONTEXT_IMPL_H_ |
| OLD | NEW |