Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Unified Diff: content/browser/background_sync/background_sync_manager.cc

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/background_sync/background_sync_manager.cc
diff --git a/content/browser/background_sync/background_sync_manager.cc b/content/browser/background_sync/background_sync_manager.cc
index 343dd05a4a4a6f4be17a697858b9c32477a3340d..097b9b890838c85f3c6329d8229575f0b2cdc0f1 100644
--- a/content/browser/background_sync/background_sync_manager.cc
+++ b/content/browser/background_sync/background_sync_manager.cc
@@ -9,6 +9,7 @@
#include "base/barrier_closure.h"
#include "base/bind.h"
#include "base/location.h"
+#include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "base/time/default_clock.h"
@@ -46,7 +47,7 @@ void RecordFailureAndPostError(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(callback, status,
- base::Passed(scoped_ptr<BackgroundSyncRegistration>())));
+ base::Passed(std::unique_ptr<BackgroundSyncRegistration>())));
}
// Returns nullptr if the browser context cannot be accessed for any reason.
@@ -126,9 +127,9 @@ void RunInBackgroundOnUIThread(
}
}
-scoped_ptr<BackgroundSyncParameters> GetControllerParameters(
+std::unique_ptr<BackgroundSyncParameters> GetControllerParameters(
const scoped_refptr<ServiceWorkerContextWrapper>& sw_context_wrapper,
- scoped_ptr<BackgroundSyncParameters> parameters) {
+ std::unique_ptr<BackgroundSyncParameters> parameters) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
BackgroundSyncController* background_sync_controller =
@@ -173,14 +174,14 @@ BackgroundSyncManager::BackgroundSyncRegistrations::
}
// static
-scoped_ptr<BackgroundSyncManager> BackgroundSyncManager::Create(
+std::unique_ptr<BackgroundSyncManager> BackgroundSyncManager::Create(
const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
BackgroundSyncManager* sync_manager =
new BackgroundSyncManager(service_worker_context);
sync_manager->Init();
- return make_scoped_ptr(sync_manager);
+ return base::WrapUnique(sync_manager);
}
BackgroundSyncManager::~BackgroundSyncManager() {
@@ -216,8 +217,9 @@ void BackgroundSyncManager::GetRegistrations(
FROM_HERE,
base::Bind(
callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR,
- base::Passed(scoped_ptr<ScopedVector<BackgroundSyncRegistration>>(
- new ScopedVector<BackgroundSyncRegistration>()))));
+ base::Passed(
+ std::unique_ptr<ScopedVector<BackgroundSyncRegistration>>(
+ new ScopedVector<BackgroundSyncRegistration>()))));
return;
}
@@ -300,7 +302,7 @@ void BackgroundSyncManager::InitImpl(const base::Closure& callback) {
return;
}
- scoped_ptr<BackgroundSyncParameters> parameters_copy(
+ std::unique_ptr<BackgroundSyncParameters> parameters_copy(
new BackgroundSyncParameters(*parameters_));
BrowserThread::PostTaskAndReplyWithResult(
@@ -313,7 +315,7 @@ void BackgroundSyncManager::InitImpl(const base::Closure& callback) {
void BackgroundSyncManager::InitDidGetControllerParameters(
const base::Closure& callback,
- scoped_ptr<BackgroundSyncParameters> updated_parameters) {
+ std::unique_ptr<BackgroundSyncParameters> updated_parameters) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
parameters_ = std::move(updated_parameters);
@@ -509,7 +511,7 @@ void BackgroundSyncManager::RegisterDidAskForPermission(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(callback, BACKGROUND_SYNC_STATUS_OK,
- base::Passed(make_scoped_ptr(new BackgroundSyncRegistration(
+ base::Passed(base::WrapUnique(new BackgroundSyncRegistration(
*existing_registration)))));
return;
}
@@ -662,9 +664,9 @@ void BackgroundSyncManager::RegisterDidStore(
"failure.";
BackgroundSyncMetrics::CountRegisterFailure(
BACKGROUND_SYNC_STATUS_STORAGE_ERROR);
- DisableAndClearManager(
- base::Bind(callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR,
- base::Passed(scoped_ptr<BackgroundSyncRegistration>())));
+ DisableAndClearManager(base::Bind(
+ callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR,
+ base::Passed(std::unique_ptr<BackgroundSyncRegistration>())));
return;
}
@@ -681,7 +683,7 @@ void BackgroundSyncManager::RegisterDidStore(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(callback, BACKGROUND_SYNC_STATUS_OK,
- base::Passed(make_scoped_ptr(
+ base::Passed(base::WrapUnique(
new BackgroundSyncRegistration(new_registration)))));
}
@@ -782,7 +784,7 @@ void BackgroundSyncManager::GetRegistrationsImpl(
const StatusAndRegistrationsCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- scoped_ptr<ScopedVector<BackgroundSyncRegistration>> out_registrations(
+ std::unique_ptr<ScopedVector<BackgroundSyncRegistration>> out_registrations(
new ScopedVector<BackgroundSyncRegistration>());
if (disabled_) {
@@ -1185,7 +1187,7 @@ void BackgroundSyncManager::CompleteOperationCallback(const CallbackT& callback,
void BackgroundSyncManager::CompleteStatusAndRegistrationCallback(
StatusAndRegistrationCallback callback,
BackgroundSyncStatus status,
- scoped_ptr<BackgroundSyncRegistration> registration) {
+ std::unique_ptr<BackgroundSyncRegistration> registration) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback.Run(status, std::move(registration));
@@ -1195,7 +1197,7 @@ void BackgroundSyncManager::CompleteStatusAndRegistrationCallback(
void BackgroundSyncManager::CompleteStatusAndRegistrationsCallback(
StatusAndRegistrationsCallback callback,
BackgroundSyncStatus status,
- scoped_ptr<ScopedVector<BackgroundSyncRegistration>> registrations) {
+ std::unique_ptr<ScopedVector<BackgroundSyncRegistration>> registrations) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback.Run(status, std::move(registrations));

Powered by Google App Engine
This is Rietveld 408576698