OLD | NEW |
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/engine/renderer/engine_image_serialization_processor.h" | 5 #include "blimp/engine/renderer/engine_image_serialization_processor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/sha1.h" | |
15 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/string_util.h" | |
17 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
18 #include "blimp/common/blob_cache/id_util.h" | 16 #include "blimp/common/blob_cache/id_util.h" |
19 #include "blimp/common/compositor/webp_decoder.h" | 17 #include "blimp/common/compositor/webp_decoder.h" |
20 #include "blimp/common/proto/blob_cache.pb.h" | 18 #include "blimp/common/proto/blob_cache.pb.h" |
21 #include "content/public/renderer/render_frame.h" | 19 #include "content/public/renderer/render_frame.h" |
22 #include "third_party/libwebp/webp/encode.h" | 20 #include "third_party/libwebp/webp/encode.h" |
23 #include "third_party/skia/include/core/SkData.h" | 21 #include "third_party/skia/include/core/SkData.h" |
24 #include "third_party/skia/include/core/SkPicture.h" | 22 #include "third_party/skia/include/core/SkPicture.h" |
25 #include "third_party/skia/include/core/SkPixelSerializer.h" | 23 #include "third_party/skia/include/core/SkPixelSerializer.h" |
26 #include "third_party/skia/include/core/SkUnPreMultiply.h" | 24 #include "third_party/skia/include/core/SkUnPreMultiply.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 67 |
70 // Ensure width and height are valid dimensions. | 68 // Ensure width and height are valid dimensions. |
71 if (!pixmap.width() || pixmap.width() > WEBP_MAX_DIMENSION) | 69 if (!pixmap.width() || pixmap.width() > WEBP_MAX_DIMENSION) |
72 return nullptr; | 70 return nullptr; |
73 picture.width = pixmap.width(); | 71 picture.width = pixmap.width(); |
74 if (!pixmap.height() || pixmap.height() > WEBP_MAX_DIMENSION) | 72 if (!pixmap.height() || pixmap.height() > WEBP_MAX_DIMENSION) |
75 return nullptr; | 73 return nullptr; |
76 picture.height = pixmap.height(); | 74 picture.height = pixmap.height(); |
77 | 75 |
78 const BlobId blob_id = CalculateBlobId(pixmap.addr(), pixmap.getSafeSize()); | 76 const BlobId blob_id = CalculateBlobId(pixmap.addr(), pixmap.getSafeSize()); |
79 std::string blob_id_hex = FormatBlobId(blob_id); | 77 std::string blob_id_hex = BlobIdToString(blob_id); |
80 | 78 |
81 // Create proto with all requires information. | 79 // Create proto with all requires information. |
82 BlobCacheImageMetadata proto; | 80 BlobCacheImageMetadata proto; |
83 proto.set_id(blob_id); | 81 proto.set_id(blob_id); |
84 proto.set_width(pixmap.width()); | 82 proto.set_width(pixmap.width()); |
85 proto.set_height(pixmap.height()); | 83 proto.set_height(pixmap.height()); |
86 | 84 |
87 if (g_client_cache_contents.Get().find(blob_id) != | 85 if (g_client_cache_contents.Get().find(blob_id) != |
88 g_client_cache_contents.Get().end()) { | 86 g_client_cache_contents.Get().end()) { |
89 // Found image in client cache, so skip sending decoded payload. | 87 // Found image in client cache, so skip sending decoded payload. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 return pixel_serializer_.get(); | 227 return pixel_serializer_.get(); |
230 } | 228 } |
231 | 229 |
232 SkPicture::InstallPixelRefProc | 230 SkPicture::InstallPixelRefProc |
233 EngineImageSerializationProcessor::GetPixelDeserializer() { | 231 EngineImageSerializationProcessor::GetPixelDeserializer() { |
234 return nullptr; | 232 return nullptr; |
235 } | 233 } |
236 | 234 |
237 } // namespace engine | 235 } // namespace engine |
238 } // namespace blimp | 236 } // namespace blimp |
OLD | NEW |