summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorricea <ricea@chromium.org>2015-07-01 08:56:50 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-01 15:57:26 +0000
commita01edeadfb2c16eec6949ab6dcd502c84e13ac77 (patch)
tree3b7b5ef6fe77159bcdc428fa06e4187b01dedb3c /dbus
parent1de79f036e95944a33cc0cc3d4e88f446b2f73cd (diff)
downloadchromium_src-a01edeadfb2c16eec6949ab6dcd502c84e13ac77.zip
chromium_src-a01edeadfb2c16eec6949ab6dcd502c84e13ac77.tar.gz
chromium_src-a01edeadfb2c16eec6949ab6dcd502c84e13ac77.tar.bz2
Replace StringPrintf("%d", ...) with IntToString()
IntToString() is faster, more compact and clearer than StringPrintf("%d", ...). This CL reduces the size of the text segment of a Linux "Official" build by 1001 bytes. This CL also adds a perftest to verify that IntToString() is faster than StringPrintf("%d", ...). Notes for reviewers: * courgette/memory_monitor.cc contains LOG(INFO) statements. I bypassed presubmit rather than remove them. * components/browser_watcher/watcher_client_win_unittest.cc passed a HANDLE through an int. I don't know why that worked on Win64. I have tried to make it 64-bit safe. BUG=504372 TEST=compile, selected unit tests TBR=stevenjb@chromium.org NOPRESUBMIT=true Review URL: https://codereview.chromium.org/1213443002 Cr-Commit-Position: refs/heads/master@{#337027}
Diffstat (limited to 'dbus')
-rw-r--r--dbus/message.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/dbus/message.cc b/dbus/message.cc
index ddcf85f..3b021e5 100644
--- a/dbus/message.cc
+++ b/dbus/message.cc
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/format_macros.h"
#include "base/logging.h"
+#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "dbus/object_path.h"
@@ -101,7 +102,7 @@ std::string Message::ToStringInternal(const std::string& indent,
uint8 value = 0;
if (!reader->PopByte(&value))
return kBrokenMessage;
- output += indent + "byte " + base::StringPrintf("%d", value) + "\n";
+ output += indent + "byte " + base::IntToString(value) + "\n";
break;
}
case BOOL: {
@@ -115,21 +116,21 @@ std::string Message::ToStringInternal(const std::string& indent,
int16 value = 0;
if (!reader->PopInt16(&value))
return kBrokenMessage;
- output += indent + "int16 " + base::StringPrintf("%d", value) + "\n";
+ output += indent + "int16 " + base::IntToString(value) + "\n";
break;
}
case UINT16: {
uint16 value = 0;
if (!reader->PopUint16(&value))
return kBrokenMessage;
- output += indent + "uint16 " + base::StringPrintf("%d", value) + "\n";
+ output += indent + "uint16 " + base::IntToString(value) + "\n";
break;
}
case INT32: {
int32 value = 0;
if (!reader->PopInt32(&value))
return kBrokenMessage;
- output += indent + "int32 " + base::StringPrintf("%d", value) + "\n";
+ output += indent + "int32 " + base::IntToString(value) + "\n";
break;
}
case UINT32: {
@@ -228,7 +229,7 @@ std::string Message::ToStringInternal(const std::string& indent,
if (!reader->PopFileDescriptor(&file_descriptor))
return kBrokenMessage;
output += indent + "fd#" +
- base::StringPrintf("%d", file_descriptor.value()) + "\n";
+ base::IntToString(file_descriptor.value()) + "\n";
break;
}
default: