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

Unified Diff: chrome/browser/ui/app_list/start_page_service.cc

Issue 891473004: StartPageService: Use a StringPiece instead of modifying a string. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@jsonstring-stringpiece
Patch Set: Created 5 years, 10 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/ui/app_list/start_page_service.cc
diff --git a/chrome/browser/ui/app_list/start_page_service.cc b/chrome/browser/ui/app_list/start_page_service.cc
index de3a1c33baabc09a621dff434926b8357f7743d4..9bb40fcfee593900f5201c23508b1bb579cf3863 100644
--- a/chrome/browser/ui/app_list/start_page_service.cc
+++ b/chrome/browser/ui/app_list/start_page_service.cc
@@ -12,6 +12,7 @@
#include "base/memory/singleton.h"
#include "base/metrics/user_metrics.h"
#include "base/prefs/pref_service.h"
+#include "base/strings/string_piece.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/google/google_profile_helper.h"
@@ -540,10 +541,11 @@ void StartPageService::OnURLFetchComplete(const net::URLFetcher* source) {
// Remove XSSI guard for JSON parsing.
size_t json_start_index = json_data.find("{");
+ base::StringPiece json_data_substr(json_data);
if (json_start_index != std::string::npos)
- json_data.erase(0, json_start_index);
+ json_data_substr.remove_prefix(json_start_index);
- JSONStringValueSerializer deserializer(json_data);
+ JSONStringValueSerializer deserializer(json_data_substr);
deserializer.set_allow_trailing_comma(true);
int error_code = 0;
scoped_ptr<base::Value> doodle_json(
« 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