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

Unified Diff: blimp/client/feature/compositor/decoding_image_generator.cc

Issue 1867653002: Initial version of Blimp BlobCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update test name to new API Created 4 years, 8 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 | blimp/common/BUILD.gn » ('j') | blimp/common/blob_cache/blob_cache.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/client/feature/compositor/decoding_image_generator.cc
diff --git a/blimp/client/feature/compositor/decoding_image_generator.cc b/blimp/client/feature/compositor/decoding_image_generator.cc
index 692dd373c4df152e1de69054ca0deef64b44f5bd..bf8305ea5f650d56829cce537a1f2234d084007b 100644
--- a/blimp/client/feature/compositor/decoding_image_generator.cc
+++ b/blimp/client/feature/compositor/decoding_image_generator.cc
@@ -4,7 +4,9 @@
#include "blimp/client/feature/compositor/decoding_image_generator.h"
+#include "base/numerics/safe_conversions.h"
#include "blimp/common/compositor/webp_decoder.h"
+#include "blimp/common/proto/blob_cache.pb.h"
#include "third_party/libwebp/webp/decode.h"
#include "third_party/libwebp/webp/demux.h"
#include "third_party/skia/include/core/SkData.h"
@@ -13,6 +15,16 @@ namespace blimp {
namespace client {
SkImageGenerator* DecodingImageGenerator::create(SkData* data) {
+ // Check if this is a cache identifier instead of a WebP image.
Kevin M 2016/04/13 23:29:52 Can you add a prefix byte instead of trying to par
nyquist 2016/04/14 19:33:22 Moved all of this to a proto instead.
+ std::unique_ptr<BlobCacheImageIdentifier> deserialized(
+ new BlobCacheImageIdentifier);
+ int signed_size = base::checked_cast<int>(data->size());
+ if (deserialized->ParseFromArray(data->data(), signed_size)) {
+ const SkImageInfo info = SkImageInfo::MakeN32Premul(deserialized->width(),
+ deserialized->height());
+ return new DecodingImageGenerator(info, data->data(), data->size());
+ }
+
WebPData inputData = {reinterpret_cast<const uint8_t*>(data->data()),
data->size()};
WebPDemuxState demuxState(WEBP_DEMUX_PARSING_HEADER);
« no previous file with comments | « no previous file | blimp/common/BUILD.gn » ('j') | blimp/common/blob_cache/blob_cache.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698