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

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

Issue 1955493002: Move BlimpImageSerializationProcessor and WebPDecoder to //blimp/client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments, moved to blimp::client namespace, renamed webp_decoder.[cc|h] according to func… 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 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/common/compositor/webp_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 bool WebPDecoder(const void* input, size_t input_size, SkBitmap* bitmap) { 28 namespace client {
29
30 bool BlimpImageDecoder(const void* input, size_t input_size, SkBitmap* bitmap) {
29 DCHECK(bitmap); 31 DCHECK(bitmap);
30 32
31 // Initialize an empty WebPDecoderConfig. 33 // Initialize an empty WebPDecoderConfig.
32 WebPDecoderConfig config; 34 WebPDecoderConfig config;
33 if (!WebPInitDecoderConfig(&config)) { 35 if (!WebPInitDecoderConfig(&config)) {
34 LOG(WARNING) << "Failed to initialize WebP config."; 36 LOG(WARNING) << "Failed to initialize WebP config.";
35 return false; 37 return false;
36 } 38 }
37 39
38 BlobCacheImageMetadata deserialized; 40 BlobCacheImageMetadata deserialized;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 DVLOG(2) << "Inserting image to cache with id: " << hex_id 130 DVLOG(2) << "Inserting image to cache with id: " << hex_id
129 << " size: " << webp_data.size; 131 << " size: " << webp_data.size;
130 BlobDataPtr to_cache(new BlobData(std::string( 132 BlobDataPtr to_cache(new BlobData(std::string(
131 reinterpret_cast<const char*>(webp_data.bytes), webp_data.size))); 133 reinterpret_cast<const char*>(webp_data.bytes), webp_data.size)));
132 g_blob_cache.Get().Put(deserialized.id(), std::move(to_cache)); 134 g_blob_cache.Get().Put(deserialized.id(), std::move(to_cache));
133 } 135 }
134 136
135 return true; 137 return true;
136 } 138 }
137 139
140 } // namespace client
138 } // namespace blimp 141 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698