Index: chrome/common/database_util.cc |
=================================================================== |
--- chrome/common/database_util.cc (revision 43588) |
+++ chrome/common/database_util.cc (working copy) |
@@ -10,8 +10,9 @@ |
#include "third_party/sqlite/preprocessed/sqlite3.h" |
#endif |
-#include "chrome/common/db_message_filter.h" |
+#include "chrome/common/child_thread.h" |
#include "chrome/common/render_messages.h" |
+#include "ipc/ipc_sync_message_filter.h" |
#include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
using WebKit::WebKitClient; |
@@ -20,58 +21,59 @@ |
WebKitClient::FileHandle DatabaseUtil::databaseOpenFile( |
const WebString& vfs_file_name, int desired_flags, |
WebKitClient::FileHandle* dir_handle) { |
- DBMessageFilter* db_message_filter = DBMessageFilter::GetInstance(); |
- int message_id = db_message_filter->GetUniqueID(); |
- |
+ IPC::PlatformFileForTransit file_handle; |
#if defined(OS_WIN) |
- ViewMsg_DatabaseOpenFileResponse_Params default_response = |
- { base::kInvalidPlatformFileValue }; |
+ file_handle = base::kInvalidPlatformFileValue; |
#elif defined(OS_POSIX) |
- ViewMsg_DatabaseOpenFileResponse_Params default_response = |
- { base::FileDescriptor(base::kInvalidPlatformFileValue, true), |
- base::FileDescriptor(base::kInvalidPlatformFileValue, true) }; |
+ file_handle = |
+ base::FileDescriptor(base::kInvalidPlatformFileValue, true); |
+ base::FileDescriptor dir_handle_rv = |
+ base::FileDescriptor(base::kInvalidPlatformFileValue, true); |
#endif |
- ViewMsg_DatabaseOpenFileResponse_Params result = |
- db_message_filter->SendAndWait( |
- new ViewHostMsg_DatabaseOpenFile( |
- vfs_file_name, desired_flags, message_id), |
- message_id, default_response); |
+ scoped_refptr<IPC::SyncMessageFilter> filter = |
+ ChildThread::current()->sync_message_filter(); |
+ filter->Send(new ViewHostMsg_DatabaseOpenFile( |
+ vfs_file_name, |
+ desired_flags, |
+ &file_handle |
+#if defined(OS_POSIX) |
+ , &dir_handle_rv |
+#endif |
+ )); |
+ |
#if defined(OS_WIN) |
- if (dir_handle) |
- *dir_handle = base::kInvalidPlatformFileValue; |
- return result.file_handle; |
+ return file_handle; |
#elif defined(OS_POSIX) |
if (dir_handle) |
- *dir_handle = result.dir_handle.fd; |
- return result.file_handle.fd; |
+ *dir_handle = dir_handle_rv.fd; |
+ return file_handle.fd; |
#endif |
} |
int DatabaseUtil::databaseDeleteFile( |
const WebString& vfs_file_name, bool sync_dir) { |
- DBMessageFilter* db_message_filter = DBMessageFilter::GetInstance(); |
- int message_id = db_message_filter->GetUniqueID(); |
- return db_message_filter->SendAndWait( |
- new ViewHostMsg_DatabaseDeleteFile(vfs_file_name, sync_dir, message_id), |
- message_id, SQLITE_IOERR_DELETE); |
+ int rv = SQLITE_IOERR_DELETE; |
+ scoped_refptr<IPC::SyncMessageFilter> filter = |
+ ChildThread::current()->sync_message_filter(); |
+ filter->Send(new ViewHostMsg_DatabaseDeleteFile( |
+ vfs_file_name, sync_dir, &rv)); |
+ return rv; |
} |
-long DatabaseUtil::databaseGetFileAttributes( |
- const WebString& vfs_file_name) { |
- DBMessageFilter* db_message_filter = DBMessageFilter::GetInstance(); |
- int message_id = db_message_filter->GetUniqueID(); |
- return db_message_filter->SendAndWait( |
- new ViewHostMsg_DatabaseGetFileAttributes(vfs_file_name, message_id), |
- message_id, -1L); |
+long DatabaseUtil::databaseGetFileAttributes(const WebString& vfs_file_name) { |
+ int32 rv = -1; |
+ scoped_refptr<IPC::SyncMessageFilter> filter = |
+ ChildThread::current()->sync_message_filter(); |
+ filter->Send(new ViewHostMsg_DatabaseGetFileAttributes(vfs_file_name, &rv)); |
+ return rv; |
} |
-long long DatabaseUtil::databaseGetFileSize( |
- const WebString& vfs_file_name) { |
- DBMessageFilter* db_message_filter = DBMessageFilter::GetInstance(); |
- int message_id = db_message_filter->GetUniqueID(); |
- return db_message_filter->SendAndWait( |
- new ViewHostMsg_DatabaseGetFileSize(vfs_file_name, message_id), |
- message_id, 0LL); |
+long long DatabaseUtil::databaseGetFileSize(const WebString& vfs_file_name) { |
+ int64 rv = 0LL; |
+ scoped_refptr<IPC::SyncMessageFilter> filter = |
+ ChildThread::current()->sync_message_filter(); |
+ filter->Send(new ViewHostMsg_DatabaseGetFileSize(vfs_file_name, &rv)); |
+ return rv; |
} |