summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/command_line_unittest.cc6
-rw-r--r--base/debug_util_posix.cc14
-rw-r--r--base/field_trial.cc8
-rw-r--r--base/field_trial_unittest.cc4
-rw-r--r--base/file_path_unittest.cc6
-rw-r--r--base/histogram.cc39
-rw-r--r--base/histogram_unittest.cc1
-rw-r--r--base/linked_ptr_unittest.cc17
-rw-r--r--base/logging.cc3
-rw-r--r--base/message_loop.cc1
-rw-r--r--base/nss_util.cc6
-rw-r--r--base/path_service.cc1
-rw-r--r--base/process_util_posix.cc2
-rw-r--r--base/profiler.cc1
-rw-r--r--base/scoped_temp_dir.cc1
-rw-r--r--base/sha1_win.cc1
-rw-r--r--base/shared_memory_posix.cc6
-rw-r--r--base/simple_thread_unittest.cc1
-rw-r--r--base/string16.cc1
-rw-r--r--base/string_split.cc1
-rw-r--r--base/sys_info_win.cc5
-rw-r--r--base/thread.cc1
-rw-r--r--base/thread_unittest.cc1
-rw-r--r--base/time.cc1
-rw-r--r--base/trace_event.cc4
-rw-r--r--base/tracked.cc4
-rw-r--r--base/tracked_objects.cc86
-rw-r--r--base/utf_string_conversions_unittest.cc3
-rw-r--r--base/values_unittest.cc1
-rw-r--r--base/win_util.cc3
-rw-r--r--base/win_util_unittest.cc3
-rw-r--r--base/worker_pool_linux.cc8
32 files changed, 124 insertions, 116 deletions
diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc
index 8c8803c..a34cf43 100644
--- a/base/command_line_unittest.cc
+++ b/base/command_line_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,7 +8,7 @@
#include "base/command_line.h"
#include "base/basictypes.h"
#include "base/file_path.h"
-#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
// To test Windows quoting behavior, we use a string that has some backslashes
@@ -123,7 +123,7 @@ TEST(CommandLineTest, AppendSwitches) {
std::string switch4 = "switch4";
std::string value4 = "\"a value with quotes\"";
std::string switch5 = "quotes";
- std::string value5 = WideToASCII(TRICKY);
+ std::string value5 = WideToUTF8(TRICKY);
CommandLine cl(FilePath(FILE_PATH_LITERAL("Program")));
diff --git a/base/debug_util_posix.cc b/base/debug_util_posix.cc
index 110cb20..329c7bc 100644
--- a/base/debug_util_posix.cc
+++ b/base/debug_util_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,6 +13,9 @@
#include <sys/types.h>
#include <unistd.h>
+#include <string>
+#include <vector>
+
#if defined(__GLIBCXX__)
#include <cxxabi.h>
#endif
@@ -31,7 +34,7 @@
#include "base/safe_strerror_posix.h"
#include "base/scoped_ptr.h"
#include "base/string_piece.h"
-#include "base/string_util.h"
+#include "base/stringprintf.h"
#if defined(USE_SYMBOLIZE)
#include "base/third_party/symbolize/symbolize.h"
@@ -109,10 +112,11 @@ bool GetBacktraceStrings(void **trace, int size,
symbol, sizeof(symbol))) {
// Don't call DemangleSymbols() here as the symbol is demangled by
// google::Symbolize().
- trace_strings->push_back(StringPrintf("%s [%p]", symbol, trace[i]));
+ trace_strings->push_back(
+ base::StringPrintf("%s [%p]", symbol, trace[i]));
symbolized = true;
} else {
- trace_strings->push_back(StringPrintf("%p", trace[i]));
+ trace_strings->push_back(base::StringPrintf("%p", trace[i]));
}
}
#else
@@ -126,7 +130,7 @@ bool GetBacktraceStrings(void **trace, int size,
symbolized = true;
} else {
for (int i = 0; i < size; ++i) {
- trace_strings->push_back(StringPrintf("%p", trace[i]));
+ trace_strings->push_back(base::StringPrintf("%p", trace[i]));
}
}
#endif // defined(USE_SYMBOLIZE)
diff --git a/base/field_trial.cc b/base/field_trial.cc
index 9a71066..3575001 100644
--- a/base/field_trial.cc
+++ b/base/field_trial.cc
@@ -1,12 +1,12 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
#include "base/field_trial.h"
+
#include "base/logging.h"
#include "base/rand_util.h"
-#include "base/string_util.h"
+#include "base/stringprintf.h"
using base::TimeTicks;
@@ -49,7 +49,7 @@ int FieldTrial::AppendGroup(const std::string& name,
// This is the group that crossed the random line, so we do the assignment.
group_ = next_group_number_;
if (name.empty())
- StringAppendF(&group_name_, "%d", group_);
+ base::StringAppendF(&group_name_, "%d", group_);
else
group_name_ = name;
}
diff --git a/base/field_trial_unittest.cc b/base/field_trial_unittest.cc
index 7d2ea18..54523dd 100644
--- a/base/field_trial_unittest.cc
+++ b/base/field_trial_unittest.cc
@@ -6,7 +6,7 @@
#include "base/field_trial.h"
-#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
class FieldTrialTest : public testing::Test {
@@ -76,7 +76,7 @@ TEST_F(FieldTrialTest, RemainingProbability) {
scoped_refptr<FieldTrial> trial;
int counter = 0;
do {
- std::string name = StringPrintf("trial%d", ++counter);
+ std::string name = base::StringPrintf("trial%d", ++counter);
trial = new FieldTrial(name, 10);
trial->AppendGroup(loser, 5); // 50% chance of not being chosen.
} while (trial->group() != FieldTrial::kNotParticipating);
diff --git a/base/file_path_unittest.cc b/base/file_path_unittest.cc
index 48bf23c..6eb106b 100644
--- a/base/file_path_unittest.cc
+++ b/base/file_path_unittest.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/file_util.h"
-#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -307,7 +307,7 @@ TEST_F(FilePathTest, Append) {
// TODO(erikkay): It would be nice to have a unicode test append value to
// handle the case when AppendASCII is passed UTF8
#if defined(OS_WIN)
- std::string ascii = WideToASCII(leaf);
+ std::string ascii = WideToUTF8(leaf);
#elif defined(OS_POSIX)
std::string ascii = leaf;
#endif
diff --git a/base/histogram.cc b/base/histogram.cc
index 896867f..add7954 100644
--- a/base/histogram.cc
+++ b/base/histogram.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,12 +10,14 @@
#include "base/histogram.h"
#include <math.h>
+
+#include <algorithm>
#include <string>
#include "base/lock.h"
#include "base/logging.h"
#include "base/pickle.h"
-#include "base/string_util.h"
+#include "base/stringprintf.h"
using base::TimeDelta;
@@ -340,10 +342,10 @@ double Histogram::GetPeakBucketSize(const SampleSet& snapshot) const {
void Histogram::WriteAsciiHeader(const SampleSet& snapshot,
Count sample_count,
std::string* output) const {
- StringAppendF(output,
- "Histogram: %s recorded %d samples",
- histogram_name().c_str(),
- sample_count);
+ base::StringAppendF(output,
+ "Histogram: %s recorded %d samples",
+ histogram_name().c_str(),
+ sample_count);
if (0 == sample_count) {
DCHECK_EQ(snapshot.sum(), 0);
} else {
@@ -352,12 +354,13 @@ void Histogram::WriteAsciiHeader(const SampleSet& snapshot,
- average * average;
double standard_deviation = sqrt(variance);
- StringAppendF(output,
- ", average = %.1f, standard deviation = %.1f",
- average, standard_deviation);
+ base::StringAppendF(output,
+ ", average = %.1f, standard deviation = %.1f",
+ average, standard_deviation);
}
if (flags_ & ~kHexRangePrintingFlag )
- StringAppendF(output, " (flags = 0x%x)", flags_ & ~kHexRangePrintingFlag);
+ base::StringAppendF(output, " (flags = 0x%x)",
+ flags_ & ~kHexRangePrintingFlag);
}
void Histogram::WriteAsciiBucketContext(const int64 past,
@@ -369,22 +372,22 @@ void Histogram::WriteAsciiBucketContext(const int64 past,
WriteAsciiBucketValue(current, scaled_sum, output);
if (0 < i) {
double percentage = past / scaled_sum;
- StringAppendF(output, " {%3.1f%%}", percentage);
+ base::StringAppendF(output, " {%3.1f%%}", percentage);
}
}
const std::string Histogram::GetAsciiBucketRange(size_t i) const {
std::string result;
if (kHexRangePrintingFlag & flags_)
- StringAppendF(&result, "%#x", ranges(i));
+ base::StringAppendF(&result, "%#x", ranges(i));
else
- StringAppendF(&result, "%d", ranges(i));
+ base::StringAppendF(&result, "%d", ranges(i));
return result;
}
void Histogram::WriteAsciiBucketValue(Count current, double scaled_sum,
std::string* output) const {
- StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum);
+ base::StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum);
}
void Histogram::WriteAsciiBucketGraph(double current_size, double max_size,
@@ -853,10 +856,12 @@ void StatisticsRecorder::WriteGraph(const std::string& query,
std::string* output) {
if (!histograms_)
return;
- if (query.length())
- StringAppendF(output, "Collections of histograms for %s\n", query.c_str());
- else
+ if (query.length()) {
+ base::StringAppendF(output, "Collections of histograms for %s\n",
+ query.c_str());
+ } else {
output->append("Collections of all histograms\n");
+ }
Histograms snapshot;
GetSnapshot(query, &snapshot);
diff --git a/base/histogram_unittest.cc b/base/histogram_unittest.cc
index 56c733b..4637a5f 100644
--- a/base/histogram_unittest.cc
+++ b/base/histogram_unittest.cc
@@ -5,7 +5,6 @@
// Test of Histogram class
#include "base/histogram.h"
-#include "base/string_util.h"
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/linked_ptr_unittest.cc b/base/linked_ptr_unittest.cc
index f0b8989..e65b687 100644
--- a/base/linked_ptr_unittest.cc
+++ b/base/linked_ptr_unittest.cc
@@ -1,12 +1,11 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include "base/linked_ptr.h"
-
-#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -17,17 +16,17 @@ std::string history;
// Class which tracks allocation/deallocation
struct A {
- A(): mynum(num++) { history += StringPrintf("A%d ctor\n", mynum); }
- virtual ~A() { history += StringPrintf("A%d dtor\n", mynum); }
- virtual void Use() { history += StringPrintf("A%d use\n", mynum); }
+ A(): mynum(num++) { history += base::StringPrintf("A%d ctor\n", mynum); }
+ virtual ~A() { history += base::StringPrintf("A%d dtor\n", mynum); }
+ virtual void Use() { history += base::StringPrintf("A%d use\n", mynum); }
int mynum;
};
// Subclass
struct B: public A {
- B() { history += StringPrintf("B%d ctor\n", mynum); }
- ~B() { history += StringPrintf("B%d dtor\n", mynum); }
- virtual void Use() { history += StringPrintf("B%d use\n", mynum); }
+ B() { history += base::StringPrintf("B%d ctor\n", mynum); }
+ ~B() { history += base::StringPrintf("B%d dtor\n", mynum); }
+ virtual void Use() { history += base::StringPrintf("B%d use\n", mynum); }
};
} // namespace
diff --git a/base/logging.cc b/base/logging.cc
index b123a0a..2d61910 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -50,7 +50,6 @@ typedef pthread_mutex_t* MutexHandle;
#endif
#include "base/process_util.h"
#include "base/string_piece.h"
-#include "base/string_util.h"
#include "base/utf_string_conversions.h"
namespace logging {
diff --git a/base/message_loop.cc b/base/message_loop.cc
index 1d86f79..32ac12c 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -11,7 +11,6 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/message_pump_default.h"
-#include "base/string_util.h"
#include "base/thread_local.h"
#if defined(OS_MACOSX)
diff --git a/base/nss_util.cc b/base/nss_util.cc
index 35b7cc5..bf772aa 100644
--- a/base/nss_util.cc
+++ b/base/nss_util.cc
@@ -21,7 +21,7 @@
#include "base/file_util.h"
#include "base/logging.h"
#include "base/singleton.h"
-#include "base/string_util.h"
+#include "base/stringprintf.h"
// USE_NSS means we use NSS for everything crypto-related. If USE_NSS is not
// defined, such as on Mac and Windows, we use NSS for SSL only -- we don't
@@ -33,6 +33,8 @@
#include "base/scoped_ptr.h"
#endif // defined(USE_NSS)
+namespace base {
+
namespace {
#if defined(USE_NSS)
@@ -301,8 +303,6 @@ class NSSInitSingleton {
} // namespace
-namespace base {
-
void EnsureNSPRInit() {
Singleton<NSPRInitSingleton>::get();
}
diff --git a/base/path_service.cc b/base/path_service.cc
index e363fe6..57cbc33 100644
--- a/base/path_service.cc
+++ b/base/path_service.cc
@@ -16,7 +16,6 @@
#include "base/lock.h"
#include "base/logging.h"
#include "base/singleton.h"
-#include "base/string_util.h"
namespace base {
bool PathProvider(int key, FilePath* result);
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index cea7e9a..33b89d2 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -25,7 +25,7 @@
#include "base/platform_thread.h"
#include "base/process_util.h"
#include "base/scoped_ptr.h"
-#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/time.h"
#include "base/waitable_event.h"
diff --git a/base/profiler.cc b/base/profiler.cc
index e291117..b66664b 100644
--- a/base/profiler.cc
+++ b/base/profiler.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/profiler.h"
-#include "base/string_util.h"
#if defined(USE_TCMALLOC) && defined(OS_LINUX)
#include "third_party/tcmalloc/chromium/src/google/profiler.h"
diff --git a/base/scoped_temp_dir.cc b/base/scoped_temp_dir.cc
index 53452f1..958dcbc 100644
--- a/base/scoped_temp_dir.cc
+++ b/base/scoped_temp_dir.cc
@@ -6,7 +6,6 @@
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/string_util.h"
ScopedTempDir::ScopedTempDir() {
}
diff --git a/base/sha1_win.cc b/base/sha1_win.cc
index b79ac38..0d0cf2c 100644
--- a/base/sha1_win.cc
+++ b/base/sha1_win.cc
@@ -8,7 +8,6 @@
#include <wincrypt.h>
#include "base/logging.h"
-#include "base/string_util.h"
namespace base {
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc
index 009f91e..2dae8af 100644
--- a/base/shared_memory_posix.cc
+++ b/base/shared_memory_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,7 +14,7 @@
#include "base/logging.h"
#include "base/platform_thread.h"
#include "base/safe_strerror_posix.h"
-#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
namespace base {
@@ -133,7 +133,7 @@ bool SharedMemory::FilePathForMemoryName(const std::wstring& memname,
return false;
*path = temp_dir.AppendASCII("com.google.chrome.shmem." +
- WideToASCII(memname));
+ WideToUTF8(memname));
return true;
}
diff --git a/base/simple_thread_unittest.cc b/base/simple_thread_unittest.cc
index df0f5c6..85995c2 100644
--- a/base/simple_thread_unittest.cc
+++ b/base/simple_thread_unittest.cc
@@ -6,7 +6,6 @@
#include "base/lock.h"
#include "base/simple_thread.h"
#include "base/string_number_conversions.h"
-#include "base/string_util.h"
#include "base/waitable_event.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/string16.cc b/base/string16.cc
index d1d0908..f7eaf7e 100644
--- a/base/string16.cc
+++ b/base/string16.cc
@@ -13,7 +13,6 @@
#elif defined(WCHAR_T_IS_UTF32)
-#include "base/string_util.h"
#include "base/utf_string_conversions.h"
namespace base {
diff --git a/base/string_split.cc b/base/string_split.cc
index 2b4deb5..dc7e7ad 100644
--- a/base/string_split.cc
+++ b/base/string_split.cc
@@ -4,6 +4,7 @@
#include "base/string_split.h"
+#include "base/logging.h"
#include "base/string_util.h"
namespace base {
diff --git a/base/sys_info_win.cc b/base/sys_info_win.cc
index ed4d2fb..fa3ab43 100644
--- a/base/sys_info_win.cc
+++ b/base/sys_info_win.cc
@@ -9,7 +9,7 @@
#include "base/file_path.h"
#include "base/logging.h"
#include "base/scoped_ptr.h"
-#include "base/string_util.h"
+#include "base/stringprintf.h"
namespace base {
@@ -58,7 +58,8 @@ std::string SysInfo::OperatingSystemVersion() {
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&info);
- return StringPrintf("%lu.%lu", info.dwMajorVersion, info.dwMinorVersion);
+ return base::StringPrintf("%lu.%lu",
+ info.dwMajorVersion, info.dwMinorVersion);
}
// TODO: Implement OperatingSystemVersionComplete, which would include
diff --git a/base/thread.cc b/base/thread.cc
index 82b5cf9..41d78f0 100644
--- a/base/thread.cc
+++ b/base/thread.cc
@@ -5,7 +5,6 @@
#include "base/thread.h"
#include "base/lazy_instance.h"
-#include "base/string_util.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/thread_local.h"
#include "base/waitable_event.h"
diff --git a/base/thread_unittest.cc b/base/thread_unittest.cc
index 696cfc2a9..1651a6a 100644
--- a/base/thread_unittest.cc
+++ b/base/thread_unittest.cc
@@ -8,7 +8,6 @@
#include "base/lock.h"
#include "base/message_loop.h"
-#include "base/string_util.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
diff --git a/base/time.cc b/base/time.cc
index a274056..383f939 100644
--- a/base/time.cc
+++ b/base/time.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/time.h"
-#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "base/third_party/nspr/prtime.h"
diff --git a/base/trace_event.cc b/base/trace_event.cc
index fbfd426..6388c8c 100644
--- a/base/trace_event.cc
+++ b/base/trace_event.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,7 +10,7 @@
#include "base/path_service.h"
#include "base/platform_thread.h"
#include "base/process_util.h"
-#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "base/time.h"
diff --git a/base/tracked.cc b/base/tracked.cc
index a9d6ad7..8ae7447 100644
--- a/base/tracked.cc
+++ b/base/tracked.cc
@@ -4,7 +4,7 @@
#include "base/tracked.h"
-#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/tracked_objects.h"
using base::TimeTicks;
@@ -28,7 +28,7 @@ Location::Location()
void Location::Write(bool display_filename, bool display_function_name,
std::string* output) const {
- StringAppendF(output, "%s[%d] ",
+ base::StringAppendF(output, "%s[%d] ",
display_filename ? file_name_ : "line",
line_number_);
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc
index cc2cae1..a3c125b 100644
--- a/base/tracked_objects.cc
+++ b/base/tracked_objects.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#include "base/format_macros.h"
#include "base/message_loop.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
using base::TimeDelta;
@@ -53,10 +54,12 @@ void DeathData::AddDeathData(const DeathData& other) {
void DeathData::Write(std::string* output) const {
if (!count_)
return;
- if (1 == count_)
- StringAppendF(output, "(1)Life in %dms ", AverageMsDuration());
- else
- StringAppendF(output, "(%d)Lives %dms/life ", count_, AverageMsDuration());
+ if (1 == count_) {
+ base::StringAppendF(output, "(1)Life in %dms ", AverageMsDuration());
+ } else {
+ base::StringAppendF(output, "(%d)Lives %dms/life ",
+ count_, AverageMsDuration());
+ }
}
void DeathData::Clear() {
@@ -538,9 +541,9 @@ const std::string Snapshot::DeathThreadName() const {
void Snapshot::Write(std::string* output) const {
death_data_.Write(output);
- StringAppendF(output, "%s->%s ",
- birth_->birth_thread()->ThreadName().c_str(),
- death_thread_->ThreadName().c_str());
+ base::StringAppendF(output, "%s->%s ",
+ birth_->birth_thread()->ThreadName().c_str(),
+ death_thread_->ThreadName().c_str());
birth_->location().Write(true, true, output);
}
@@ -648,33 +651,37 @@ void Aggregation::Write(std::string* output) const {
if (locations_.size() == 1) {
locations_.begin()->first.Write(true, true, output);
} else {
- StringAppendF(output, "%" PRIuS " Locations. ", locations_.size());
- if (birth_files_.size() > 1)
- StringAppendF(output, "%" PRIuS " Files. ", birth_files_.size());
- else
- StringAppendF(output, "All born in %s. ",
- birth_files_.begin()->first.c_str());
+ base::StringAppendF(output, "%" PRIuS " Locations. ", locations_.size());
+ if (birth_files_.size() > 1) {
+ base::StringAppendF(output, "%" PRIuS " Files. ", birth_files_.size());
+ } else {
+ base::StringAppendF(output, "All born in %s. ",
+ birth_files_.begin()->first.c_str());
+ }
}
- if (birth_threads_.size() > 1)
- StringAppendF(output, "%" PRIuS " BirthingThreads. ",
- birth_threads_.size());
- else
- StringAppendF(output, "All born on %s. ",
- birth_threads_.begin()->first->ThreadName().c_str());
+ if (birth_threads_.size() > 1) {
+ base::StringAppendF(output, "%" PRIuS " BirthingThreads. ",
+ birth_threads_.size());
+ } else {
+ base::StringAppendF(output, "All born on %s. ",
+ birth_threads_.begin()->first->ThreadName().c_str());
+ }
if (death_threads_.size() > 1) {
- StringAppendF(output, "%" PRIuS " DeathThreads. ", death_threads_.size());
+ base::StringAppendF(output, "%" PRIuS " DeathThreads. ",
+ death_threads_.size());
} else {
- if (death_threads_.begin()->first)
- StringAppendF(output, "All deleted on %s. ",
- death_threads_.begin()->first->ThreadName().c_str());
- else
+ if (death_threads_.begin()->first) {
+ base::StringAppendF(output, "All deleted on %s. ",
+ death_threads_.begin()->first->ThreadName().c_str());
+ } else {
output->append("All these objects are still alive.");
+ }
}
if (birth_count_ > 1)
- StringAppendF(output, "Births=%d ", birth_count_);
+ base::StringAppendF(output, "Births=%d ", birth_count_);
DeathData::Write(output);
}
@@ -969,23 +976,24 @@ bool Comparator::WriteSortGrouping(const Snapshot& sample,
bool wrote_data = false;
switch (selector_) {
case BIRTH_THREAD:
- StringAppendF(output, "All new on %s ",
- sample.birth_thread()->ThreadName().c_str());
+ base::StringAppendF(output, "All new on %s ",
+ sample.birth_thread()->ThreadName().c_str());
wrote_data = true;
break;
case DEATH_THREAD:
- if (sample.death_thread())
- StringAppendF(output, "All deleted on %s ",
- sample.DeathThreadName().c_str());
- else
+ if (sample.death_thread()) {
+ base::StringAppendF(output, "All deleted on %s ",
+ sample.DeathThreadName().c_str());
+ } else {
output->append("All still alive ");
+ }
wrote_data = true;
break;
case BIRTH_FILE:
- StringAppendF(output, "All born in %s ",
- sample.location().file_name());
+ base::StringAppendF(output, "All born in %s ",
+ sample.location().file_name());
break;
case BIRTH_FUNCTION:
@@ -1008,11 +1016,11 @@ void Comparator::WriteSnapshot(const Snapshot& sample,
sample.death_data().Write(output);
if (!(combined_selectors_ & BIRTH_THREAD) ||
!(combined_selectors_ & DEATH_THREAD))
- StringAppendF(output, "%s->%s ",
- (combined_selectors_ & BIRTH_THREAD) ? "*" :
- sample.birth().birth_thread()->ThreadName().c_str(),
- (combined_selectors_ & DEATH_THREAD) ? "*" :
- sample.DeathThreadName().c_str());
+ base::StringAppendF(output, "%s->%s ",
+ (combined_selectors_ & BIRTH_THREAD) ? "*" :
+ sample.birth().birth_thread()->ThreadName().c_str(),
+ (combined_selectors_ & DEATH_THREAD) ? "*" :
+ sample.DeathThreadName().c_str());
sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE),
!(combined_selectors_ & BIRTH_FUNCTION),
output);
diff --git a/base/utf_string_conversions_unittest.cc b/base/utf_string_conversions_unittest.cc
index 01a4125..2687a55 100644
--- a/base/utf_string_conversions_unittest.cc
+++ b/base/utf_string_conversions_unittest.cc
@@ -1,9 +1,10 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/basictypes.h"
#include "base/logging.h"
+#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/values_unittest.cc b/base/values_unittest.cc
index 4b4016c..a36c588 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -5,7 +5,6 @@
#include <limits>
#include "base/scoped_ptr.h"
-#include "base/string_util.h"
#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
diff --git a/base/win_util.cc b/base/win_util.cc
index 49a20c8..66dbbe0 100644
--- a/base/win_util.cc
+++ b/base/win_util.cc
@@ -12,6 +12,7 @@
#include "base/scoped_handle.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
namespace win_util {
@@ -373,7 +374,7 @@ std::wstring FormatMessage(unsigned messageid) {
LocalFree(reinterpret_cast<HLOCAL>(string_buffer));
} else {
// The formating failed. simply convert the message value into a string.
- SStringPrintf(&formatted_string, L"message number %d", messageid);
+ base::SStringPrintf(&formatted_string, L"message number %d", messageid);
}
return formatted_string;
}
diff --git a/base/win_util_unittest.cc b/base/win_util_unittest.cc
index f20e7d2..0ff1eca 100644
--- a/base/win_util_unittest.cc
+++ b/base/win_util_unittest.cc
@@ -4,9 +4,10 @@
#include <windows.h>
-#include "testing/gtest/include/gtest/gtest.h"
+#include "base/basictypes.h"
#include "base/string_util.h"
#include "base/win_util.h"
+#include "testing/gtest/include/gtest/gtest.h"
// The test is somewhat silly, because the Vista bots some have UAC enabled
// and some have it disabled. At least we check that it does not crash.
diff --git a/base/worker_pool_linux.cc b/base/worker_pool_linux.cc
index b9c85b3..2aa1df2 100644
--- a/base/worker_pool_linux.cc
+++ b/base/worker_pool_linux.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,7 +9,7 @@
#include "base/logging.h"
#include "base/platform_thread.h"
#include "base/ref_counted.h"
-#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/task.h"
namespace {
@@ -66,8 +66,8 @@ class WorkerThread : public PlatformThread::Delegate {
};
void WorkerThread::ThreadMain() {
- const std::string name =
- StringPrintf("%s/%d", name_prefix_.c_str(), PlatformThread::CurrentId());
+ const std::string name = base::StringPrintf(
+ "%s/%d", name_prefix_.c_str(), PlatformThread::CurrentId());
PlatformThread::SetName(name.c_str());
for (;;) {