summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 05:45:17 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 05:45:17 +0000
commite59558b78e8c6a1b0bd916a724724b638c3c91b6 (patch)
tree712268a7e9e1cd552f309d89641b2bed5ad06322 /webkit/fileapi
parent31fcd34da3797bc49160620ef8c94a38652c0587 (diff)
downloadchromium_src-e59558b78e8c6a1b0bd916a724724b638c3c91b6.zip
chromium_src-e59558b78e8c6a1b0bd916a724724b638c3c91b6.tar.gz
chromium_src-e59558b78e8c6a1b0bd916a724724b638c3c91b6.tar.bz2
Rewrite std::string("") to std::string(), Linux edition.
This patch was generated by running the empty_string clang tool across the Chromium Linux compilation database. Implicitly or explicitly constructing std::string() with a "" argument is inefficient as the caller needs to emit extra instructions to pass an argument, and the constructor needlessly copies a byte into internal storage. Rewriting these instances to simply call the default constructor appears to save ~14-18 kilobytes on an optimized release build. BUG=none Review URL: https://codereview.chromium.org/13145003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi')
-rw-r--r--webkit/fileapi/copy_or_move_file_validator_unittest.cc3
-rw-r--r--webkit/fileapi/external_mount_points_unittest.cc6
-rw-r--r--webkit/fileapi/file_system_directory_database_unittest.cc2
-rw-r--r--webkit/fileapi/file_system_origin_database.cc2
-rw-r--r--webkit/fileapi/file_system_util_unittest.cc2
-rw-r--r--webkit/fileapi/local_file_stream_writer_unittest.cc4
-rw-r--r--webkit/fileapi/local_file_system_cross_operation_unittest.cc6
-rw-r--r--webkit/fileapi/obfuscated_file_util_unittest.cc4
-rw-r--r--webkit/fileapi/syncable/canned_syncable_file_system.cc3
9 files changed, 15 insertions, 17 deletions
diff --git a/webkit/fileapi/copy_or_move_file_validator_unittest.cc b/webkit/fileapi/copy_or_move_file_validator_unittest.cc
index 7abc628..6aafa88 100644
--- a/webkit/fileapi/copy_or_move_file_validator_unittest.cc
+++ b/webkit/fileapi/copy_or_move_file_validator_unittest.cc
@@ -58,8 +58,7 @@ class CopyOrMoveFileValidatorTestHelper {
FileSystemMountPointProvider* mount_point_provider =
file_system_context_->GetMountPointProvider(src_type_);
mount_point_provider->GetFileSystemRootPathOnFileThread(
- SourceURL(""),
- true /* create */);
+ SourceURL(std::string()), true /* create */);
}
DCHECK_EQ(kFileSystemTypeNativeMedia, dest_type_);
base::FilePath dest_path = base_dir.Append(FILE_PATH_LITERAL("dest_media"));
diff --git a/webkit/fileapi/external_mount_points_unittest.cc b/webkit/fileapi/external_mount_points_unittest.cc
index 4b2ce6cb..8c012fa 100644
--- a/webkit/fileapi/external_mount_points_unittest.cc
+++ b/webkit/fileapi/external_mount_points_unittest.cc
@@ -154,7 +154,7 @@ TEST(ExternalMountPointsTest, GetVirtualPath) {
// A mount point with an empty path.
mount_points->RegisterFileSystem("empty_path",
fileapi::kFileSystemTypeNativeLocal,
- base::FilePath(FPL("")));
+ base::FilePath(FPL(std::string())));
struct TestCase {
const base::FilePath::CharType* const local_path;
@@ -271,7 +271,7 @@ TEST(ExternalMountPointsTest, CreateCrackedFileSystemURL) {
base::FilePath(DRIVE FPL("/a/b/c(1)")));
mount_points->RegisterFileSystem("empty_path",
fileapi::kFileSystemTypeSyncable,
- base::FilePath(FPL("")));
+ base::FilePath(FPL(std::string())));
mount_points->RegisterFileSystem("mount",
fileapi::kFileSystemTypeDrive,
base::FilePath(DRIVE FPL("/root")));
@@ -382,7 +382,7 @@ TEST(ExternalMountPointsTest, CrackVirtualPath) {
base::FilePath(DRIVE FPL("/a/b/c(1)")));
mount_points->RegisterFileSystem("empty_path",
fileapi::kFileSystemTypeSyncable,
- base::FilePath(FPL("")));
+ base::FilePath(FPL(std::string())));
mount_points->RegisterFileSystem("mount",
fileapi::kFileSystemTypeDrive,
base::FilePath(DRIVE FPL("/root")));
diff --git a/webkit/fileapi/file_system_directory_database_unittest.cc b/webkit/fileapi/file_system_directory_database_unittest.cc
index b612669..5a4b889 100644
--- a/webkit/fileapi/file_system_directory_database_unittest.cc
+++ b/webkit/fileapi/file_system_directory_database_unittest.cc
@@ -569,7 +569,7 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestConsistencyCheck_OrphanFile) {
TEST_F(FileSystemDirectoryDatabaseTest, TestConsistencyCheck_RootLoop) {
EXPECT_TRUE(db()->IsFileSystemConsistent());
- MakeHierarchyLink(0, 0, FPL(""));
+ MakeHierarchyLink(0, 0, FPL(std::string()));
EXPECT_FALSE(db()->IsFileSystemConsistent());
}
diff --git a/webkit/fileapi/file_system_origin_database.cc b/webkit/fileapi/file_system_origin_database.cc
index 1026418..a7405d9 100644
--- a/webkit/fileapi/file_system_origin_database.cc
+++ b/webkit/fileapi/file_system_origin_database.cc
@@ -265,7 +265,7 @@ bool FileSystemOriginDatabase::ListAllOrigins(
return false;
DCHECK(origins);
scoped_ptr<leveldb::Iterator> iter(db_->NewIterator(leveldb::ReadOptions()));
- std::string origin_key_prefix = OriginToOriginKey("");
+ std::string origin_key_prefix = OriginToOriginKey(std::string());
iter->Seek(origin_key_prefix);
origins->clear();
while (iter->Valid() &&
diff --git a/webkit/fileapi/file_system_util_unittest.cc b/webkit/fileapi/file_system_util_unittest.cc
index 7c946cc..74fc764 100644
--- a/webkit/fileapi/file_system_util_unittest.cc
+++ b/webkit/fileapi/file_system_util_unittest.cc
@@ -115,7 +115,7 @@ TEST_F(FileSystemUtilTest, GetNormalizedFilePath) {
TEST_F(FileSystemUtilTest, IsAbsolutePath) {
EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/")));
EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/foo/bar")));
- EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("")));
+ EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL(std::string())));
EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("foo/bar")));
}
diff --git a/webkit/fileapi/local_file_stream_writer_unittest.cc b/webkit/fileapi/local_file_stream_writer_unittest.cc
index d67a7da..41c547e 100644
--- a/webkit/fileapi/local_file_stream_writer_unittest.cc
+++ b/webkit/fileapi/local_file_stream_writer_unittest.cc
@@ -77,7 +77,7 @@ void NeverCalled(int unused) {
} // namespace
TEST_F(LocalFileStreamWriterTest, Write) {
- base::FilePath path = CreateFileWithContent("file_a", "");
+ base::FilePath path = CreateFileWithContent("file_a", std::string());
scoped_ptr<LocalFileStreamWriter> writer(new LocalFileStreamWriter(path, 0));
EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "foo"));
EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "bar"));
@@ -126,7 +126,7 @@ TEST_F(LocalFileStreamWriterTest, CancelBeforeOperation) {
}
TEST_F(LocalFileStreamWriterTest, CancelAfterFinishedOperation) {
- base::FilePath path = CreateFileWithContent("file_a", "");
+ base::FilePath path = CreateFileWithContent("file_a", std::string());
scoped_ptr<LocalFileStreamWriter> writer(new LocalFileStreamWriter(path, 0));
EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "foo"));
diff --git a/webkit/fileapi/local_file_system_cross_operation_unittest.cc b/webkit/fileapi/local_file_system_cross_operation_unittest.cc
index 2929b93..5466069 100644
--- a/webkit/fileapi/local_file_system_cross_operation_unittest.cc
+++ b/webkit/fileapi/local_file_system_cross_operation_unittest.cc
@@ -71,13 +71,11 @@ class CrossOperationTestHelper {
FileSystemMountPointProvider* mount_point_provider =
file_system_context_->GetMountPointProvider(src_type_);
mount_point_provider->GetFileSystemRootPathOnFileThread(
- SourceURL(""),
- true /* create */);
+ SourceURL(std::string()), true /* create */);
mount_point_provider =
file_system_context_->GetMountPointProvider(dest_type_);
mount_point_provider->GetFileSystemRootPathOnFileThread(
- DestURL(""),
- true /* create */);
+ DestURL(std::string()), true /* create */);
// Grant relatively big quota initially.
quota_manager_->SetQuota(origin_,
diff --git a/webkit/fileapi/obfuscated_file_util_unittest.cc b/webkit/fileapi/obfuscated_file_util_unittest.cc
index 387f28e..6a6d4a6 100644
--- a/webkit/fileapi/obfuscated_file_util_unittest.cc
+++ b/webkit/fileapi/obfuscated_file_util_unittest.cc
@@ -941,7 +941,7 @@ TEST_F(ObfuscatedFileUtilTest, TestDirectoryOps) {
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
ofu()->DeleteDirectory(context.get(), url));
- FileSystemURL root = CreateURLFromUTF8("");
+ FileSystemURL root = CreateURLFromUTF8(std::string());
EXPECT_FALSE(DirectoryExists(url));
EXPECT_FALSE(PathExists(url));
context.reset(NewContext(NULL));
@@ -1081,7 +1081,7 @@ TEST_F(ObfuscatedFileUtilTest, TestReadDirectory) {
}
TEST_F(ObfuscatedFileUtilTest, TestReadRootWithSlash) {
- TestReadDirectoryHelper(CreateURLFromUTF8(""));
+ TestReadDirectoryHelper(CreateURLFromUTF8(std::string()));
}
TEST_F(ObfuscatedFileUtilTest, TestReadRootWithEmptyString) {
diff --git a/webkit/fileapi/syncable/canned_syncable_file_system.cc b/webkit/fileapi/syncable/canned_syncable_file_system.cc
index 954d6a5..f323a1a 100644
--- a/webkit/fileapi/syncable/canned_syncable_file_system.cc
+++ b/webkit/fileapi/syncable/canned_syncable_file_system.cc
@@ -445,7 +445,8 @@ void CannedSyncableFileSystem::ClearChangeForURLInTracker(
}
FileSystemOperation* CannedSyncableFileSystem::NewOperation() {
- return file_system_context_->CreateFileSystemOperation(URL(""), NULL);
+ return file_system_context_->CreateFileSystemOperation(URL(std::string()),
+ NULL);
}
void CannedSyncableFileSystem::OnSyncEnabled(const FileSystemURL& url) {