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

Unified Diff: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc

Issue 7397021: Re-land r93365 - add RefCountedString (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 9 years, 5 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 | « chrome/browser/ui/webui/ntp/ntp_resource_cache.h ('k') | chrome/browser/ui/webui/options/options_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
index bf0f990b8955d2b4e7254443f7e124869c499d02..5b970eaa56b1acf9111320ea6d282e7bdb8d7d2d 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -172,7 +172,7 @@ NTPResourceCache::NTPResourceCache(Profile* profile) : profile_(profile) {
NTPResourceCache::~NTPResourceCache() {}
-RefCountedBytes* NTPResourceCache::GetNewTabHTML(bool is_incognito) {
+RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (is_incognito) {
if (!new_tab_incognito_html_.get())
@@ -185,7 +185,7 @@ RefCountedBytes* NTPResourceCache::GetNewTabHTML(bool is_incognito) {
: new_tab_html_.get();
}
-RefCountedBytes* NTPResourceCache::GetNewTabCSS(bool is_incognito) {
+RefCountedMemory* NTPResourceCache::GetNewTabCSS(bool is_incognito) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (is_incognito) {
if (!new_tab_incognito_css_.get())
@@ -260,10 +260,7 @@ void NTPResourceCache::CreateNewTabIncognitoHTML() {
std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
incognito_tab_html, &localized_strings);
- new_tab_incognito_html_ = new RefCountedBytes;
- new_tab_incognito_html_->data.resize(full_html.size());
- std::copy(full_html.begin(), full_html.end(),
- new_tab_incognito_html_->data.begin());
+ new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html);
}
void NTPResourceCache::CreateNewTabHTML() {
@@ -440,9 +437,7 @@ void NTPResourceCache::CreateNewTabHTML() {
}
}
- new_tab_html_ = new RefCountedBytes;
- new_tab_html_->data.resize(full_html.size());
- std::copy(full_html.begin(), full_html.end(), new_tab_html_->data.begin());
+ new_tab_html_ = base::RefCountedString::TakeString(&full_html);
}
void NTPResourceCache::CreateNewTabIncognitoCSS() {
@@ -475,10 +470,7 @@ void NTPResourceCache::CreateNewTabIncognitoCSS() {
std::string full_css = ReplaceStringPlaceholders(
new_tab_theme_css, subst, NULL);
- new_tab_incognito_css_ = new RefCountedBytes;
- new_tab_incognito_css_->data.resize(full_css.size());
- std::copy(full_css.begin(), full_css.end(),
- new_tab_incognito_css_->data.begin());
+ new_tab_incognito_css_ = base::RefCountedString::TakeString(&full_css);
}
void NTPResourceCache::CreateNewTabCSS() {
@@ -573,8 +565,5 @@ void NTPResourceCache::CreateNewTabCSS() {
// Create the string from our template and the replacements.
std::string css_string;
css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
- new_tab_css_ = new RefCountedBytes;
- new_tab_css_->data.resize(css_string.size());
- std::copy(css_string.begin(), css_string.end(),
- new_tab_css_->data.begin());
+ new_tab_css_ = base::RefCountedString::TakeString(&css_string);
}
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_resource_cache.h ('k') | chrome/browser/ui/webui/options/options_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698