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/blimp_engine_picture_cache.h" | 5 #include "blimp/engine/renderer/blimp_engine_picture_cache.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "third_party/skia/include/core/SkStream.h" | 9 #include "third_party/skia/include/core/SkStream.h" |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 } | 45 } |
46 | 46 |
47 // All new items will be sent to the client, so clear everything. | 47 // All new items will be sent to the client, so clear everything. |
48 pictures_.clear(); | 48 pictures_.clear(); |
49 reference_tracker_.ClearRefCounts(); | 49 reference_tracker_.ClearRefCounts(); |
50 | 50 |
51 return update; | 51 return update; |
52 } | 52 } |
53 | 53 |
54 void BlimpEnginePictureCache::Put(const SkPicture* picture) { | 54 void BlimpEnginePictureCache::Put(const SkPicture* picture) { |
55 SkDynamicMemoryWStream stream; | 55 sk_sp<SkData> data = picture->serialize(pixel_serializer_); |
56 picture->serialize(&stream, pixel_serializer_); | 56 DCHECK_GE(data->size(), 0u); |
57 DCHECK_GE(stream.bytesWritten(), 0u); | |
58 | 57 |
59 // Store the picture data until it is sent to the client. | 58 // Store the picture data until it is sent to the client. |
60 pictures_.insert( | 59 pictures_.insert( |
61 std::make_pair(picture->uniqueID(), | 60 std::make_pair(picture->uniqueID(), |
62 cc::PictureData(picture->uniqueID(), | 61 cc::PictureData(picture->uniqueID(), data))); |
f(malita)
2016/09/16 13:18:09
nit: std::move(data)
| |
63 sk_sp<SkData>(stream.copyToData())))); | |
64 } | 62 } |
65 | 63 |
66 } // namespace engine | 64 } // namespace engine |
67 } // namespace blimp | 65 } // namespace blimp |
OLD | NEW |