summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/extension_action
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 /chrome/browser/extensions/api/extension_action
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 'chrome/browser/extensions/api/extension_action')
-rw-r--r--chrome/browser/extensions/api/extension_action/browser_action_apitest.cc8
-rw-r--r--chrome/browser/extensions/api/extension_action/page_action_apitest.cc16
-rw-r--r--chrome/browser/extensions/api/extension_action/script_badge_apitest.cc3
3 files changed, 12 insertions, 15 deletions
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
index 0a5497f..07845e4 100644
--- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
+++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
@@ -692,11 +692,9 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, TestTriggerBrowserAction) {
"window.domAutomationController.send(document.body.style."
"backgroundColor);";
std::string result;
- const std::string frame_xpath = "";
- EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString(tab,
- frame_xpath,
- script,
- &result));
+ const std::string frame_xpath;
+ EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString(
+ tab, frame_xpath, script, &result));
EXPECT_EQ(result, "red");
}
diff --git a/chrome/browser/extensions/api/extension_action/page_action_apitest.cc b/chrome/browser/extensions/api/extension_action/page_action_apitest.cc
index 232280a..cad5250 100644
--- a/chrome/browser/extensions/api/extension_action/page_action_apitest.cc
+++ b/chrome/browser/extensions/api/extension_action/page_action_apitest.cc
@@ -63,7 +63,7 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, Basic) {
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
service->browser_event_router()->PageActionExecuted(
- browser()->profile(), *action, tab_id, "", 0);
+ browser()->profile(), *action, tab_id, std::string(), 0);
EXPECT_TRUE(catcher.GetNextResult());
}
@@ -108,7 +108,7 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, AddPopup) {
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
service->browser_event_router()->PageActionExecuted(
- browser()->profile(), *page_action, tab_id, "", 1);
+ browser()->profile(), *page_action, tab_id, std::string(), 1);
ASSERT_TRUE(catcher.GetNextResult());
}
@@ -188,7 +188,7 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, OldPageActions) {
browser()->profile())->extension_service();
ExtensionAction* page_action = GetPageAction(*extension);
service->browser_event_router()->PageActionExecuted(
- browser()->profile(), *page_action, tab_id, "", 1);
+ browser()->profile(), *page_action, tab_id, std::string(), 1);
EXPECT_TRUE(catcher.GetNextResult());
}
}
@@ -260,7 +260,7 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, TestTriggerPageAction) {
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
service->browser_event_router()->PageActionExecuted(
- browser()->profile(), *page_action, tab_id, "", 0);
+ browser()->profile(), *page_action, tab_id, std::string(), 0);
EXPECT_TRUE(catcher.GetNextResult());
}
@@ -273,11 +273,9 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, TestTriggerPageAction) {
"window.domAutomationController.send(document.body.style."
"backgroundColor);";
std::string result;
- const std::string frame_xpath = "";
- EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString(tab,
- frame_xpath,
- script,
- &result));
+ const std::string frame_xpath;
+ EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString(
+ tab, frame_xpath, script, &result));
EXPECT_EQ(result, "red");
}
diff --git a/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc b/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc
index fd32e96..ff7fae7 100644
--- a/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc
+++ b/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc
@@ -88,7 +88,8 @@ IN_PROC_BROWSER_TEST_F(ScriptBadgeApiTest, Basics) {
ResultCatcher catcher;
// Visit a non-extension page so the extension can run a content script and
// cause the script badge to be animated in.
- ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(""));
+ ui_test_utils::NavigateToURL(browser(),
+ test_server()->GetURL(std::string()));
ASSERT_TRUE(catcher.GetNextResult());
}
EXPECT_TRUE(script_badge->GetIsVisible(tab_id));