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

Unified Diff: chrome/browser/dom_ui/dom_ui_theme_source.cc

Issue 288005: First fix to minimize copying of image data. (Closed)
Patch Set: Modify gyp Created 11 years, 2 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
Index: chrome/browser/dom_ui/dom_ui_theme_source.cc
diff --git a/chrome/browser/dom_ui/dom_ui_theme_source.cc b/chrome/browser/dom_ui/dom_ui_theme_source.cc
index dfe91285a264a798c56e51639acbb8904a5e83d0..50e40a26568588811dc371a1998dfb083438bf89 100644
--- a/chrome/browser/dom_ui/dom_ui_theme_source.cc
+++ b/chrome/browser/dom_ui/dom_ui_theme_source.cc
@@ -90,7 +90,7 @@ std::string DOMUIThemeSource::GetMimeType(const std::string& path) const {
return "image/png";
}
-void DOMUIThemeSource::SendResponse(int request_id, RefCountedBytes* data) {
+void DOMUIThemeSource::SendResponse(int request_id, RefCountedMemory* data) {
ChromeURLDataManager::DataSource::SendResponse(request_id, data);
}
@@ -248,14 +248,8 @@ void DOMUIThemeSource::SendThemeBitmap(int request_id, int resource_id) {
ThemeProvider* tp = profile_->GetThemeProvider();
DCHECK(tp);
- std::vector<unsigned char> png_bytes;
- if (tp->GetRawData(resource_id, &png_bytes)) {
- scoped_refptr<RefCountedBytes> image_data =
- new RefCountedBytes(png_bytes);
- SendResponse(request_id, image_data);
- } else {
- SendResponse(request_id, NULL);
- }
+ scoped_refptr<RefCountedMemory> image_data(tp->GetRawData(resource_id));
+ SendResponse(request_id, image_data);
}
std::string DOMUIThemeSource::GetNewTabBackgroundCSS(bool bar_attached) {

Powered by Google App Engine
This is Rietveld 408576698