summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authordumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-13 06:37:03 +0000
committerdumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-13 06:37:03 +0000
commit60cba79ac19628c205fce7cfdfd7845c1c3b6b60 (patch)
tree6731697cd5520c0e29818f4ee922e62a56dbddf9 /webkit
parent0c6fbd6e38d3fc5c04cbc22fe769e766f814253b (diff)
downloadchromium_src-60cba79ac19628c205fce7cfdfd7845c1c3b6b60.zip
chromium_src-60cba79ac19628c205fce7cfdfd7845c1c3b6b60.tar.gz
chromium_src-60cba79ac19628c205fce7cfdfd7845c1c3b6b60.tar.bz2
Cleans up a bit the DB-related methods.
TEST=none BUG=none Review URL: http://codereview.chromium.org/394006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31891 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/database/database_util.cc22
-rw-r--r--webkit/database/database_util.h4
-rw-r--r--webkit/database/database_util_unittest.cc4
-rw-r--r--webkit/glue/webkitclient_impl.cc8
-rw-r--r--webkit/glue/webkitclient_impl.h12
5 files changed, 26 insertions, 24 deletions
diff --git a/webkit/database/database_util.cc b/webkit/database/database_util.cc
index b571a72..b1ba76a 100644
--- a/webkit/database/database_util.cc
+++ b/webkit/database/database_util.cc
@@ -10,15 +10,15 @@
namespace webkit_database {
-bool DatabaseUtil::CrackVfsFilePath(const string16& vfs_file_path,
+bool DatabaseUtil::CrackVfsFileName(const string16& vfs_file_name,
string16* origin_identifier,
string16* database_name,
string16* sqlite_suffix) {
- // 'vfs_file_path' is of the form <origin_identifier>/<db_name>#<suffix>.
+ // 'vfs_file_name' is of the form <origin_identifier>/<db_name>#<suffix>.
// <suffix> is optional.
- DCHECK(!vfs_file_path.empty());
- size_t first_slash_index = vfs_file_path.find('/');
- size_t last_pound_index = vfs_file_path.rfind('#');
+ DCHECK(!vfs_file_name.empty());
+ size_t first_slash_index = vfs_file_name.find('/');
+ size_t last_pound_index = vfs_file_name.rfind('#');
// '/' and '#' must be present in the string. Also, the string cannot start
// with a '/' (origin_identifier cannot be empty) and '/' must come before '#'
if ((first_slash_index == string16::npos) ||
@@ -28,20 +28,20 @@ bool DatabaseUtil::CrackVfsFilePath(const string16& vfs_file_path,
return false;
}
- *origin_identifier = vfs_file_path.substr(0, first_slash_index);
- *database_name = vfs_file_path.substr(
+ *origin_identifier = vfs_file_name.substr(0, first_slash_index);
+ *database_name = vfs_file_name.substr(
first_slash_index + 1, last_pound_index - first_slash_index - 1);
- *sqlite_suffix = vfs_file_path.substr(
- last_pound_index + 1, vfs_file_path.length() - last_pound_index - 1);
+ *sqlite_suffix = vfs_file_name.substr(
+ last_pound_index + 1, vfs_file_name.length() - last_pound_index - 1);
return true;
}
FilePath DatabaseUtil::GetFullFilePathForVfsFile(
- DatabaseTracker* db_tracker, const string16& vfs_file_path) {
+ DatabaseTracker* db_tracker, const string16& vfs_file_name) {
string16 origin_identifier;
string16 database_name;
string16 sqlite_suffix;
- if (!CrackVfsFilePath(vfs_file_path, &origin_identifier,
+ if (!CrackVfsFileName(vfs_file_name, &origin_identifier,
&database_name, &sqlite_suffix)) {
return FilePath(); // invalid vfs_file_name
}
diff --git a/webkit/database/database_util.h b/webkit/database/database_util.h
index 7df1d38..c18e5f4 100644
--- a/webkit/database/database_util.h
+++ b/webkit/database/database_util.h
@@ -14,12 +14,12 @@ class DatabaseTracker;
class DatabaseUtil {
public:
- static bool CrackVfsFilePath(const string16& vfs_file_path,
+ static bool CrackVfsFileName(const string16& vfs_file_name,
string16* origin_identifier,
string16* database_name,
string16* sqlite_suffix);
static FilePath GetFullFilePathForVfsFile(DatabaseTracker* db_tracker,
- const string16& vfs_file_path);
+ const string16& vfs_file_name);
};
diff --git a/webkit/database/database_util_unittest.cc b/webkit/database/database_util_unittest.cc
index 4718e89..87422a5 100644
--- a/webkit/database/database_util_unittest.cc
+++ b/webkit/database/database_util_unittest.cc
@@ -9,7 +9,7 @@
using webkit_database::DatabaseUtil;
static void TestVfsFilePath(bool expected_result,
- const char* vfs_file_path,
+ const char* vfs_file_name,
const char* expected_origin_identifier = "",
const char* expected_database_name = "",
const char* expected_sqlite_suffix = "") {
@@ -17,7 +17,7 @@ static void TestVfsFilePath(bool expected_result,
string16 database_name;
string16 sqlite_suffix;
EXPECT_EQ(expected_result,
- DatabaseUtil::CrackVfsFilePath(ASCIIToUTF16(vfs_file_path),
+ DatabaseUtil::CrackVfsFileName(ASCIIToUTF16(vfs_file_name),
&origin_identifier,
&database_name,
&sqlite_suffix));
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index 61d2d6a..e495673 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -291,7 +291,7 @@ void WebKitClientImpl::callOnMainThread(void (*func)()) {
}
base::PlatformFile WebKitClientImpl::databaseOpenFile(
- const WebKit::WebString& file_name, int desired_flags,
+ const WebKit::WebString& vfs_file_name, int desired_flags,
base::PlatformFile* dir_handle) {
if (dir_handle)
*dir_handle = base::kInvalidPlatformFileValue;
@@ -299,17 +299,17 @@ base::PlatformFile WebKitClientImpl::databaseOpenFile(
}
int WebKitClientImpl::databaseDeleteFile(
- const WebKit::WebString& file_name, bool sync_dir) {
+ const WebKit::WebString& vfs_file_name, bool sync_dir) {
return -1;
}
long WebKitClientImpl::databaseGetFileAttributes(
- const WebKit::WebString& file_name) {
+ const WebKit::WebString& vfs_file_name) {
return 0;
}
long long WebKitClientImpl::databaseGetFileSize(
- const WebKit::WebString& file_name) {
+ const WebKit::WebString& vfs_file_name) {
return 0;
}
diff --git a/webkit/glue/webkitclient_impl.h b/webkit/glue/webkitclient_impl.h
index bdeb01b..4791d64 100644
--- a/webkit/glue/webkitclient_impl.h
+++ b/webkit/glue/webkitclient_impl.h
@@ -38,12 +38,14 @@ class WebKitClientImpl : public WebKit::WebKitClient {
virtual bool isDirectory(const WebKit::WebString& path);
virtual WebKit::WebURL filePathToURL(const WebKit::WebString& path);
virtual base::PlatformFile databaseOpenFile(
- const WebKit::WebString& file_name, int desired_flags,
+ const WebKit::WebString& vfs_file_name,
+ int desired_flags,
base::PlatformFile* dir_handle);
- virtual int databaseDeleteFile(const WebKit::WebString& file_name,
- bool sync_dir);
- virtual long databaseGetFileAttributes(const WebKit::WebString& file_name);
- virtual long long databaseGetFileSize(const WebKit::WebString& file_name);
+ virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name,
+ bool sync_dir);
+ virtual long databaseGetFileAttributes(
+ const WebKit::WebString& vfs_file_name);
+ virtual long long databaseGetFileSize(const WebKit::WebString& vfs_file_name);
virtual WebKit::WebString signedPublicKeyAndChallengeString(
unsigned key_size_index, const WebKit::WebString& challenge,
const WebKit::WebURL& url);