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

Unified Diff: extensions/browser/web_ui_user_script_loader.cc

Issue 2231353002: Make FileReader return ownership of the string content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 4 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 | « extensions/browser/web_ui_user_script_loader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/web_ui_user_script_loader.cc
diff --git a/extensions/browser/web_ui_user_script_loader.cc b/extensions/browser/web_ui_user_script_loader.cc
index ee8fd098abde9b5f2ef06bb1599b7a8e45663f15..e713ffba97b69540224082796ee501a24d01921e 100644
--- a/extensions/browser/web_ui_user_script_loader.cc
+++ b/extensions/browser/web_ui_user_script_loader.cc
@@ -127,14 +127,16 @@ void WebUIUserScriptLoader::CreateWebUIURLFetchers(
void WebUIUserScriptLoader::OnSingleWebUIURLFetchComplete(
extensions::UserScript::File* script_file,
bool success,
- const std::string& data) {
+ std::unique_ptr<std::string> data) {
if (success) {
// Remove BOM from |data|.
- if (base::StartsWith(data, base::kUtf8ByteOrderMark,
+ if (base::StartsWith(*data, base::kUtf8ByteOrderMark,
base::CompareCase::SENSITIVE)) {
- script_file->set_content(data.substr(strlen(base::kUtf8ByteOrderMark)));
+ script_file->set_content(data->substr(strlen(base::kUtf8ByteOrderMark)));
} else {
- script_file->set_content(data);
+ // TODO(lazyboy): Script files should take ownership of |data|, i.e. the
+ // content of the script.
+ script_file->set_content(*data);
}
}
« no previous file with comments | « extensions/browser/web_ui_user_script_loader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698