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

Unified Diff: chrome/browser/chromeos/arc/arc_wallpaper_handler.cc

Issue 2177833003: Avoid unnecessary copies in ImageDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change ArcWallpaperHandler to use new API. Created 4 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/chromeos/arc/arc_wallpaper_handler.h ('k') | chrome/browser/image_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/arc/arc_wallpaper_handler.cc
diff --git a/chrome/browser/chromeos/arc/arc_wallpaper_handler.cc b/chrome/browser/chromeos/arc/arc_wallpaper_handler.cc
index 740eb054797fa0d6b5cf40ae4bc68da99db822c8..238a9837e121ffe019e3e1076c9429b7ff177420 100644
--- a/chrome/browser/chromeos/arc/arc_wallpaper_handler.cc
+++ b/chrome/browser/chromeos/arc/arc_wallpaper_handler.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/arc/arc_wallpaper_handler.h"
#include <string>
+#include <utility>
#include <vector>
#include "base/logging.h"
@@ -66,15 +67,12 @@ ArcWallpaperHandler::~ArcWallpaperHandler() {
ImageDecoder::Cancel(this);
}
-void ArcWallpaperHandler::SetWallpaper(const std::vector<uint8_t>& jpeg_data) {
+void ArcWallpaperHandler::SetWallpaper(std::vector<uint8_t> jpeg_data) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// If there is an in-flight request, cancel it. It is safe to call Cancel()
// even when there is no in-flight request.
ImageDecoder::Cancel(this);
- // TODO(nya): Improve ImageDecoder to minimize copy.
- std::string jpeg_data_as_string(
- reinterpret_cast<const char*>(jpeg_data.data()), jpeg_data.size());
- ImageDecoder::StartWithOptions(this, jpeg_data_as_string,
+ ImageDecoder::StartWithOptions(this, std::move(jpeg_data),
ImageDecoder::ROBUST_JPEG_CODEC, true);
}
« no previous file with comments | « chrome/browser/chromeos/arc/arc_wallpaper_handler.h ('k') | chrome/browser/image_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698