Commit 6d6b0340 authored by Victor Costan's avatar Victor Costan Committed by Commit Bot

Background Sync: Use 1-based ref-counting with BackgroundSyncContext.

TBR: jam
Change-Id: I205f31a13db8b5bb990627c190a9c4d8c2cb156f
Reviewed-on: https://chromium-review.googlesource.com/1055204
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarJosh Karlin <jkarlin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557929}
parent 919e495a
...@@ -25,6 +25,8 @@ class ServiceWorkerContextWrapper; ...@@ -25,6 +25,8 @@ class ServiceWorkerContextWrapper;
class CONTENT_EXPORT BackgroundSyncContext class CONTENT_EXPORT BackgroundSyncContext
: public base::RefCountedDeleteOnSequence<BackgroundSyncContext> { : public base::RefCountedDeleteOnSequence<BackgroundSyncContext> {
public: public:
REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE();
BackgroundSyncContext(); BackgroundSyncContext();
// Init and Shutdown are for use on the UI thread when the // Init and Shutdown are for use on the UI thread when the
......
...@@ -142,7 +142,8 @@ class BackgroundSyncServiceImplTest : public testing::Test { ...@@ -142,7 +142,8 @@ class BackgroundSyncServiceImplTest : public testing::Test {
void CreateBackgroundSyncContext() { void CreateBackgroundSyncContext() {
// Registering for background sync includes a check for having a same-origin // Registering for background sync includes a check for having a same-origin
// main frame. Use a test context that allows control over that check. // main frame. Use a test context that allows control over that check.
background_sync_context_ = new TestBackgroundSyncContext(); background_sync_context_ =
base::MakeRefCounted<TestBackgroundSyncContext>();
background_sync_context_->Init(embedded_worker_helper_->context_wrapper()); background_sync_context_->Init(embedded_worker_helper_->context_wrapper());
// Tests do not expect the sync event to fire immediately after // Tests do not expect the sync event to fire immediately after
......
...@@ -628,7 +628,8 @@ std::unique_ptr<StoragePartitionImpl> StoragePartitionImpl::Create( ...@@ -628,7 +628,8 @@ std::unique_ptr<StoragePartitionImpl> StoragePartitionImpl::Create(
partition->background_fetch_context_ = partition->background_fetch_context_ =
new BackgroundFetchContext(context, partition->service_worker_context_); new BackgroundFetchContext(context, partition->service_worker_context_);
partition->background_sync_context_ = new BackgroundSyncContext(); partition->background_sync_context_ =
base::MakeRefCounted<BackgroundSyncContext>();
partition->background_sync_context_->Init(partition->service_worker_context_); partition->background_sync_context_->Init(partition->service_worker_context_);
partition->payment_app_context_ = new PaymentAppContextImpl(); partition->payment_app_context_ = new PaymentAppContextImpl();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment