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

Unified Diff: chrome/utility/image_decoder_impl.cc

Issue 1955123003: Mojo C++ bindings: switch the remaining callsites of the old serialization interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@24_union_and_others
Patch Set: Created 4 years, 7 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 | « no previous file | mojo/mojo_public.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/utility/image_decoder_impl.cc
diff --git a/chrome/utility/image_decoder_impl.cc b/chrome/utility/image_decoder_impl.cc
index 91cea1b616f391e9a75e816ba93f7d6c1072848e..2873b51e2a60d0637f387a7a895b6b286df810d8 100644
--- a/chrome/utility/image_decoder_impl.cc
+++ b/chrome/utility/image_decoder_impl.cc
@@ -75,9 +75,11 @@ void ImageDecoderImpl::DecodeImage(
}
if (!decoded_image.isNull()) {
- skia::mojom::BitmapPtr dummy_image = skia::mojom::Bitmap::New();
- int64_t struct_size =
- skia::mojom::GetSerializedSize_(dummy_image, nullptr) + kPadding;
+ // When serialized, the space taken up by a skia::mojom::Bitmap excluding
+ // the pixel data payload should be:
+ // sizeof(skia::mojom::Bitmap::Data_) + pixel data array header (8 bytes)
+ // Use a bigger number in case we need padding at the end.
+ int64_t struct_size = sizeof(skia::mojom::Bitmap::Data_) + kPadding;
int64_t image_size = decoded_image.computeSize64();
int halves = 0;
while (struct_size + (image_size >> 2 * halves) > max_message_size_)
« no previous file with comments | « no previous file | mojo/mojo_public.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698