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

Side by Side Diff: blimp/engine/renderer/blimp_engine_picture_cache.cc

Issue 2343993002: use SkData oriented picture serialize api (Closed)
Patch Set: fix webkit instance Created 4 years, 3 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
« no previous file with comments | « no previous file | blimp/test/support/compositor/picture_cache_test_support.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
OLDNEW
« no previous file with comments | « no previous file | blimp/test/support/compositor/picture_cache_test_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698