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

Unified Diff: content/child/fileapi/file_system_dispatcher.cc

Issue 2480293004: Mandate unique_ptr for base::IDMap in IDMapOwnPointer mode. (Closed)
Patch Set: Fix typo breaking a bunch of trybot builds, oops Created 4 years, 1 month 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/child/fileapi/file_system_dispatcher.cc
diff --git a/content/child/fileapi/file_system_dispatcher.cc b/content/child/fileapi/file_system_dispatcher.cc
index 1fdf49527306648e2070be452c1b961c78af0f5f..f4d1906bb69dc072ab3e643dd1a64577b9fe97aa 100644
--- a/content/child/fileapi/file_system_dispatcher.cc
+++ b/content/child/fileapi/file_system_dispatcher.cc
@@ -4,6 +4,8 @@
#include "content/child/fileapi/file_system_dispatcher.h"
+#include <memory>
+
#include "base/callback.h"
#include "base/files/file_util.h"
#include "base/macros.h"
@@ -170,7 +172,8 @@ void FileSystemDispatcher::OpenFileSystem(
const OpenFileSystemCallback& success_callback,
const StatusCallback& error_callback) {
int request_id = dispatchers_.Add(
- CallbackDispatcher::Create(success_callback, error_callback));
+ std::unique_ptr<CallbackDispatcher>(
danakj 2016/11/18 00:15:33 can you make the Create methods return unique_ptr?
rlanday 2016/11/18 19:32:10 We can make the Create methods return unique_ptr,
danakj 2016/11/18 21:21:13 Ya that's fine inside the Create methods.
+ CallbackDispatcher::Create(success_callback, error_callback)));
ChildThreadImpl::current()->Send(new FileSystemHostMsg_OpenFileSystem(
request_id, origin_url, type));
}
@@ -180,7 +183,8 @@ void FileSystemDispatcher::ResolveURL(
const ResolveURLCallback& success_callback,
const StatusCallback& error_callback) {
int request_id = dispatchers_.Add(
- CallbackDispatcher::Create(success_callback, error_callback));
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(success_callback, error_callback)));
ChildThreadImpl::current()->Send(new FileSystemHostMsg_ResolveURL(
request_id, filesystem_url));
}
@@ -188,7 +192,9 @@ void FileSystemDispatcher::ResolveURL(
void FileSystemDispatcher::DeleteFileSystem(const GURL& origin_url,
storage::FileSystemType type,
const StatusCallback& callback) {
- int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
+ int request_id = dispatchers_.Add(
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(callback)));
ChildThreadImpl::current()->Send(new FileSystemHostMsg_DeleteFileSystem(
request_id, origin_url, type));
}
@@ -197,7 +203,9 @@ void FileSystemDispatcher::Move(
const GURL& src_path,
const GURL& dest_path,
const StatusCallback& callback) {
- int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
+ int request_id = dispatchers_.Add(
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(callback)));
ChildThreadImpl::current()->Send(new FileSystemHostMsg_Move(
request_id, src_path, dest_path));
}
@@ -206,7 +214,9 @@ void FileSystemDispatcher::Copy(
const GURL& src_path,
const GURL& dest_path,
const StatusCallback& callback) {
- int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
+ int request_id = dispatchers_.Add(
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(callback)));
ChildThreadImpl::current()->Send(new FileSystemHostMsg_Copy(
request_id, src_path, dest_path));
}
@@ -215,7 +225,9 @@ void FileSystemDispatcher::Remove(
const GURL& path,
bool recursive,
const StatusCallback& callback) {
- int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
+ int request_id = dispatchers_.Add(
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(callback)));
ChildThreadImpl::current()->Send(
new FileSystemHostMsg_Remove(request_id, path, recursive));
}
@@ -225,7 +237,8 @@ void FileSystemDispatcher::ReadMetadata(
const MetadataCallback& success_callback,
const StatusCallback& error_callback) {
int request_id = dispatchers_.Add(
- CallbackDispatcher::Create(success_callback, error_callback));
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(success_callback, error_callback)));
ChildThreadImpl::current()->Send(
new FileSystemHostMsg_ReadMetadata(request_id, path));
}
@@ -234,7 +247,9 @@ void FileSystemDispatcher::CreateFile(
const GURL& path,
bool exclusive,
const StatusCallback& callback) {
- int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
+ int request_id = dispatchers_.Add(
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(callback)));
ChildThreadImpl::current()->Send(new FileSystemHostMsg_Create(
request_id, path, exclusive,
false /* is_directory */, false /* recursive */));
@@ -245,7 +260,9 @@ void FileSystemDispatcher::CreateDirectory(
bool exclusive,
bool recursive,
const StatusCallback& callback) {
- int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
+ int request_id = dispatchers_.Add(
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(callback)));
ChildThreadImpl::current()->Send(new FileSystemHostMsg_Create(
request_id, path, exclusive, true /* is_directory */, recursive));
}
@@ -254,7 +271,9 @@ void FileSystemDispatcher::Exists(
const GURL& path,
bool is_directory,
const StatusCallback& callback) {
- int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
+ int request_id = dispatchers_.Add(
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(callback)));
ChildThreadImpl::current()->Send(
new FileSystemHostMsg_Exists(request_id, path, is_directory));
}
@@ -264,7 +283,8 @@ void FileSystemDispatcher::ReadDirectory(
const ReadDirectoryCallback& success_callback,
const StatusCallback& error_callback) {
int request_id = dispatchers_.Add(
- CallbackDispatcher::Create(success_callback, error_callback));
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(success_callback, error_callback)));
ChildThreadImpl::current()->Send(
new FileSystemHostMsg_ReadDirectory(request_id, path));
}
@@ -273,7 +293,9 @@ void FileSystemDispatcher::Truncate(const GURL& path,
int64_t offset,
int* request_id_out,
const StatusCallback& callback) {
- int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
+ int request_id = dispatchers_.Add(
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(callback)));
ChildThreadImpl::current()->Send(
new FileSystemHostMsg_Truncate(request_id, path, offset));
@@ -288,7 +310,8 @@ void FileSystemDispatcher::Write(const GURL& path,
const WriteCallback& success_callback,
const StatusCallback& error_callback) {
int request_id = dispatchers_.Add(
- CallbackDispatcher::Create(success_callback, error_callback));
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(success_callback, error_callback)));
ChildThreadImpl::current()->Send(
new FileSystemHostMsg_Write(request_id, path, blob_id, offset));
@@ -299,7 +322,9 @@ void FileSystemDispatcher::Write(const GURL& path,
void FileSystemDispatcher::Cancel(
int request_id_to_cancel,
const StatusCallback& callback) {
- int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
+ int request_id = dispatchers_.Add(
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(callback)));
ChildThreadImpl::current()->Send(new FileSystemHostMsg_CancelWrite(
request_id, request_id_to_cancel));
}
@@ -309,7 +334,9 @@ void FileSystemDispatcher::TouchFile(
const base::Time& last_access_time,
const base::Time& last_modified_time,
const StatusCallback& callback) {
- int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
+ int request_id = dispatchers_.Add(
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(callback)));
ChildThreadImpl::current()->Send(
new FileSystemHostMsg_TouchFile(
request_id, path, last_access_time, last_modified_time));
@@ -320,7 +347,8 @@ void FileSystemDispatcher::CreateSnapshotFile(
const CreateSnapshotFileCallback& success_callback,
const StatusCallback& error_callback) {
int request_id = dispatchers_.Add(
- CallbackDispatcher::Create(success_callback, error_callback));
+ std::unique_ptr<CallbackDispatcher>(
+ CallbackDispatcher::Create(success_callback, error_callback)));
ChildThreadImpl::current()->Send(
new FileSystemHostMsg_CreateSnapshotFile(
request_id, file_path));

Powered by Google App Engine
This is Rietveld 408576698