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

Unified Diff: chrome/utility/chrome_content_utility_client.cc

Issue 600913002: Revert of Large wallpaper decoding in utility process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/utility/chrome_content_utility_client.cc
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index 990717aacca44839a2b1d80ca3331de8bb77f790..d2c9b4adebda31a264ddbd192b0e6d742d1c1c2f 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -18,8 +18,6 @@
#include "content/public/utility/utility_thread.h"
#include "courgette/courgette.h"
#include "courgette/third_party/bsdiff.h"
-#include "ipc/ipc_channel.h"
-#include "skia/ext/image_operations.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/zlib/google/zip.h"
#include "ui/gfx/codec/jpeg_codec.h"
@@ -175,43 +173,11 @@
}
// static
-SkBitmap ChromeContentUtilityClient::DecodeImage(
- const std::vector<unsigned char>& encoded_data, bool shrink_to_fit) {
- SkBitmap decoded_image = content::DecodeImage(&encoded_data[0],
- gfx::Size(),
- encoded_data.size());
-
- int64_t max_msg_size = IPC::Channel::kMaximumMessageSize;
- int64_t struct_size = sizeof(ChromeUtilityHostMsg_DecodeImage_Succeeded);
- int64_t image_size = decoded_image.computeSize64();
- int halves = 0;
- while (struct_size + (image_size >> 2*halves) > max_msg_size)
- halves++;
- if (halves) {
- if (shrink_to_fit) {
- // If decoded image is too large for IPC message, shrink it by halves.
- // This prevents quality loss, and should never overshrink on displays
- // smaller than 3600x2400.
- // TODO (Issue 416916): Instead of shrinking, return via shared memory
- decoded_image = skia::ImageOperations::Resize(
- decoded_image, skia::ImageOperations::RESIZE_LANCZOS3,
- decoded_image.width() >> halves, decoded_image.height() >> halves);
- } else {
- // Image too big for IPC message, but caller didn't request resize;
- // pre-delete image so DecodeImageAndSend() will send an error.
- decoded_image.reset();
- LOG(ERROR) << "Decoded image too large for IPC message";
- }
- }
-
- return decoded_image;
-}
-
-// static
-void ChromeContentUtilityClient::DecodeImageAndSend(
- const std::vector<unsigned char>& encoded_data, bool shrink_to_fit){
- SkBitmap decoded_image = DecodeImage(encoded_data, shrink_to_fit);
-
+void ChromeContentUtilityClient::DecodeImage(
+ const std::vector<unsigned char>& encoded_data) {
+ const SkBitmap& decoded_image = content::DecodeImage(&encoded_data[0],
+ gfx::Size(),
+ encoded_data.size());
if (decoded_image.empty()) {
Send(new ChromeUtilityHostMsg_DecodeImage_Failed());
} else {
@@ -238,8 +204,8 @@
}
void ChromeContentUtilityClient::OnDecodeImage(
- const std::vector<unsigned char>& encoded_data, bool shrink_to_fit) {
- DecodeImageAndSend(encoded_data, shrink_to_fit);
+ const std::vector<unsigned char>& encoded_data) {
+ DecodeImage(encoded_data);
}
#if defined(OS_CHROMEOS)
« no previous file with comments | « chrome/utility/chrome_content_utility_client.h ('k') | chrome/utility/chrome_content_utility_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698