diff options
Diffstat (limited to 'chromium/content/browser/background_sync')
7 files changed, 35 insertions, 48 deletions
diff --git a/chromium/content/browser/background_sync/background_sync_context_impl.cc b/chromium/content/browser/background_sync/background_sync_context_impl.cc index 17150948e2d..330616aa8d3 100644 --- a/chromium/content/browser/background_sync/background_sync_context_impl.cc +++ b/chromium/content/browser/background_sync/background_sync_context_impl.cc @@ -270,7 +270,7 @@ void BackgroundSyncContextImpl::DidFireBackgroundSyncEventsOnCoreThread( // Use PostTask() rather than RunOrPostTaskOnThread() to ensure the callback // is called asynchronously. - base::PostTask(FROM_HERE, {BrowserThread::UI}, std::move(done_closure)); + GetUIThreadTaskRunner({})->PostTask(FROM_HERE, std::move(done_closure)); } void BackgroundSyncContextImpl::CreateBackgroundSyncManager( diff --git a/chromium/content/browser/background_sync/background_sync_launcher_unittest.cc b/chromium/content/browser/background_sync/background_sync_launcher_unittest.cc index 43db8ad9c64..0258ca8d5b6 100644 --- a/chromium/content/browser/background_sync/background_sync_launcher_unittest.cc +++ b/chromium/content/browser/background_sync/background_sync_launcher_unittest.cc @@ -38,20 +38,14 @@ class TestBrowserClient : public ContentBrowserClient { TestBrowserClient() = default; ~TestBrowserClient() override = default; - void GetStoragePartitionConfigForSite(BrowserContext* browser_context, - const GURL& site, - bool can_be_default, - std::string* partition_domain, - std::string* partition_name, - bool* in_memory) override { + StoragePartitionConfig GetStoragePartitionConfigForSite( + BrowserContext* browser_context, + const GURL& site) override { DCHECK(browser_context); - DCHECK(partition_domain); - DCHECK(partition_name); - auto partition_num = std::to_string(++partition_count_); - *partition_domain = std::string("PartitionDomain") + partition_num; - *partition_name = std::string("Partition") + partition_num; - *in_memory = false; + return StoragePartitionConfig::Create( + std::string("PartitionDomain") + partition_num, + std::string("Partition") + partition_num, false /* in_memory */); } private: diff --git a/chromium/content/browser/background_sync/background_sync_manager.cc b/chromium/content/browser/background_sync/background_sync_manager.cc index 2088219de8a..6ccc1345d3c 100644 --- a/chromium/content/browser/background_sync/background_sync_manager.cc +++ b/chromium/content/browser/background_sync/background_sync_manager.cc @@ -15,7 +15,6 @@ #include "base/memory/ptr_util.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" -#include "base/task/post_task.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/default_clock.h" #include "base/time/time.h" @@ -724,8 +723,8 @@ void BackgroundSyncManager::InitImpl(base::OnceClosure callback) { service_worker_context_, std::make_unique<BackgroundSyncParameters>(*parameters_))); } else { - base::PostTaskAndReplyWithResult( - FROM_HERE, {BrowserThread::UI}, + GetUIThreadTaskRunner({})->PostTaskAndReplyWithResult( + FROM_HERE, base::BindOnce( &GetControllerParameters, service_worker_context_, std::make_unique<BackgroundSyncParameters>(*parameters_)), @@ -916,8 +915,8 @@ void BackgroundSyncManager::RegisterImpl( RegisterDidAskForPermission(sw_registration_id, std::move(options), std::move(callback), permission); } else { - base::PostTaskAndReplyWithResult( - FROM_HERE, {BrowserThread::UI}, + GetUIThreadTaskRunner({})->PostTaskAndReplyWithResult( + FROM_HERE, base::BindOnce( &GetBackgroundSyncPermissionOnUIThread, service_worker_context_, url::Origin::Create(sw_registration->scope().GetOrigin()), @@ -1037,8 +1036,8 @@ void BackgroundSyncManager::RegisterDidAskForPermission( RegisterDidGetDelay(sw_registration_id, registration, std::move(callback), delay); } else { - base::PostTaskAndReplyWithResult( - FROM_HERE, {BrowserThread::UI}, + GetUIThreadTaskRunner({})->PostTaskAndReplyWithResult( + FROM_HERE, base::BindOnce( &GetNextEventDelay, service_worker_context_, registration, std::make_unique<BackgroundSyncParameters>(*parameters_), @@ -1324,8 +1323,8 @@ void BackgroundSyncManager::DidResolveRegistrationImpl( id, CreateBackgroundSyncEventKeepAliveOnUIThread( service_worker_context_, std::move(*registration_info))); } else { - base::PostTaskAndReplyWithResult( - FROM_HERE, {BrowserThread::UI}, + GetUIThreadTaskRunner({})->PostTaskAndReplyWithResult( + FROM_HERE, base::BindOnce(&CreateBackgroundSyncEventKeepAliveOnUIThread, service_worker_context_, std::move(*registration_info)), base::BindOnce( @@ -1866,8 +1865,8 @@ void BackgroundSyncManager::ReviveOriginImpl(url::Origin origin, *registration, received_new_delays_closure, delay); } else { - base::PostTaskAndReplyWithResult( - FROM_HERE, {BrowserThread::UI}, + GetUIThreadTaskRunner({})->PostTaskAndReplyWithResult( + FROM_HERE, base::BindOnce( &GetNextEventDelay, service_worker_context_, *registration, std::make_unique<BackgroundSyncParameters>(*parameters_), @@ -2264,8 +2263,8 @@ void BackgroundSyncManager::EventCompleteImpl( origin, std::move(callback), delay); } else { - base::PostTaskAndReplyWithResult( - FROM_HERE, {BrowserThread::UI}, + GetUIThreadTaskRunner({})->PostTaskAndReplyWithResult( + FROM_HERE, base::BindOnce( &GetNextEventDelay, service_worker_context_, *registration, std::make_unique<BackgroundSyncParameters>(*parameters_), diff --git a/chromium/content/browser/background_sync/background_sync_manager_unittest.cc b/chromium/content/browser/background_sync/background_sync_manager_unittest.cc index 9c68e9a5a9f..096b0a0760b 100644 --- a/chromium/content/browser/background_sync/background_sync_manager_unittest.cc +++ b/chromium/content/browser/background_sync/background_sync_manager_unittest.cc @@ -885,16 +885,16 @@ TEST_F(BackgroundSyncManagerTest, RegistrationIntact) { } TEST_F(BackgroundSyncManagerTest, RegisterWithoutLiveSWRegistration) { - // Get a provider host which is used to install the service worker. + // Get a worker host which is used to install the service worker. ASSERT_TRUE(sw_registration_1_->active_version()); ASSERT_FALSE(sw_registration_1_->waiting_version()); ASSERT_FALSE(sw_registration_1_->installing_version()); - ServiceWorkerProviderHost* provider_host = - sw_registration_1_->active_version()->provider_host(); - ASSERT_TRUE(provider_host); + ServiceWorkerHost* worker_host = + sw_registration_1_->active_version()->worker_host(); + ASSERT_TRUE(worker_host); // Remove the registration object host. - provider_host->container_host()->registration_object_hosts_.clear(); + worker_host->container_host()->registration_object_hosts_.clear(); // Ensure |sw_registration_1_| is the last reference to the registration. ASSERT_TRUE(sw_registration_1_->HasOneRef()); diff --git a/chromium/content/browser/background_sync/background_sync_network_observer.cc b/chromium/content/browser/background_sync/background_sync_network_observer.cc index e735ee8d292..7413334812c 100644 --- a/chromium/content/browser/background_sync/background_sync_network_observer.cc +++ b/chromium/content/browser/background_sync/background_sync_network_observer.cc @@ -6,7 +6,6 @@ #include "base/location.h" #include "base/single_thread_task_runner.h" -#include "base/task/post_task.h" #include "base/threading/thread_task_runner_handle.h" #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/public/browser/browser_task_traits.h" @@ -35,9 +34,8 @@ BackgroundSyncNetworkObserver::BackgroundSyncNetworkObserver( if (ServiceWorkerContext::IsServiceWorkerOnUIEnabled()) { RegisterWithNetworkConnectionTracker(GetNetworkConnectionTracker()); } else { - base::PostTaskAndReplyWithResult( - FROM_HERE, {BrowserThread::UI}, - base::BindOnce(&GetNetworkConnectionTracker), + GetUIThreadTaskRunner({})->PostTaskAndReplyWithResult( + FROM_HERE, base::BindOnce(&GetNetworkConnectionTracker), base::BindOnce(&BackgroundSyncNetworkObserver:: RegisterWithNetworkConnectionTracker, weak_ptr_factory_.GetWeakPtr())); diff --git a/chromium/content/browser/background_sync/background_sync_scheduler_unittest.cc b/chromium/content/browser/background_sync/background_sync_scheduler_unittest.cc index d57492cddca..85cf7d99dec 100644 --- a/chromium/content/browser/background_sync/background_sync_scheduler_unittest.cc +++ b/chromium/content/browser/background_sync/background_sync_scheduler_unittest.cc @@ -38,15 +38,12 @@ class TestBrowserClient : public ContentBrowserClient { TestBrowserClient() = default; ~TestBrowserClient() override = default; - void GetStoragePartitionConfigForSite(BrowserContext* browser_context, - const GURL& site, - bool can_be_default, - std::string* partition_domain, - std::string* partition_name, - bool* in_memory) override { - *partition_domain = "PartitionDomain" + site.spec(); - *partition_name = "Partition" + site.spec(); - *in_memory = false; + StoragePartitionConfig GetStoragePartitionConfigForSite( + BrowserContext* browser_context, + const GURL& site) override { + return content::StoragePartitionConfig::Create( + "PartitionDomain" + site.spec(), "Partition" + site.spec(), + false /* in_memory */); } }; diff --git a/chromium/content/browser/background_sync/background_sync_service_impl_test_harness.cc b/chromium/content/browser/background_sync/background_sync_service_impl_test_harness.cc index 20e01f4af0b..763c37ded8b 100644 --- a/chromium/content/browser/background_sync/background_sync_service_impl_test_harness.cc +++ b/chromium/content/browser/background_sync/background_sync_service_impl_test_harness.cc @@ -20,8 +20,8 @@ #include "content/public/test/mock_permission_manager.h" #include "content/public/test/test_browser_context.h" #include "content/test/test_background_sync_context.h" -#include "mojo/core/embedder/embedder.h" #include "mojo/public/cpp/bindings/interface_ptr.h" +#include "mojo/public/cpp/system/functions.h" #include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom.h" namespace content { @@ -96,7 +96,7 @@ void BackgroundSyncServiceImplTestHarness::SetUp() { // Don't let the tests be confused by the real-world device connectivity background_sync_test_util::SetIgnoreNetworkChanges(true); - mojo::core::SetDefaultProcessErrorCallback(base::AdaptCallbackForRepeating( + mojo::SetDefaultProcessErrorHandler(base::AdaptCallbackForRepeating( base::BindOnce(&BackgroundSyncServiceImplTestHarness::CollectMojoError, base::Unretained(this)))); @@ -122,8 +122,7 @@ void BackgroundSyncServiceImplTestHarness::TearDown() { // Restore the network observer functionality for subsequent tests background_sync_test_util::SetIgnoreNetworkChanges(false); - mojo::core::SetDefaultProcessErrorCallback( - mojo::core::ProcessErrorCallback()); + mojo::SetDefaultProcessErrorHandler(base::NullCallback()); } // SetUp helper methods |