From e59558b78e8c6a1b0bd916a724724b638c3c91b6 Mon Sep 17 00:00:00 2001 From: "dcheng@chromium.org" Date: Tue, 9 Apr 2013 05:45:17 +0000 Subject: 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 --- ppapi/native_client/src/trusted/plugin/plugin.cc | 2 -- ppapi/native_client/src/trusted/plugin/plugin_error.h | 2 +- ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc | 4 +--- ppapi/native_client/src/trusted/plugin/service_runtime.cc | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) (limited to 'ppapi/native_client') diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index e1f3ad9..7b2f0a9 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -677,7 +677,6 @@ bool Plugin::Init(uint32_t argc, const char* argn[], const char* argv[]) { return status; } - Plugin::Plugin(PP_Instance pp_instance) : pp::InstancePrivate(pp_instance), scriptable_plugin_(NULL), @@ -688,7 +687,6 @@ Plugin::Plugin(PP_Instance pp_instance) nacl_ready_state_(UNSENT), nexe_error_reported_(false), wrapper_factory_(NULL), - last_error_string_(""), enable_dev_interfaces_(false), is_installed_(false), init_time_(0), diff --git a/ppapi/native_client/src/trusted/plugin/plugin_error.h b/ppapi/native_client/src/trusted/plugin/plugin_error.h index 90c0284..f02ef83 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin_error.h +++ b/ppapi/native_client/src/trusted/plugin/plugin_error.h @@ -109,7 +109,7 @@ class ErrorInfo { } void Reset() { - SetReport(ERROR_UNKNOWN, ""); + SetReport(ERROR_UNKNOWN, std::string()); } void SetReport(PluginErrorCode error_code, const std::string& message) { diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc index a7d3f24..ff0982e 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc @@ -224,9 +224,7 @@ void PnaclTranslateThread::DoTranslate() { } PLUGIN_PRINTF(("PnaclTranslateThread done with chunks\n")); // Finish llc. - if(!llc_subprocess_->InvokeSrpcMethod("StreamEnd", - "", - ¶ms)) { + if (!llc_subprocess_->InvokeSrpcMethod("StreamEnd", std::string(), ¶ms)) { PLUGIN_PRINTF(("PnaclTranslateThread StreamEnd failed\n")); if (llc_subprocess_->srpc_client()->GetLastError() == NACL_SRPC_RESULT_APP_ERROR) { diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc index 00f64c7..68a50d3 100644 --- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc +++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc @@ -846,7 +846,7 @@ nacl::string ServiceRuntime::GetCrashLogOutput() { if (NULL != subprocess_.get()) { return subprocess_->GetCrashLogOutput(); } else { - return ""; + return std::string(); } } -- cgit v1.1