| OLD | NEW |
| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "cc/output/filter_operation.h" | 9 #include "cc/output/filter_operation.h" |
| 10 #include "cc/output/filter_operations.h" | 10 #include "cc/output/filter_operations.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void ValidateDisplayItemListSerialization(const gfx::Size& layer_size, | 77 void ValidateDisplayItemListSerialization(const gfx::Size& layer_size, |
| 78 scoped_refptr<DisplayItemList> list) { | 78 scoped_refptr<DisplayItemList> list) { |
| 79 list->Finalize(); | 79 list->Finalize(); |
| 80 | 80 |
| 81 // Serialize and deserialize the DisplayItemList. | 81 // Serialize and deserialize the DisplayItemList. |
| 82 proto::DisplayItemList proto; | 82 proto::DisplayItemList proto; |
| 83 list->ToProtobuf(&proto); | 83 list->ToProtobuf(&proto); |
| 84 scoped_refptr<DisplayItemList> new_list = | 84 scoped_refptr<DisplayItemList> new_list = |
| 85 DisplayItemList::CreateFromProto(proto); | 85 DisplayItemList::CreateFromProto(proto); |
| 86 | 86 |
| 87 // Finalize the DisplayItemLists to perform raster. | |
| 88 new_list->Finalize(); | |
| 89 | |
| 90 const int pixel_size = 4 * layer_size.GetArea(); | 87 const int pixel_size = 4 * layer_size.GetArea(); |
| 91 | 88 |
| 92 // Get the rendered contents of the old DisplayItemList. | 89 // Get the rendered contents of the old DisplayItemList. |
| 93 scoped_ptr<unsigned char[]> pixels(new unsigned char[pixel_size]); | 90 scoped_ptr<unsigned char[]> pixels(new unsigned char[pixel_size]); |
| 94 memset(pixels.get(), 0, pixel_size); | 91 memset(pixels.get(), 0, pixel_size); |
| 95 DrawDisplayList(pixels.get(), gfx::Rect(layer_size), list); | 92 DrawDisplayList(pixels.get(), gfx::Rect(layer_size), list); |
| 96 | 93 |
| 97 // Get the rendered contents of the new DisplayItemList. | 94 // Get the rendered contents of the new DisplayItemList. |
| 98 scoped_ptr<unsigned char[]> new_pixels(new unsigned char[pixel_size]); | 95 scoped_ptr<unsigned char[]> new_pixels(new unsigned char[pixel_size]); |
| 99 memset(new_pixels.get(), 0, pixel_size); | 96 memset(new_pixels.get(), 0, pixel_size); |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 // categories being traced). | 704 // categories being traced). |
| 708 list = new DisplayItemList(layer_rect, caching_settings, true); | 705 list = new DisplayItemList(layer_rect, caching_settings, true); |
| 709 item = list->CreateAndAppendItem<DrawingDisplayItem>(kVisualRect); | 706 item = list->CreateAndAppendItem<DrawingDisplayItem>(kVisualRect); |
| 710 item->SetNew(picture); | 707 item->SetNew(picture); |
| 711 list->Finalize(); | 708 list->Finalize(); |
| 712 memory_usage = list->ApproximateMemoryUsage(); | 709 memory_usage = list->ApproximateMemoryUsage(); |
| 713 EXPECT_EQ(static_cast<size_t>(0), memory_usage); | 710 EXPECT_EQ(static_cast<size_t>(0), memory_usage); |
| 714 } | 711 } |
| 715 | 712 |
| 716 } // namespace cc | 713 } // namespace cc |
| OLD | NEW |