summaryrefslogtreecommitdiffstats
path: root/content/child/fileapi
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-25 23:28:55 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-25 23:28:55 +0000
commitca405d2aa6618928e599d233adc1f937271e2b48 (patch)
tree6a63a236c184657736aad796a0a57ed688441a2e /content/child/fileapi
parentaf8630b7c4464d01726af88c3e8942be27106977 (diff)
downloadchromium_src-ca405d2aa6618928e599d233adc1f937271e2b48.zip
chromium_src-ca405d2aa6618928e599d233adc1f937271e2b48.tar.gz
chromium_src-ca405d2aa6618928e599d233adc1f937271e2b48.tar.bz2
Remove usage of ChildProcess::current() and ChildThread::current() other than on the main thread. This is needed so that single process mode will work correctly with the renderer/gpu/utility threads where we will have multiple ChildProcess objects.
While doing this, I made a few cleanups: -FileSystemDispatcher was checking the return value of sending an async IPC, which always returns true. I removed the return value of those methods and updated the callers to not handle the case which never occurs. -IPCWebSocketStreamHandleBridge was posting a task to send an async message which is needless BUG=234172 R=scottmg@chromium.org Review URL: https://codereview.chromium.org/17681004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208575 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/child/fileapi')
-rw-r--r--content/child/fileapi/file_system_dispatcher.cc171
-rw-r--r--content/child/fileapi/file_system_dispatcher.h32
2 files changed, 66 insertions, 137 deletions
diff --git a/content/child/fileapi/file_system_dispatcher.cc b/content/child/fileapi/file_system_dispatcher.cc
index 31f14ec..6642a14 100644
--- a/content/child/fileapi/file_system_dispatcher.cc
+++ b/content/child/fileapi/file_system_dispatcher.cc
@@ -161,155 +161,107 @@ bool FileSystemDispatcher::OnMessageReceived(const IPC::Message& msg) {
return handled;
}
-bool FileSystemDispatcher::OpenFileSystem(
+void FileSystemDispatcher::OpenFileSystem(
const GURL& origin_url, fileapi::FileSystemType type,
long long size, bool create,
const OpenFileSystemCallback& success_callback,
const StatusCallback& error_callback) {
int request_id = dispatchers_.Add(
CallbackDispatcher::Create(success_callback, error_callback));
- if (!ChildThread::current()->Send(new FileSystemHostMsg_Open(
- request_id, origin_url, type, size, create))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
-
- return true;
+ ChildThread::current()->Send(new FileSystemHostMsg_Open(
+ request_id, origin_url, type, size, create));
}
-bool FileSystemDispatcher::DeleteFileSystem(
+void FileSystemDispatcher::DeleteFileSystem(
const GURL& origin_url,
fileapi::FileSystemType type,
const StatusCallback& callback) {
int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
- if (!ChildThread::current()->Send(new FileSystemHostMsg_DeleteFileSystem(
- request_id, origin_url, type))) {
- dispatchers_.Remove(request_id);
- return false;
- }
- return true;
+ ChildThread::current()->Send(new FileSystemHostMsg_DeleteFileSystem(
+ request_id, origin_url, type));
}
-bool FileSystemDispatcher::Move(
+void FileSystemDispatcher::Move(
const GURL& src_path,
const GURL& dest_path,
const StatusCallback& callback) {
int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
- if (!ChildThread::current()->Send(new FileSystemHostMsg_Move(
- request_id, src_path, dest_path))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
-
- return true;
+ ChildThread::current()->Send(new FileSystemHostMsg_Move(
+ request_id, src_path, dest_path));
}
-bool FileSystemDispatcher::Copy(
+void FileSystemDispatcher::Copy(
const GURL& src_path,
const GURL& dest_path,
const StatusCallback& callback) {
int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
- if (!ChildThread::current()->Send(new FileSystemHostMsg_Copy(
- request_id, src_path, dest_path))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
-
- return true;
+ ChildThread::current()->Send(new FileSystemHostMsg_Copy(
+ request_id, src_path, dest_path));
}
-bool FileSystemDispatcher::Remove(
+void FileSystemDispatcher::Remove(
const GURL& path,
bool recursive,
const StatusCallback& callback) {
int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
- if (!ChildThread::current()->Send(
- new FileSystemMsg_Remove(request_id, path, recursive))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
-
- return true;
+ ChildThread::current()->Send(
+ new FileSystemMsg_Remove(request_id, path, recursive));
}
-bool FileSystemDispatcher::ReadMetadata(
+void FileSystemDispatcher::ReadMetadata(
const GURL& path,
const MetadataCallback& success_callback,
const StatusCallback& error_callback) {
int request_id = dispatchers_.Add(
CallbackDispatcher::Create(success_callback, error_callback));
- if (!ChildThread::current()->Send(
- new FileSystemHostMsg_ReadMetadata(request_id, path))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
-
- return true;
+ ChildThread::current()->Send(
+ new FileSystemHostMsg_ReadMetadata(request_id, path));
}
-bool FileSystemDispatcher::Create(
+void FileSystemDispatcher::Create(
const GURL& path,
bool exclusive,
bool is_directory,
bool recursive,
const StatusCallback& callback) {
int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
- if (!ChildThread::current()->Send(new FileSystemHostMsg_Create(
- request_id, path, exclusive, is_directory, recursive))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
-
- return true;
+ ChildThread::current()->Send(new FileSystemHostMsg_Create(
+ request_id, path, exclusive, is_directory, recursive));
}
-bool FileSystemDispatcher::Exists(
+void FileSystemDispatcher::Exists(
const GURL& path,
bool is_directory,
const StatusCallback& callback) {
int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
- if (!ChildThread::current()->Send(
- new FileSystemHostMsg_Exists(request_id, path, is_directory))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
-
- return true;
+ ChildThread::current()->Send(
+ new FileSystemHostMsg_Exists(request_id, path, is_directory));
}
-bool FileSystemDispatcher::ReadDirectory(
+void FileSystemDispatcher::ReadDirectory(
const GURL& path,
const ReadDirectoryCallback& success_callback,
const StatusCallback& error_callback) {
int request_id = dispatchers_.Add(
CallbackDispatcher::Create(success_callback, error_callback));
- if (!ChildThread::current()->Send(
- new FileSystemHostMsg_ReadDirectory(request_id, path))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
-
- return true;
+ ChildThread::current()->Send(
+ new FileSystemHostMsg_ReadDirectory(request_id, path));
}
-bool FileSystemDispatcher::Truncate(
+void FileSystemDispatcher::Truncate(
const GURL& path,
int64 offset,
int* request_id_out,
const StatusCallback& callback) {
int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
- if (!ChildThread::current()->Send(
- new FileSystemHostMsg_Truncate(request_id, path, offset))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
+ ChildThread::current()->Send(
+ new FileSystemHostMsg_Truncate(request_id, path, offset));
if (request_id_out)
*request_id_out = request_id;
- return true;
}
-bool FileSystemDispatcher::Write(
+void FileSystemDispatcher::Write(
const GURL& path,
const GURL& blob_url,
int64 offset,
@@ -318,81 +270,58 @@ bool FileSystemDispatcher::Write(
const StatusCallback& error_callback) {
int request_id = dispatchers_.Add(
CallbackDispatcher::Create(success_callback, error_callback));
- if (!ChildThread::current()->Send(
- new FileSystemHostMsg_Write(request_id, path, blob_url, offset))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
+ ChildThread::current()->Send(
+ new FileSystemHostMsg_Write(request_id, path, blob_url, offset));
if (request_id_out)
*request_id_out = request_id;
- return true;
}
-bool FileSystemDispatcher::Cancel(
+void FileSystemDispatcher::Cancel(
int request_id_to_cancel,
const StatusCallback& callback) {
int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
- if (!ChildThread::current()->Send(new FileSystemHostMsg_CancelWrite(
- request_id, request_id_to_cancel))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
-
- return true;
+ ChildThread::current()->Send(new FileSystemHostMsg_CancelWrite(
+ request_id, request_id_to_cancel));
}
-bool FileSystemDispatcher::TouchFile(
+void FileSystemDispatcher::TouchFile(
const GURL& path,
const base::Time& last_access_time,
const base::Time& last_modified_time,
const StatusCallback& callback) {
int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
- if (!ChildThread::current()->Send(
- new FileSystemHostMsg_TouchFile(
- request_id, path, last_access_time, last_modified_time))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
-
- return true;
+ ChildThread::current()->Send(
+ new FileSystemHostMsg_TouchFile(
+ request_id, path, last_access_time, last_modified_time));
}
-bool FileSystemDispatcher::OpenFile(
+void FileSystemDispatcher::OpenFile(
const GURL& file_path,
int file_flags,
const OpenFileCallback& success_callback,
const StatusCallback& error_callback) {
int request_id = dispatchers_.Add(
CallbackDispatcher::Create(success_callback, error_callback));
- if (!ChildThread::current()->Send(
- new FileSystemHostMsg_OpenFile(
- request_id, file_path, file_flags))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
-
- return true;
+ ChildThread::current()->Send(
+ new FileSystemHostMsg_OpenFile(
+ request_id, file_path, file_flags));
}
-bool FileSystemDispatcher::NotifyCloseFile(int file_open_id) {
- return ChildThread::current()->Send(
+void FileSystemDispatcher::NotifyCloseFile(int file_open_id) {
+ ChildThread::current()->Send(
new FileSystemHostMsg_NotifyCloseFile(file_open_id));
}
-bool FileSystemDispatcher::CreateSnapshotFile(
+void FileSystemDispatcher::CreateSnapshotFile(
const GURL& file_path,
const CreateSnapshotFileCallback& success_callback,
const StatusCallback& error_callback) {
int request_id = dispatchers_.Add(
CallbackDispatcher::Create(success_callback, error_callback));
- if (!ChildThread::current()->Send(
- new FileSystemHostMsg_CreateSnapshotFile(
- request_id, file_path))) {
- dispatchers_.Remove(request_id); // destroys |dispatcher|
- return false;
- }
- return true;
+ ChildThread::current()->Send(
+ new FileSystemHostMsg_CreateSnapshotFile(
+ request_id, file_path));
}
void FileSystemDispatcher::OnDidOpenFileSystem(int request_id,
diff --git a/content/child/fileapi/file_system_dispatcher.h b/content/child/fileapi/file_system_dispatcher.h
index 10e0438..1e155db 100644
--- a/content/child/fileapi/file_system_dispatcher.h
+++ b/content/child/fileapi/file_system_dispatcher.h
@@ -61,66 +61,66 @@ class FileSystemDispatcher : public IPC::Listener {
// IPC::Listener implementation.
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
- bool OpenFileSystem(const GURL& origin_url,
+ void OpenFileSystem(const GURL& origin_url,
fileapi::FileSystemType type,
long long size,
bool create,
const OpenFileSystemCallback& success_callback,
const StatusCallback& error_callback);
- bool DeleteFileSystem(const GURL& origin_url,
+ void DeleteFileSystem(const GURL& origin_url,
fileapi::FileSystemType type,
const StatusCallback& callback);
- bool Move(const GURL& src_path,
+ void Move(const GURL& src_path,
const GURL& dest_path,
const StatusCallback& callback);
- bool Copy(const GURL& src_path,
+ void Copy(const GURL& src_path,
const GURL& dest_path,
const StatusCallback& callback);
- bool Remove(const GURL& path,
+ void Remove(const GURL& path,
bool recursive,
const StatusCallback& callback);
- bool ReadMetadata(const GURL& path,
+ void ReadMetadata(const GURL& path,
const MetadataCallback& success_callback,
const StatusCallback& error_callback);
- bool Create(const GURL& path,
+ void Create(const GURL& path,
bool exclusive,
bool is_directory,
bool recursive,
const StatusCallback& callback);
- bool Exists(const GURL& path,
+ void Exists(const GURL& path,
bool for_directory,
const StatusCallback& callback);
- bool ReadDirectory(const GURL& path,
+ void ReadDirectory(const GURL& path,
const ReadDirectoryCallback& success_callback,
const StatusCallback& error_callback);
- bool Truncate(const GURL& path,
+ void Truncate(const GURL& path,
int64 offset,
int* request_id_out,
const StatusCallback& callback);
- bool Write(const GURL& path,
+ void Write(const GURL& path,
const GURL& blob_url,
int64 offset,
int* request_id_out,
const WriteCallback& success_callback,
const StatusCallback& error_callback);
- bool Cancel(int request_id_to_cancel,
+ void Cancel(int request_id_to_cancel,
const StatusCallback& callback);
- bool TouchFile(const GURL& file_path,
+ void TouchFile(const GURL& file_path,
const base::Time& last_access_time,
const base::Time& last_modified_time,
const StatusCallback& callback);
// This returns a raw open PlatformFile, unlike the above, which are
// self-contained operations.
- bool OpenFile(const GURL& file_path,
+ void OpenFile(const GURL& file_path,
int file_flags, // passed to FileUtilProxy::CreateOrOpen
const OpenFileCallback& success_callback,
const StatusCallback& error_callback);
// This must be paired with OpenFile, and called after finished using the
// raw PlatformFile returned from OpenFile.
- bool NotifyCloseFile(int file_open_id);
+ void NotifyCloseFile(int file_open_id);
- bool CreateSnapshotFile(const GURL& file_path,
+ void CreateSnapshotFile(const GURL& file_path,
const CreateSnapshotFileCallback& success_callback,
const StatusCallback& error_callback);