diff options
author | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-13 06:37:03 +0000 |
---|---|---|
committer | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-13 06:37:03 +0000 |
commit | 60cba79ac19628c205fce7cfdfd7845c1c3b6b60 (patch) | |
tree | 6731697cd5520c0e29818f4ee922e62a56dbddf9 /webkit/database | |
parent | 0c6fbd6e38d3fc5c04cbc22fe769e766f814253b (diff) | |
download | chromium_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/database')
-rw-r--r-- | webkit/database/database_util.cc | 22 | ||||
-rw-r--r-- | webkit/database/database_util.h | 4 | ||||
-rw-r--r-- | webkit/database/database_util_unittest.cc | 4 |
3 files changed, 15 insertions, 15 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)); |