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 <memory> |
8 #include <set> | 9 #include <set> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
15 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
16 #include "blimp/common/blob_cache/id_util.h" | 17 #include "blimp/common/blob_cache/id_util.h" |
17 #include "blimp/common/proto/blob_cache.pb.h" | 18 #include "blimp/common/proto/blob_cache.pb.h" |
| 19 #include "blimp/engine/renderer/blimp_engine_picture_cache.h" |
| 20 #include "cc/proto/picture_cache.h" |
18 #include "content/public/renderer/render_frame.h" | 21 #include "content/public/renderer/render_frame.h" |
19 #include "third_party/libwebp/webp/encode.h" | 22 #include "third_party/libwebp/webp/encode.h" |
20 #include "third_party/skia/include/core/SkData.h" | 23 #include "third_party/skia/include/core/SkData.h" |
21 #include "third_party/skia/include/core/SkPicture.h" | 24 #include "third_party/skia/include/core/SkPicture.h" |
22 #include "third_party/skia/include/core/SkPixelSerializer.h" | 25 #include "third_party/skia/include/core/SkPixelSerializer.h" |
| 26 #include "third_party/skia/include/core/SkStream.h" |
23 #include "third_party/skia/include/core/SkUnPreMultiply.h" | 27 #include "third_party/skia/include/core/SkUnPreMultiply.h" |
24 | 28 |
25 namespace blimp { | 29 namespace blimp { |
26 namespace { | 30 namespace { |
27 | 31 |
28 // TODO(nyquist): Add support for changing this from the client. | 32 // TODO(nyquist): Add support for changing this from the client. |
29 static base::LazyInstance<std::set<BlobId>> g_client_cache_contents = | 33 static base::LazyInstance<std::set<BlobId>> g_client_cache_contents = |
30 LAZY_INSTANCE_INITIALIZER; | 34 LAZY_INSTANCE_INITIALIZER; |
31 | 35 |
32 SkData* BlobCacheImageMetadataProtoAsSkData( | 36 SkData* BlobCacheImageMetadataProtoAsSkData( |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 219 |
216 pixel_serializer_.reset(new WebPImageEncoder); | 220 pixel_serializer_.reset(new WebPImageEncoder); |
217 | 221 |
218 // Dummy BlobChannel command. | 222 // Dummy BlobChannel command. |
219 // TODO(nyquist): Remove this after integrating BlobChannel. | 223 // TODO(nyquist): Remove this after integrating BlobChannel. |
220 blob_channel_->Push("foo"); | 224 blob_channel_->Push("foo"); |
221 } | 225 } |
222 | 226 |
223 EngineImageSerializationProcessor::~EngineImageSerializationProcessor() {} | 227 EngineImageSerializationProcessor::~EngineImageSerializationProcessor() {} |
224 | 228 |
225 SkPixelSerializer* EngineImageSerializationProcessor::GetPixelSerializer() { | 229 std::unique_ptr<cc::EnginePictureCache> |
226 return pixel_serializer_.get(); | 230 EngineImageSerializationProcessor::CreateEnginePictureCache() { |
| 231 return base::WrapUnique(new BlimpEnginePictureCache(pixel_serializer_.get())); |
227 } | 232 } |
228 | 233 |
229 SkPicture::InstallPixelRefProc | 234 std::unique_ptr<cc::ClientPictureCache> |
230 EngineImageSerializationProcessor::GetPixelDeserializer() { | 235 EngineImageSerializationProcessor::CreateClientPictureCache() { |
231 return nullptr; | 236 return nullptr; |
232 } | 237 } |
233 | 238 |
234 } // namespace engine | 239 } // namespace engine |
235 } // namespace blimp | 240 } // namespace blimp |
OLD | NEW |