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

Side by Side Diff: blimp/client/feature/compositor/blimp_image_decoder.cc

Issue 1982893002: [blimp] Add SkPicture caching support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git merge origin/master Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "blimp/client/feature/compositor/blimp_image_decoder.h" 5 #include "blimp/client/feature/compositor/blimp_image_decoder.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "blimp/common/blob_cache/blob_cache.h" 11 #include "blimp/common/blob_cache/blob_cache.h"
12 #include "blimp/common/blob_cache/id_util.h" 12 #include "blimp/common/blob_cache/id_util.h"
13 #include "blimp/common/blob_cache/in_memory_blob_cache.h" 13 #include "blimp/common/blob_cache/in_memory_blob_cache.h"
14 #include "blimp/common/proto/blob_cache.pb.h" 14 #include "blimp/common/proto/blob_cache.pb.h"
15 #include "third_party/libwebp/webp/decode.h" 15 #include "third_party/libwebp/webp/decode.h"
16 #include "third_party/libwebp/webp/demux.h" 16 #include "third_party/libwebp/webp/demux.h"
17 #include "third_party/skia/include/core/SkBitmap.h" 17 #include "third_party/skia/include/core/SkBitmap.h"
18 18
19 namespace blimp { 19 namespace blimp {
20 namespace { 20 namespace {
21 21
22 // TODO(nyquist): Make this not be infinite size. 22 // TODO(nyquist): Make this not be infinite size.
23 static base::LazyInstance<InMemoryBlobCache> g_blob_cache = 23 static base::LazyInstance<InMemoryBlobCache> g_blob_cache =
24 LAZY_INSTANCE_INITIALIZER; 24 LAZY_INSTANCE_INITIALIZER;
25 25
26 } // namespace 26 } // namespace
27 27
28 namespace client { 28 namespace client {
29 29
30 bool BlimpImageDecoder(const void* input, size_t input_size, SkBitmap* bitmap) { 30 bool DecodeBlimpImage(const void* input, size_t input_size, SkBitmap* bitmap) {
31 DCHECK(bitmap); 31 DCHECK(bitmap);
32 32
33 // Initialize an empty WebPDecoderConfig. 33 // Initialize an empty WebPDecoderConfig.
34 WebPDecoderConfig config; 34 WebPDecoderConfig config;
35 if (!WebPInitDecoderConfig(&config)) { 35 if (!WebPInitDecoderConfig(&config)) {
36 LOG(WARNING) << "Failed to initialize WebP config."; 36 LOG(WARNING) << "Failed to initialize WebP config.";
37 return false; 37 return false;
38 } 38 }
39 39
40 BlobCacheImageMetadata deserialized; 40 BlobCacheImageMetadata deserialized;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 BlobDataPtr to_cache(new BlobData(std::string( 132 BlobDataPtr to_cache(new BlobData(std::string(
133 reinterpret_cast<const char*>(webp_data.bytes), webp_data.size))); 133 reinterpret_cast<const char*>(webp_data.bytes), webp_data.size)));
134 g_blob_cache.Get().Put(deserialized.id(), std::move(to_cache)); 134 g_blob_cache.Get().Put(deserialized.id(), std::move(to_cache));
135 } 135 }
136 136
137 return true; 137 return true;
138 } 138 }
139 139
140 } // namespace client 140 } // namespace client
141 } // namespace blimp 141 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698