Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Unified Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 887023002: [DevTools] DevToolsUIBindings::CallClientFunction - reduce number of string copyings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_ui_bindings.cc
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc
index c542b5157c2d0318fe1c536256a6508c831ab7e7..982842db17ca0f9d74691d4c97b0eef1240385c2 100644
--- a/chrome/browser/devtools/devtools_ui_bindings.cc
+++ b/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -868,24 +868,23 @@ void DevToolsUIBindings::CallClientFunction(const std::string& function_name,
const base::Value* arg1,
const base::Value* arg2,
const base::Value* arg3) {
- std::string params;
+ std::string javascript = function_name + "(";
if (arg1) {
std::string json;
base::JSONWriter::Write(arg1, &json);
- params.append(json);
+ javascript.append(json);
if (arg2) {
base::JSONWriter::Write(arg2, &json);
- params.append(", " + json);
+ javascript.append(", ").append(json);
if (arg3) {
base::JSONWriter::Write(arg3, &json);
- params.append(", " + json);
+ javascript.append(", ").append(json);
}
}
}
-
- base::string16 javascript = base::UTF8ToUTF16(
- function_name + "(" + params + ");");
- web_contents_->GetMainFrame()->ExecuteJavaScript(javascript);
+ javascript.append(");");
+ web_contents_->GetMainFrame()->ExecuteJavaScript(
+ base::UTF8ToUTF16(javascript));
}
void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698