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

Unified Diff: chrome/browser/sync_file_system/drive_backend/sync_task_manager.h

Issue 1873683002: Convert //chrome/browser/sync_file_system 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: chrome/browser/sync_file_system/drive_backend/sync_task_manager.h
diff --git a/chrome/browser/sync_file_system/drive_backend/sync_task_manager.h b/chrome/browser/sync_file_system/drive_backend/sync_task_manager.h
index 7f226dfa6b9b17742ba07107d6cdf0ad788682ae..364383df22fd6eccc7cee3807447e67bfd76c4e8 100644
--- a/chrome/browser/sync_file_system/drive_backend/sync_task_manager.h
+++ b/chrome/browser/sync_file_system/drive_backend/sync_task_manager.h
@@ -8,13 +8,13 @@
#include <stddef.h>
#include <stdint.h>
+#include <memory>
#include <queue>
#include <vector>
#include "base/callback.h"
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "base/threading/sequenced_worker_pool.h"
@@ -48,7 +48,8 @@ struct TaskBlocker;
class SyncTaskManager {
public:
typedef base::Callback<void(const SyncStatusCallback& callback)> Task;
- typedef base::Callback<void(scoped_ptr<SyncTaskToken> token)> Continuation;
+ typedef base::Callback<void(std::unique_ptr<SyncTaskToken> token)>
+ Continuation;
enum Priority {
PRIORITY_LOW,
@@ -68,7 +69,8 @@ class SyncTaskManager {
SyncStatusCode last_operation_status,
bool last_operation_used_network) = 0;
- virtual void RecordTaskLog(scoped_ptr<TaskLogger::TaskLog> task_log) = 0;
+ virtual void RecordTaskLog(
+ std::unique_ptr<TaskLogger::TaskLog> task_log) = 0;
};
// Runs at most |maximum_background_tasks| parallel as background tasks.
@@ -90,7 +92,7 @@ class SyncTaskManager {
Priority priority,
const SyncStatusCallback& callback);
void ScheduleSyncTask(const tracked_objects::Location& from_here,
- scoped_ptr<SyncTask> task,
+ std::unique_ptr<SyncTask> task,
Priority priority,
const SyncStatusCallback& callback);
@@ -100,12 +102,12 @@ class SyncTaskManager {
const Task& task,
const SyncStatusCallback& callback);
bool ScheduleSyncTaskIfIdle(const tracked_objects::Location& from_here,
- scoped_ptr<SyncTask> task,
+ std::unique_ptr<SyncTask> task,
const SyncStatusCallback& callback);
// Notifies SyncTaskManager that the task associated to |token| has finished
// with |status|.
- static void NotifyTaskDone(scoped_ptr<SyncTaskToken> token,
+ static void NotifyTaskDone(std::unique_ptr<SyncTaskToken> token,
SyncStatusCode status);
// Updates |task_blocker| associated to the current task by specified
@@ -119,9 +121,10 @@ class SyncTaskManager {
// Note that this function once releases previous |task_blocker| before
// applying new |task_blocker|. So, any other task may be run before
// invocation of |continuation|.
- static void UpdateTaskBlocker(scoped_ptr<SyncTaskToken> current_task_token,
- scoped_ptr<TaskBlocker> task_blocker,
- const Continuation& continuation);
+ static void UpdateTaskBlocker(
+ std::unique_ptr<SyncTaskToken> current_task_token,
+ std::unique_ptr<TaskBlocker> task_blocker,
+ const Continuation& continuation);
bool IsRunningTask(int64_t task_token_id) const;
@@ -146,42 +149,44 @@ class SyncTaskManager {
};
// Non-static version of NotifyTaskDone.
- void NotifyTaskDoneBody(scoped_ptr<SyncTaskToken> token,
+ void NotifyTaskDoneBody(std::unique_ptr<SyncTaskToken> token,
SyncStatusCode status);
// Non-static version of UpdateTaskBlocker.
- void UpdateTaskBlockerBody(scoped_ptr<SyncTaskToken> foreground_task_token,
- scoped_ptr<SyncTaskToken> background_task_token,
- scoped_ptr<TaskLogger::TaskLog> task_log,
- scoped_ptr<TaskBlocker> task_blocker,
- const Continuation& continuation);
+ void UpdateTaskBlockerBody(
+ std::unique_ptr<SyncTaskToken> foreground_task_token,
+ std::unique_ptr<SyncTaskToken> background_task_token,
+ std::unique_ptr<TaskLogger::TaskLog> task_log,
+ std::unique_ptr<TaskBlocker> task_blocker,
+ const Continuation& continuation);
// This should be called when an async task needs to get a task token.
- scoped_ptr<SyncTaskToken> GetToken(const tracked_objects::Location& from_here,
- const SyncStatusCallback& callback);
+ std::unique_ptr<SyncTaskToken> GetToken(
+ const tracked_objects::Location& from_here,
+ const SyncStatusCallback& callback);
- scoped_ptr<SyncTaskToken> GetTokenForBackgroundTask(
+ std::unique_ptr<SyncTaskToken> GetTokenForBackgroundTask(
const tracked_objects::Location& from_here,
const SyncStatusCallback& callback,
- scoped_ptr<TaskBlocker> task_blocker);
+ std::unique_ptr<TaskBlocker> task_blocker);
void PushPendingTask(const base::Closure& closure, Priority priority);
- void RunTask(scoped_ptr<SyncTaskToken> token,
- scoped_ptr<SyncTask> task);
+ void RunTask(std::unique_ptr<SyncTaskToken> token,
+ std::unique_ptr<SyncTask> task);
// Runs a pending task as a foreground task if possible.
// If |token| is non-nullptr, put |token| back to |token_| beforehand.
- void MaybeStartNextForegroundTask(scoped_ptr<SyncTaskToken> token);
+ void MaybeStartNextForegroundTask(std::unique_ptr<SyncTaskToken> token);
base::WeakPtr<Client> client_;
// Owns running SyncTask to cancel the task on SyncTaskManager deletion.
- scoped_ptr<SyncTask> running_foreground_task_;
+ std::unique_ptr<SyncTask> running_foreground_task_;
// Owns running backgrounded SyncTask to cancel the task on SyncTaskManager
// deletion.
- base::ScopedPtrHashMap<int64_t, scoped_ptr<SyncTask>>
+ base::ScopedPtrHashMap<int64_t, std::unique_ptr<SyncTask>>
running_background_tasks_;
size_t maximum_background_task_;
@@ -199,7 +204,7 @@ class SyncTaskManager {
// Each task must take TaskToken instance from |token_| and must hold it
// until it finished. And the task must return the instance through
// NotifyTaskDone when the task finished.
- scoped_ptr<SyncTaskToken> token_;
+ std::unique_ptr<SyncTaskToken> token_;
TaskDependencyManager dependency_manager_;

Powered by Google App Engine
This is Rietveld 408576698