summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-12 03:27:39 +0000
committerdumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-12 03:27:39 +0000
commitbeaafbaf7a599c92912702bc2b5b3e770849a74a (patch)
tree06a9d047770783c16e9cbffe374c3335d3dd9e6b
parentaa5ff891c563531aa38fbee52c36f29c66ca3e54 (diff)
downloadchromium_src-beaafbaf7a599c92912702bc2b5b3e770849a74a.zip
chromium_src-beaafbaf7a599c92912702bc2b5b3e770849a74a.tar.gz
chromium_src-beaafbaf7a599c92912702bc2b5b3e770849a74a.tar.bz2
Remove the dirfd parameter from all Chromium code. The POSIX VFS
doesn't need it. BUG=43489 TEST=none Review URL: http://codereview.chromium.org/2055009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47006 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/database_dispatcher_host.cc14
-rw-r--r--chrome/common/database_util.cc15
-rw-r--r--chrome/common/database_util.h3
-rw-r--r--chrome/common/render_messages_internal.h8
-rw-r--r--chrome/renderer/renderer_webkitclient_impl.cc6
-rw-r--r--chrome/renderer/renderer_webkitclient_impl.h3
-rw-r--r--chrome/worker/worker_webkitclient_impl.cc6
-rw-r--r--chrome/worker/worker_webkitclient_impl.h3
-rw-r--r--webkit/database/vfs_backend.cc25
-rw-r--r--webkit/database/vfs_backend.h6
-rw-r--r--webkit/glue/webkitclient_impl.cc7
-rw-r--r--webkit/glue/webkitclient_impl.h6
-rw-r--r--webkit/support/test_webkit_client.cc5
-rw-r--r--webkit/support/test_webkit_client.h3
-rw-r--r--webkit/tools/test_shell/simple_database_system.cc8
-rw-r--r--webkit/tools/test_shell/simple_database_system.h4
-rw-r--r--webkit/tools/test_shell/test_shell_webkit_init.h5
17 files changed, 39 insertions, 88 deletions
diff --git a/chrome/browser/renderer_host/database_dispatcher_host.cc b/chrome/browser/renderer_host/database_dispatcher_host.cc
index 8ce3df7..c77fc37 100644
--- a/chrome/browser/renderer_host/database_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/database_dispatcher_host.cc
@@ -157,13 +157,12 @@ void DatabaseDispatcherHost::DatabaseOpenFile(const string16& vfs_file_name,
IPC::Message* reply_msg) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
base::PlatformFile target_handle = base::kInvalidPlatformFileValue;
- base::PlatformFile target_dir_handle = base::kInvalidPlatformFileValue;
string16 origin_identifier;
string16 database_name;
if (vfs_file_name.empty()) {
VfsBackend::OpenTempFileInDirectory(db_tracker_->DatabaseDirectory(),
desired_flags, process_handle_,
- &target_handle, &target_dir_handle);
+ &target_handle);
} else if (DatabaseUtil::CrackVfsFileName(vfs_file_name, &origin_identifier,
&database_name, NULL) &&
!db_tracker_->IsDatabaseScheduledForDeletion(origin_identifier,
@@ -172,23 +171,16 @@ void DatabaseDispatcherHost::DatabaseOpenFile(const string16& vfs_file_name,
DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_, vfs_file_name);
if (!db_file.empty()) {
VfsBackend::OpenFile(db_file, desired_flags, process_handle_,
- &target_handle, &target_dir_handle);
+ &target_handle);
}
}
-#if defined(OS_POSIX)
- if (target_dir_handle >= 0)
- close(target_dir_handle);
- target_dir_handle = -1;
-#endif
-
ViewHostMsg_DatabaseOpenFile::WriteReplyParams(
reply_msg,
#if defined(OS_WIN)
target_handle
#elif defined(OS_POSIX)
- base::FileDescriptor(target_handle, true),
- base::FileDescriptor(target_dir_handle, true)
+ base::FileDescriptor(target_handle, true)
#endif
);
Send(reply_msg);
diff --git a/chrome/common/database_util.cc b/chrome/common/database_util.cc
index f149f08..fe196c6 100644
--- a/chrome/common/database_util.cc
+++ b/chrome/common/database_util.cc
@@ -19,35 +19,24 @@ using WebKit::WebKitClient;
using WebKit::WebString;
WebKitClient::FileHandle DatabaseUtil::databaseOpenFile(
- const WebString& vfs_file_name, int desired_flags,
- WebKitClient::FileHandle* dir_handle) {
+ const WebString& vfs_file_name, int desired_flags) {
IPC::PlatformFileForTransit file_handle;
#if defined(OS_WIN)
file_handle = base::kInvalidPlatformFileValue;
#elif defined(OS_POSIX)
file_handle =
base::FileDescriptor(base::kInvalidPlatformFileValue, true);
- base::FileDescriptor dir_handle_rv =
- base::FileDescriptor(base::kInvalidPlatformFileValue, true);
#endif
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
- ));
+ vfs_file_name, desired_flags, &file_handle));
#if defined(OS_WIN)
return file_handle;
#elif defined(OS_POSIX)
- if (dir_handle)
- *dir_handle = dir_handle_rv.fd;
return file_handle.fd;
#endif
}
diff --git a/chrome/common/database_util.h b/chrome/common/database_util.h
index 70bd029..9c263af 100644
--- a/chrome/common/database_util.h
+++ b/chrome/common/database_util.h
@@ -12,8 +12,7 @@
class DatabaseUtil {
public:
static WebKit::WebKitClient::FileHandle databaseOpenFile(
- const WebKit::WebString& vfs_file_name,
- int desired_flags, WebKit::WebKitClient::FileHandle* dir_handle);
+ const WebKit::WebString& vfs_file_name, int desired_flags);
static int databaseDeleteFile(const WebKit::WebString& vfs_file_name,
bool sync_dir);
static long databaseGetFileAttributes(const WebKit::WebString& vfs_file_name);
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 076aab4..50053a3 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -2151,18 +2151,10 @@ IPC_BEGIN_MESSAGES(ViewHost)
bool /* result */)
// Asks the browser process to open a DB file with the given name.
-#if defined (OS_WIN)
IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_DatabaseOpenFile,
string16 /* vfs file name */,
int /* desired flags */,
IPC::PlatformFileForTransit /* file_handle */)
-#elif defined(OS_POSIX)
- IPC_SYNC_MESSAGE_CONTROL2_2(ViewHostMsg_DatabaseOpenFile,
- string16 /* vfs file name */,
- int /* desired flags */,
- IPC::PlatformFileForTransit /* file_handle */,
- base::FileDescriptor /* dir_handle */)
-#endif
// Asks the browser process to delete a DB file
IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_DatabaseDeleteFile,
diff --git a/chrome/renderer/renderer_webkitclient_impl.cc b/chrome/renderer/renderer_webkitclient_impl.cc
index b9c1dd6..f9b5ffc 100644
--- a/chrome/renderer/renderer_webkitclient_impl.cc
+++ b/chrome/renderer/renderer_webkitclient_impl.cc
@@ -290,10 +290,8 @@ void RendererWebKitClientImpl::SandboxSupport::getRenderStyleForStrike(
//------------------------------------------------------------------------------
WebKitClient::FileHandle RendererWebKitClientImpl::databaseOpenFile(
- const WebString& vfs_file_name, int desired_flags,
- WebKitClient::FileHandle* dir_handle) {
- return DatabaseUtil::databaseOpenFile(vfs_file_name, desired_flags,
- dir_handle);
+ const WebString& vfs_file_name, int desired_flags) {
+ return DatabaseUtil::databaseOpenFile(vfs_file_name, desired_flags);
}
int RendererWebKitClientImpl::databaseDeleteFile(
diff --git a/chrome/renderer/renderer_webkitclient_impl.h b/chrome/renderer/renderer_webkitclient_impl.h
index 7d90520..7e7de1e 100644
--- a/chrome/renderer/renderer_webkitclient_impl.h
+++ b/chrome/renderer/renderer_webkitclient_impl.h
@@ -51,8 +51,7 @@ class RendererWebKitClientImpl : public webkit_glue::WebKitClientImpl {
const WebKit::WebURL& url, bool is_local_storage);
virtual WebKit::WebKitClient::FileHandle databaseOpenFile(
- const WebKit::WebString& vfs_file_name, int desired_flags,
- WebKit::WebKitClient::FileHandle* dir_handle);
+ const WebKit::WebString& vfs_file_name, int desired_flags);
virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name,
bool sync_dir);
virtual long databaseGetFileAttributes(
diff --git a/chrome/worker/worker_webkitclient_impl.cc b/chrome/worker/worker_webkitclient_impl.cc
index 4af2cf2..6bc5a86 100644
--- a/chrome/worker/worker_webkitclient_impl.cc
+++ b/chrome/worker/worker_webkitclient_impl.cc
@@ -108,10 +108,8 @@ WebSharedWorkerRepository* WorkerWebKitClientImpl::sharedWorkerRepository() {
}
WebKitClient::FileHandle WorkerWebKitClientImpl::databaseOpenFile(
- const WebString& vfs_file_name, int desired_flags,
- WebKitClient::FileHandle* dir_handle) {
- return DatabaseUtil::databaseOpenFile(vfs_file_name, desired_flags,
- dir_handle);
+ const WebString& vfs_file_name, int desired_flags) {
+ return DatabaseUtil::databaseOpenFile(vfs_file_name, desired_flags);
}
int WorkerWebKitClientImpl::databaseDeleteFile(
diff --git a/chrome/worker/worker_webkitclient_impl.h b/chrome/worker/worker_webkitclient_impl.h
index deb76c2..0500976 100644
--- a/chrome/worker/worker_webkitclient_impl.h
+++ b/chrome/worker/worker_webkitclient_impl.h
@@ -40,8 +40,7 @@ class WorkerWebKitClientImpl : public webkit_glue::WebKitClientImpl,
virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository();
virtual WebKit::WebKitClient::FileHandle databaseOpenFile(
- const WebKit::WebString& vfs_file_name, int desired_flags,
- WebKit::WebKitClient::FileHandle* dir_handle);
+ const WebKit::WebString& vfs_file_name, int desired_flags);
virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name,
bool sync_dir);
virtual long databaseGetFileAttributes(
diff --git a/webkit/database/vfs_backend.cc b/webkit/database/vfs_backend.cc
index 8cb8e05..0d9cb4f 100644
--- a/webkit/database/vfs_backend.cc
+++ b/webkit/database/vfs_backend.cc
@@ -71,8 +71,7 @@ bool VfsBackend::OpenFileFlagsAreConsistent(int desired_flags) {
void VfsBackend::OpenFile(const FilePath& file_path,
int desired_flags,
base::ProcessHandle handle,
- base::PlatformFile* target_handle,
- base::PlatformFile* target_dir_handle) {
+ base::PlatformFile* target_handle) {
DCHECK(!file_path.empty());
// Verify the flags for consistency and create the database
@@ -118,22 +117,6 @@ void VfsBackend::OpenFile(const FilePath& file_path,
}
#elif defined(OS_POSIX)
*target_handle = file_handle;
-
- int file_type = desired_flags & 0x00007F00;
- bool creating_new_file = (desired_flags & SQLITE_OPEN_CREATE);
- if (creating_new_file && ((file_type == SQLITE_OPEN_MASTER_JOURNAL) ||
- (file_type == SQLITE_OPEN_MAIN_JOURNAL))) {
- // We return a handle to the containing directory because on POSIX
- // systems the VFS might want to fsync it after changing a file.
- // By returning it here, we avoid an extra IPC call.
- *target_dir_handle = base::CreatePlatformFile(
- file_path.DirName().ToWStringHack(),
- base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, NULL);
- if (*target_dir_handle == base::kInvalidPlatformFileValue) {
- base::ClosePlatformFile(*target_handle);
- *target_handle = base::kInvalidPlatformFileValue;
- }
- }
#endif
}
}
@@ -143,8 +126,7 @@ void VfsBackend::OpenTempFileInDirectory(
const FilePath& dir_path,
int desired_flags,
base::ProcessHandle handle,
- base::PlatformFile* target_handle,
- base::PlatformFile* target_dir_handle) {
+ base::PlatformFile* target_handle) {
// We should be able to delete temp files when they're closed
// and create them as needed
if (!(desired_flags & SQLITE_OPEN_DELETEONCLOSE) ||
@@ -157,8 +139,7 @@ void VfsBackend::OpenTempFileInDirectory(
if (!file_util::CreateTemporaryFileInDir(dir_path, &temp_file_path))
return;
- OpenFile(temp_file_path, desired_flags, handle,
- target_handle, target_dir_handle);
+ OpenFile(temp_file_path, desired_flags, handle, target_handle);
}
// static
diff --git a/webkit/database/vfs_backend.h b/webkit/database/vfs_backend.h
index 97ce7e0..267ce90 100644
--- a/webkit/database/vfs_backend.h
+++ b/webkit/database/vfs_backend.h
@@ -18,14 +18,12 @@ class VfsBackend {
static void OpenFile(const FilePath& file_path,
int desired_flags,
base::ProcessHandle handle,
- base::PlatformFile* target_handle,
- base::PlatformFile* target_dir_handle);
+ base::PlatformFile* target_handle);
static void OpenTempFileInDirectory(const FilePath& dir_path,
int desired_flags,
base::ProcessHandle handle,
- base::PlatformFile* target_handle,
- base::PlatformFile* target_dir_handle);
+ base::PlatformFile* target_handle);
static int DeleteFile(const FilePath& file_path, bool sync_dir);
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index a065ad8..29b812a 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -333,11 +333,18 @@ void WebKitClientImpl::callOnMainThread(void (*func)(void*), void* context) {
main_loop_->PostTask(FROM_HERE, NewRunnableFunction(func, context));
}
+// TODO: remove this method once https://bugs.webkit.org/show_bug.cgi?id=38869
+// is resolved.
base::PlatformFile WebKitClientImpl::databaseOpenFile(
const WebKit::WebString& vfs_file_name, int desired_flags,
base::PlatformFile* dir_handle) {
if (dir_handle)
*dir_handle = base::kInvalidPlatformFileValue;
+ return databaseOpenFile(vfs_file_name, desired_flags);
+}
+
+base::PlatformFile WebKitClientImpl::databaseOpenFile(
+ const WebKit::WebString& vfs_file_name, int desired_flags) {
return base::kInvalidPlatformFileValue;
}
diff --git a/webkit/glue/webkitclient_impl.h b/webkit/glue/webkitclient_impl.h
index 6b8e345..0f70841 100644
--- a/webkit/glue/webkitclient_impl.h
+++ b/webkit/glue/webkitclient_impl.h
@@ -23,10 +23,16 @@ class WebKitClientImpl : public WebKit::WebKitClient {
// WebKitClient methods (partial implementation):
virtual WebKit::WebThemeEngine* themeEngine();
+
+ // TODO: remove this method once https://bugs.webkit.org/show_bug.cgi?id=38869
+ // is resolved.
virtual base::PlatformFile databaseOpenFile(
const WebKit::WebString& vfs_file_name,
int desired_flags,
base::PlatformFile* dir_handle);
+
+ virtual base::PlatformFile databaseOpenFile(
+ const WebKit::WebString& vfs_file_name, int desired_flags);
virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name,
bool sync_dir);
virtual long databaseGetFileAttributes(
diff --git a/webkit/support/test_webkit_client.cc b/webkit/support/test_webkit_client.cc
index 749fa80..874717c 100644
--- a/webkit/support/test_webkit_client.cc
+++ b/webkit/support/test_webkit_client.cc
@@ -156,10 +156,9 @@ bool TestWebKitClient::sandboxEnabled() {
}
WebKit::WebKitClient::FileHandle TestWebKitClient::databaseOpenFile(
- const WebKit::WebString& vfs_file_name, int desired_flags,
- WebKit::WebKitClient::FileHandle* dir_handle) {
+ const WebKit::WebString& vfs_file_name, int desired_flags) {
return SimpleDatabaseSystem::GetInstance()->OpenFile(
- vfs_file_name, desired_flags, dir_handle);
+ vfs_file_name, desired_flags);
}
int TestWebKitClient::databaseDeleteFile(const WebKit::WebString& vfs_file_name,
diff --git a/webkit/support/test_webkit_client.h b/webkit/support/test_webkit_client.h
index c0c8a6a..3e106a9 100644
--- a/webkit/support/test_webkit_client.h
+++ b/webkit/support/test_webkit_client.h
@@ -26,8 +26,7 @@ class TestWebKitClient : public webkit_glue::WebKitClientImpl {
virtual WebKit::WebCookieJar* cookieJar();
virtual bool sandboxEnabled();
virtual WebKit::WebKitClient::FileHandle databaseOpenFile(
- const WebKit::WebString& vfs_file_name, int desired_flags,
- WebKit::WebKitClient::FileHandle* dir_handle);
+ const WebKit::WebString& vfs_file_name, int desired_flags);
virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name,
bool sync_dir);
virtual long databaseGetFileAttributes(
diff --git a/webkit/tools/test_shell/simple_database_system.cc b/webkit/tools/test_shell/simple_database_system.cc
index fbb4cac..8f87dc2 100644
--- a/webkit/tools/test_shell/simple_database_system.cc
+++ b/webkit/tools/test_shell/simple_database_system.cc
@@ -46,18 +46,16 @@ SimpleDatabaseSystem::~SimpleDatabaseSystem() {
}
base::PlatformFile SimpleDatabaseSystem::OpenFile(
- const string16& vfs_file_name, int desired_flags,
- base::PlatformFile* dir_handle) {
+ const string16& vfs_file_name, int desired_flags) {
base::PlatformFile file_handle = base::kInvalidPlatformFileValue;
FilePath file_name = GetFullFilePathForVfsFile(vfs_file_name);
if (file_name.empty()) {
VfsBackend::OpenTempFileInDirectory(
db_tracker_->DatabaseDirectory(), desired_flags,
- base::GetCurrentProcessHandle(), &file_handle, dir_handle);
+ base::GetCurrentProcessHandle(), &file_handle);
} else {
VfsBackend::OpenFile(file_name, desired_flags,
- base::GetCurrentProcessHandle(), &file_handle,
- dir_handle);
+ base::GetCurrentProcessHandle(), &file_handle);
}
return file_handle;
diff --git a/webkit/tools/test_shell/simple_database_system.h b/webkit/tools/test_shell/simple_database_system.h
index 8441d31..6ec1be6 100644
--- a/webkit/tools/test_shell/simple_database_system.h
+++ b/webkit/tools/test_shell/simple_database_system.h
@@ -24,9 +24,7 @@ class SimpleDatabaseSystem : public webkit_database::DatabaseTracker::Observer,
~SimpleDatabaseSystem();
// VFS functions
- base::PlatformFile OpenFile(const string16& vfs_file_name,
- int desired_flags,
- base::PlatformFile* dir_handle);
+ base::PlatformFile OpenFile(const string16& vfs_file_name, int desired_flags);
int DeleteFile(const string16& vfs_file_name, bool sync_dir);
long GetFileAttributes(const string16& vfs_file_name);
long long GetFileSize(const string16& vfs_file_name);
diff --git a/webkit/tools/test_shell/test_shell_webkit_init.h b/webkit/tools/test_shell/test_shell_webkit_init.h
index c4e79b4..9158f16 100644
--- a/webkit/tools/test_shell/test_shell_webkit_init.h
+++ b/webkit/tools/test_shell/test_shell_webkit_init.h
@@ -134,10 +134,9 @@ class TestShellWebKitInit : public webkit_glue::WebKitClientImpl {
}
virtual WebKit::WebKitClient::FileHandle databaseOpenFile(
- const WebKit::WebString& vfs_file_name, int desired_flags,
- WebKit::WebKitClient::FileHandle* dir_handle) {
+ const WebKit::WebString& vfs_file_name, int desired_flags) {
return SimpleDatabaseSystem::GetInstance()->OpenFile(
- vfs_file_name, desired_flags, dir_handle);
+ vfs_file_name, desired_flags);
}
virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name,