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

Unified Diff: content/browser/renderer_host/database_message_filter.cc

Issue 1006423008: Add SetFileSize() IPC for WebSQL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary IPC_MESSAGE_HANDLER_DELAY_REPLYs, remove unnecessary scoped_refptrs. Created 5 years, 9 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
« no previous file with comments | « content/browser/renderer_host/database_message_filter.h ('k') | content/child/blink_platform_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/database_message_filter.cc
diff --git a/content/browser/renderer_host/database_message_filter.cc b/content/browser/renderer_host/database_message_filter.cc
index bb5bdd6946eafc25ebaa61b644661dd4d4d7990f..4b37773dd2aa47d69d61fa5bdec0938a0eec6397 100644
--- a/content/browser/renderer_host/database_message_filter.cc
+++ b/content/browser/renderer_host/database_message_filter.cc
@@ -89,16 +89,15 @@ void DatabaseMessageFilter::OverrideThreadForMessage(
bool DatabaseMessageFilter::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(DatabaseMessageFilter, message)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_OpenFile,
- OnDatabaseOpenFile)
+ IPC_MESSAGE_HANDLER(DatabaseHostMsg_OpenFile, OnDatabaseOpenFile)
IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_DeleteFile,
OnDatabaseDeleteFile)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_GetFileAttributes,
- OnDatabaseGetFileAttributes)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_GetFileSize,
- OnDatabaseGetFileSize)
+ IPC_MESSAGE_HANDLER(DatabaseHostMsg_GetFileAttributes,
+ OnDatabaseGetFileAttributes)
+ IPC_MESSAGE_HANDLER(DatabaseHostMsg_GetFileSize, OnDatabaseGetFileSize)
IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_GetSpaceAvailable,
OnDatabaseGetSpaceAvailable)
+ IPC_MESSAGE_HANDLER(DatabaseHostMsg_SetFileSize, OnDatabaseSetFileSize)
IPC_MESSAGE_HANDLER(DatabaseHostMsg_Opened, OnDatabaseOpened)
IPC_MESSAGE_HANDLER(DatabaseHostMsg_Modified, OnDatabaseModified)
IPC_MESSAGE_HANDLER(DatabaseHostMsg_Closed, OnDatabaseClosed)
@@ -114,7 +113,7 @@ DatabaseMessageFilter::~DatabaseMessageFilter() {
void DatabaseMessageFilter::OnDatabaseOpenFile(
const base::string16& vfs_file_name,
int desired_flags,
- IPC::Message* reply_msg) {
+ IPC::PlatformFileForTransit* handle) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
base::File file;
const base::File* tracked_file = NULL;
@@ -156,19 +155,15 @@ void DatabaseMessageFilter::OnDatabaseOpenFile(
// Then we duplicate the file handle to make it useable in the renderer
// process. The original handle is closed, unless we saved it in the
// database tracker.
- IPC::PlatformFileForTransit target_handle =
- IPC::InvalidPlatformFileForTransit();
+ *handle = IPC::InvalidPlatformFileForTransit();
if (file.IsValid()) {
- target_handle = IPC::TakeFileHandleForProcess(file.Pass(), PeerHandle());
+ *handle = IPC::TakeFileHandleForProcess(file.Pass(), PeerHandle());
} else if (tracked_file) {
DCHECK(tracked_file->IsValid());
- target_handle =
+ *handle =
IPC::GetFileHandleForProcess(tracked_file->GetPlatformFile(),
PeerHandle(), false);
}
-
- DatabaseHostMsg_OpenFile::WriteReplyParams(reply_msg, target_handle);
- Send(reply_msg);
}
void DatabaseMessageFilter::OnDatabaseDeleteFile(
@@ -228,30 +223,24 @@ void DatabaseMessageFilter::DatabaseDeleteFile(
void DatabaseMessageFilter::OnDatabaseGetFileAttributes(
const base::string16& vfs_file_name,
- IPC::Message* reply_msg) {
+ int32* attributes) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
- int32 attributes = -1;
+ *attributes = -1;
base::FilePath db_file =
DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_.get(), vfs_file_name);
if (!db_file.empty())
- attributes = VfsBackend::GetFileAttributes(db_file);
-
- DatabaseHostMsg_GetFileAttributes::WriteReplyParams(
- reply_msg, attributes);
- Send(reply_msg);
+ *attributes = VfsBackend::GetFileAttributes(db_file);
}
void DatabaseMessageFilter::OnDatabaseGetFileSize(
- const base::string16& vfs_file_name, IPC::Message* reply_msg) {
+ const base::string16& vfs_file_name,
+ int64* size) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
- int64 size = 0;
+ *size = 0;
base::FilePath db_file =
DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_.get(), vfs_file_name);
if (!db_file.empty())
- size = VfsBackend::GetFileSize(db_file);
-
- DatabaseHostMsg_GetFileSize::WriteReplyParams(reply_msg, size);
- Send(reply_msg);
+ *size = VfsBackend::GetFileSize(db_file);
}
void DatabaseMessageFilter::OnDatabaseGetSpaceAvailable(
@@ -288,6 +277,16 @@ void DatabaseMessageFilter::OnDatabaseGetUsageAndQuota(
Send(reply_msg);
}
+void DatabaseMessageFilter::OnDatabaseSetFileSize(
+ const base::string16& vfs_file_name, int64 size, bool* success) {
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+ *success = false;
+ base::FilePath db_file =
+ DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_.get(), vfs_file_name);
+ if (!db_file.empty())
+ *success = VfsBackend::SetFileSize(db_file, size);
+}
+
void DatabaseMessageFilter::OnDatabaseOpened(
const std::string& origin_identifier,
const base::string16& database_name,
« no previous file with comments | « content/browser/renderer_host/database_message_filter.h ('k') | content/child/blink_platform_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698