summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/autocomplete_history_manager.cc27
-rw-r--r--chrome/browser/component_updater/component_updater_service.cc8
-rw-r--r--chrome/browser/history/text_database.cc9
-rw-r--r--chrome/browser/profiles/profile_info_cache.cc6
-rw-r--r--chrome/browser/safe_browsing/filter_false_positive_perftest.cc4
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page.cc6
-rw-r--r--chrome/common/extensions/extension.cc8
-rw-r--r--chrome/test/perf/page_cycler_test.cc5
8 files changed, 23 insertions, 50 deletions
diff --git a/chrome/browser/autocomplete_history_manager.cc b/chrome/browser/autocomplete_history_manager.cc
index 5265666..4006b29 100644
--- a/chrome/browser/autocomplete_history_manager.cc
+++ b/chrome/browser/autocomplete_history_manager.cc
@@ -19,7 +19,6 @@
#include "content/browser/tab_contents/tab_contents.h"
#include "webkit/forms/form_data.h"
-using base::StringPiece16;
using webkit::forms::FormData;
using webkit::forms::FormField;
@@ -64,32 +63,26 @@ bool IsSSN(const string16& text) {
return false;
int area;
- if (!base::StringToInt(StringPiece16(number_string.begin(),
- number_string.begin() + 3),
- &area)) {
+ if (!base::StringToInt(number_string.begin(),
+ number_string.begin() + 3,
+ &area))
return false;
- }
if (area < 1 ||
area == 666 ||
- area >= 900) {
+ area >= 900)
return false;
- }
int group;
- if (!base::StringToInt(StringPiece16(number_string.begin() + 3,
- number_string.begin() + 5),
- &group)
- || group == 0) {
+ if (!base::StringToInt(number_string.begin() + 3,
+ number_string.begin() + 5,
+ &group) || group == 0)
return false;
- }
int serial;
- if (!base::StringToInt(StringPiece16(number_string.begin() + 5,
- number_string.begin() + 9),
- &serial)
- || serial == 0) {
+ if (!base::StringToInt(number_string.begin() + 5,
+ number_string.begin() + 9,
+ &serial) || serial == 0)
return false;
- }
return true;
}
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc
index 699dbc5..6e2d98d 100644
--- a/chrome/browser/component_updater/component_updater_service.cc
+++ b/chrome/browser/component_updater/component_updater_service.cc
@@ -15,7 +15,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "base/string_number_conversions.h"
-#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/timer.h"
@@ -75,13 +74,10 @@ static std::string HexStringToID(const std::string& hexstr) {
std::string id;
for (size_t i = 0; i < hexstr.size(); ++i) {
int val;
- if (base::HexStringToInt(base::StringPiece(hexstr.begin() + i,
- hexstr.begin() + i + 1),
- &val)) {
+ if (base::HexStringToInt(hexstr.begin() + i, hexstr.begin() + i + 1, &val))
id.append(1, val + 'a');
- } else {
+ else
id.append(1, 'a');
- }
}
DCHECK(Extension::IdIsValid(id));
return id;
diff --git a/chrome/browser/history/text_database.cc b/chrome/browser/history/text_database.cc
index c5da03c..bb70fc7 100644
--- a/chrome/browser/history/text_database.cc
+++ b/chrome/browser/history/text_database.cc
@@ -111,14 +111,9 @@ TextDatabase::DBIdent TextDatabase::FileNameToID(const FilePath& file_path) {
return 0;
}
- // TODO: Once StringPiece supports a templated interface over the
- // underlying string type, use it here instead of substr, since that
- // will avoid needless string copies. StringPiece cannot be used
- // right now because FilePath::StringType could use either 8 or 16 bit
- // characters, depending on the OS.
int year, month;
- base::StringToInt(suffix.substr(0, 4), &year);
- base::StringToInt(suffix.substr(5, 2), &month);
+ base::StringToInt(suffix.begin(), suffix.begin() + 4, &year);
+ base::StringToInt(suffix.begin() + 5, suffix.begin() + 7, &month);
return year * 100 + month;
}
diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc
index 4b11f54..d71e788 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -13,7 +13,6 @@
#include "base/rand_util.h"
#include "base/stl_util.h"
#include "base/string_number_conversions.h"
-#include "base/string_piece.h"
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -682,9 +681,8 @@ bool ProfileInfoCache::IsDefaultAvatarIconUrl(const std::string& url,
return false;
int int_value = -1;
- if (base::StringToInt(base::StringPiece(url.begin() +
- strlen(kDefaultUrlPrefix),
- url.end()),
+ if (base::StringToInt(url.begin() + strlen(kDefaultUrlPrefix),
+ url.end(),
&int_value)) {
if (int_value < 0 ||
int_value >= static_cast<int>(kDefaultAvatarIconsCount))
diff --git a/chrome/browser/safe_browsing/filter_false_positive_perftest.cc b/chrome/browser/safe_browsing/filter_false_positive_perftest.cc
index 22412cb2..be48a4e 100644
--- a/chrome/browser/safe_browsing/filter_false_positive_perftest.cc
+++ b/chrome/browser/safe_browsing/filter_false_positive_perftest.cc
@@ -64,7 +64,6 @@
#include "base/path_service.h"
#include "base/rand_util.h"
#include "base/string_number_conversions.h"
-#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/time.h"
#include "chrome/browser/safe_browsing/bloom_filter.h"
@@ -243,8 +242,7 @@ void CalculateBloomFilterFalsePositives(
if (use_weights) {
std::string::size_type pos = url.find_last_of(",");
if (pos != std::string::npos) {
- base::StringToInt(base::StringPiece(url.begin() + pos + 1, url.end()),
- &weight);
+ base::StringToInt(url.begin() + pos + 1, url.end(), &weight);
url = url.substr(0, pos);
}
}
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
index 05dfb39..976c414 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
@@ -12,7 +12,6 @@
#include "base/i18n/rtl.h"
#include "base/lazy_instance.h"
#include "base/string_number_conversions.h"
-#include "base/string_piece.h"
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -468,9 +467,8 @@ void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) {
size_t colon_index = command.find(':');
if (colon_index != std::string::npos) {
DCHECK(colon_index < command.size() - 1);
- bool result = base::StringToInt(base::StringPiece(command.begin() +
- colon_index + 1,
- command.end()),
+ bool result = base::StringToInt(command.begin() + colon_index + 1,
+ command.end(),
&element_index);
command = command.substr(0, colon_index);
DCHECK(result);
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 9c1623a..4b790f0 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -17,7 +17,6 @@
#include "base/stl_util.h"
#include "base/string16.h"
#include "base/string_number_conversions.h"
-#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -80,13 +79,10 @@ const char kDefaultContentSecurityPolicy[] =
static void ConvertHexadecimalToIDAlphabet(std::string* id) {
for (size_t i = 0; i < id->size(); ++i) {
int val;
- if (base::HexStringToInt(base::StringPiece(id->begin() + i,
- id->begin() + i + 1),
- &val)) {
+ if (base::HexStringToInt(id->begin() + i, id->begin() + i + 1, &val))
(*id)[i] = val + 'a';
- } else {
+ else
(*id)[i] = 'a';
- }
}
}
diff --git a/chrome/test/perf/page_cycler_test.cc b/chrome/test/perf/page_cycler_test.cc
index e1f284e..31401ea 100644
--- a/chrome/test/perf/page_cycler_test.cc
+++ b/chrome/test/perf/page_cycler_test.cc
@@ -9,7 +9,6 @@
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/string_number_conversions.h"
-#include "base/string_piece.h"
#include "base/sys_string_conversions.h"
#include "base/test/test_timeouts.h"
#include "base/utf_string_conversions.h"
@@ -332,8 +331,8 @@ static bool HasDatabaseErrors(const std::string timings) {
new_pos = timings.find(',', pos);
if (new_pos == std::string::npos)
new_pos = timings.length();
- if (!base::StringToInt(base::StringPiece(timings.begin() + pos,
- timings.begin() + new_pos),
+ if (!base::StringToInt(timings.begin() + pos,
+ timings.begin() + new_pos,
&time)) {
LOG(ERROR) << "Invalid time reported: " << time_str;
return true;