diff options
author | jkarlin <jkarlin@chromium.org> | 2015-07-31 04:27:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-31 11:28:25 +0000 |
commit | 4e6b342de666ba7a2193e35a551df47966bbfdb0 (patch) | |
tree | 47ef8dade08db79de614d6c6345a23ba72f374a1 | |
parent | 26a618e5d798bcdfae7636aa258f6eeda338b8ee (diff) | |
download | chromium_src-4e6b342de666ba7a2193e35a551df47966bbfdb0.zip chromium_src-4e6b342de666ba7a2193e35a551df47966bbfdb0.tar.gz chromium_src-4e6b342de666ba7a2193e35a551df47966bbfdb0.tar.bz2 |
Expose BackgroundSyncContext in StoragePartition
This is needed to get at the BackgroundSyncManager from browser tests.
BUG=514224
Review URL: https://codereview.chromium.org/1265613002
Cr-Commit-Position: refs/heads/master@{#341314}
-rw-r--r-- | chrome/browser/browsing_data/browsing_data_remover_unittest.cc | 4 | ||||
-rw-r--r-- | content/browser/background_sync/background_sync_context_impl.h | 26 | ||||
-rw-r--r-- | content/browser/storage_partition_impl.h | 2 | ||||
-rw-r--r-- | content/content_browser.gypi | 1 | ||||
-rw-r--r-- | content/public/browser/background_sync_context.h | 33 | ||||
-rw-r--r-- | content/public/browser/storage_partition.h | 2 |
6 files changed, 53 insertions, 15 deletions
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc index 8cabe2e..f16f835 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc @@ -168,6 +168,10 @@ class TestStoragePartition : public StoragePartition { return nullptr; } + content::BackgroundSyncContext* GetBackgroundSyncContext() override { + return nullptr; + } + content::HostZoomMap* GetHostZoomMap() override { return NULL; } content::HostZoomLevelContext* GetHostZoomLevelContext() override { return NULL; diff --git a/content/browser/background_sync/background_sync_context_impl.h b/content/browser/background_sync/background_sync_context_impl.h index 4cf3490..861b6d2 100644 --- a/content/browser/background_sync/background_sync_context_impl.h +++ b/content/browser/background_sync/background_sync_context_impl.h @@ -8,35 +8,33 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "content/common/content_export.h" +#include "content/public/browser/background_sync_context.h" namespace content { class BackgroundSyncManager; class ServiceWorkerContextWrapper; -// One instance of this exists per StoragePartition, and services multiple -// child processes/origins. Most logic is delegated to the owned -// BackgroundSyncManager instance, which is only accessed on the IO -// thread. -// TODO(jkarlin): Make a public/ BackgroundSyncContext. -class CONTENT_EXPORT BackgroundSyncContextImpl - : public base::RefCountedThreadSafe<BackgroundSyncContextImpl> { +// Implements the BackgroundSyncContext. One instance of this exists per +// StoragePartition, and services multiple child processes/origins. Most logic +// is delegated to the owned BackgroundSyncManager instance, which is only +// accessed on the IO thread. +class CONTENT_EXPORT BackgroundSyncContextImpl : public BackgroundSyncContext { public: BackgroundSyncContextImpl(); - // Init and Shutdown are for use on the UI thread when the profile, - // storagepartition is being setup and torn down. + // Init and Shutdown are for use on the UI thread when the + // StoragePartition is being setup and torn down. void Init(const scoped_refptr<ServiceWorkerContextWrapper>& context); void Shutdown(); // Only callable on the IO thread. - BackgroundSyncManager* background_sync_manager() const; + BackgroundSyncManager* background_sync_manager() const override; - private: - friend class base::RefCountedThreadSafe<BackgroundSyncContextImpl>; - - ~BackgroundSyncContextImpl(); + protected: + ~BackgroundSyncContextImpl() override; + private: void CreateBackgroundSyncManager( const scoped_refptr<ServiceWorkerContextWrapper>& context); diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h index 0aeb104..57ed7e1 100644 --- a/content/browser/storage_partition_impl.h +++ b/content/browser/storage_partition_impl.h @@ -56,7 +56,7 @@ class StoragePartitionImpl : public StoragePartition { ZoomLevelDelegate* GetZoomLevelDelegate() override; NavigatorConnectContextImpl* GetNavigatorConnectContext() override; PlatformNotificationContextImpl* GetPlatformNotificationContext() override; - BackgroundSyncContextImpl* GetBackgroundSyncContext(); + BackgroundSyncContextImpl* GetBackgroundSyncContext() override; void ClearDataForOrigin(uint32 remove_mask, uint32 quota_storage_remove_mask, diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 1d9cf9a..7c1ba3e 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -79,6 +79,7 @@ 'public/browser/appcache_service.h', 'public/browser/ax_event_notification_details.cc', 'public/browser/ax_event_notification_details.h', + 'public/browser/background_sync_context.h', 'public/browser/background_tracing_config.cc', 'public/browser/background_tracing_config.h', 'public/browser/background_tracing_manager.h', diff --git a/content/public/browser/background_sync_context.h b/content/public/browser/background_sync_context.h new file mode 100644 index 0000000..fb15de0 --- /dev/null +++ b/content/public/browser/background_sync_context.h @@ -0,0 +1,33 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_BROWSER_BACKGROUND_SYNC_CONTEXT_H_ +#define CONTENT_PUBLIC_BROWSER_BACKGROUND_SYNC_CONTEXT_H_ + +#include "base/memory/ref_counted.h" +#include "content/common/content_export.h" + +namespace content { + +class BackgroundSyncManager; + +// One instance of this exists per StoragePartition, and services multiple +// child processes/origins. Most logic is delegated to the owned +// BackgroundSyncManager instance, which is only accessed on the IO +// thread. +class CONTENT_EXPORT BackgroundSyncContext + : public base::RefCountedThreadSafe<BackgroundSyncContext> { + public: + // Only callable on the IO thread. + virtual BackgroundSyncManager* background_sync_manager() const = 0; + + protected: + friend class base::RefCountedThreadSafe<BackgroundSyncContext>; + + virtual ~BackgroundSyncContext() {} +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_BACKGROUND_SYNC_CONTEXT_H_ diff --git a/content/public/browser/storage_partition.h b/content/public/browser/storage_partition.h index 3426a48..dd5a789 100644 --- a/content/public/browser/storage_partition.h +++ b/content/public/browser/storage_partition.h @@ -39,6 +39,7 @@ class DatabaseTracker; namespace content { class AppCacheService; +class BackgroundSyncContext; class BrowserContext; class HostZoomLevelContext; class HostZoomMap; @@ -74,6 +75,7 @@ class CONTENT_EXPORT StoragePartition { virtual ZoomLevelDelegate* GetZoomLevelDelegate() = 0; virtual NavigatorConnectContext* GetNavigatorConnectContext() = 0; virtual PlatformNotificationContext* GetPlatformNotificationContext() = 0; + virtual BackgroundSyncContext* GetBackgroundSyncContext() = 0; static const uint32 REMOVE_DATA_MASK_APPCACHE = 1 << 0; static const uint32 REMOVE_DATA_MASK_COOKIES = 1 << 1; |