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

Side by Side Diff: cc/playback/display_item_list.cc

Issue 1512823002: Serialize DisplayListRecordingSource to protos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years 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 | « cc/cc.gyp ('k') | cc/playback/display_item_list_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/playback/display_item_list.h" 5 #include "cc/playback/display_item_list.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 scoped_refptr<DisplayItemList> list = 59 scoped_refptr<DisplayItemList> list =
60 DisplayItemList::Create(ProtoToRect(proto.layer_rect()), 60 DisplayItemList::Create(ProtoToRect(proto.layer_rect()),
61 DisplayItemListSettings(proto.settings())); 61 DisplayItemListSettings(proto.settings()));
62 62
63 for (int i = 0; i < proto.items_size(); i++) { 63 for (int i = 0; i < proto.items_size(); i++) {
64 const proto::DisplayItem& item_proto = proto.items(i); 64 const proto::DisplayItem& item_proto = proto.items(i);
65 DisplayItemProtoFactory::AllocateAndConstruct(layer_rect, list.get(), 65 DisplayItemProtoFactory::AllocateAndConstruct(layer_rect, list.get(),
66 item_proto); 66 item_proto);
67 } 67 }
68 68
69 list->Finalize();
70
69 return list; 71 return list;
70 } 72 }
71 73
72 DisplayItemList::DisplayItemList(gfx::Rect layer_rect, 74 DisplayItemList::DisplayItemList(gfx::Rect layer_rect,
73 const DisplayItemListSettings& settings, 75 const DisplayItemListSettings& settings,
74 bool retain_individual_display_items) 76 bool retain_individual_display_items)
75 : items_(LargestDisplayItemSize(), 77 : items_(LargestDisplayItemSize(),
76 LargestDisplayItemSize() * kDefaultNumDisplayItemsToReserve), 78 LargestDisplayItemSize() * kDefaultNumDisplayItemsToReserve),
77 settings_(settings), 79 settings_(settings),
78 retain_individual_display_items_(retain_individual_display_items), 80 retain_individual_display_items_(retain_individual_display_items),
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 item.Raster(canvas_.get(), gfx::Rect(), nullptr); 155 item.Raster(canvas_.get(), gfx::Rect(), nullptr);
154 } 156 }
155 157
156 bool DisplayItemList::RetainsIndividualDisplayItems() const { 158 bool DisplayItemList::RetainsIndividualDisplayItems() const {
157 return retain_individual_display_items_; 159 return retain_individual_display_items_;
158 } 160 }
159 161
160 void DisplayItemList::Finalize() { 162 void DisplayItemList::Finalize() {
161 // TODO(wkorman): Uncomment the assert below once we've investigated 163 // TODO(wkorman): Uncomment the assert below once we've investigated
162 // and resolved issues. http://crbug.com/557905 164 // and resolved issues. http://crbug.com/557905
165 // TODO(dtrainor): Need to deal with serializing visual_rects_.
166 // http://crbug.com/568757.
163 // DCHECK_EQ(items_.size(), visual_rects_.size()); 167 // DCHECK_EQ(items_.size(), visual_rects_.size());
164 168
165 // TODO(vmpstr): Build and make use of an RTree from the visual 169 // TODO(vmpstr): Build and make use of an RTree from the visual
166 // rects. For now we just clear them out since we won't ever need 170 // rects. For now we just clear them out since we won't ever need
167 // them to stick around post-Finalize. http://crbug.com/527245 171 // them to stick around post-Finalize. http://crbug.com/527245
168 // This clears both the vector and the vector's capacity, since visual_rects_ 172 // This clears both the vector and the vector's capacity, since visual_rects_
169 // won't be used anymore. 173 // won't be used anymore.
170 std::vector<gfx::Rect>().swap(visual_rects_); 174 std::vector<gfx::Rect>().swap(visual_rects_);
171 175
172 if (settings_.use_cached_picture) { 176 if (settings_.use_cached_picture) {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 294 }
291 295
292 void DisplayItemList::GetDiscardableImagesInRect( 296 void DisplayItemList::GetDiscardableImagesInRect(
293 const gfx::Rect& rect, 297 const gfx::Rect& rect,
294 float raster_scale, 298 float raster_scale,
295 std::vector<DrawImage>* images) { 299 std::vector<DrawImage>* images) {
296 image_map_.GetDiscardableImagesInRect(rect, raster_scale, images); 300 image_map_.GetDiscardableImagesInRect(rect, raster_scale, images);
297 } 301 }
298 302
299 } // namespace cc 303 } // namespace cc
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/playback/display_item_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698