forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for (de)serializing cc::LayerTreeDebugState
As part of serializing cc::LayerTreeHost, we also need to serialize the cc::LayerTreeSettings and the cc::LayerTreeDebugState. This CL focuses only on the debug state. BUG=561210 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1469393004 Cr-Commit-Position: refs/heads/master@{#362534}
- Loading branch information
1 parent
4cd65b1
commit 74a9aca
Showing
8 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "cc/debug/layer_tree_debug_state.h" | ||
|
||
#include "cc/proto/layer_tree_debug_state.pb.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
namespace cc { | ||
namespace { | ||
|
||
void VerifySerializeAndDeserializeProto(const LayerTreeDebugState& state1) { | ||
proto::LayerTreeDebugState proto; | ||
state1.ToProtobuf(&proto); | ||
LayerTreeDebugState state2; | ||
state2.FromProtobuf(proto); | ||
EXPECT_TRUE(LayerTreeDebugState::Equal(state1, state2)); | ||
} | ||
|
||
TEST(LayerTreeDebugStateTest, AllFieldsTrue) { | ||
LayerTreeDebugState state; | ||
state.show_fps_counter = true; | ||
state.show_debug_borders = true; | ||
state.show_paint_rects = true; | ||
state.show_property_changed_rects = true; | ||
state.show_surface_damage_rects = true; | ||
state.show_screen_space_rects = true; | ||
state.show_replica_screen_space_rects = true; | ||
state.show_touch_event_handler_rects = true; | ||
state.show_wheel_event_handler_rects = true; | ||
state.show_scroll_event_handler_rects = true; | ||
state.show_non_fast_scrollable_rects = true; | ||
state.show_layer_animation_bounds_rects = true; | ||
state.slow_down_raster_scale_factor = 1; | ||
state.rasterize_only_visible_content = true; | ||
state.show_picture_borders = true; | ||
state.SetRecordRenderingStats(true); | ||
VerifySerializeAndDeserializeProto(state); | ||
} | ||
|
||
TEST(LayerTreeDebugStateTest, ArbitraryFieldValues) { | ||
LayerTreeDebugState state; | ||
state.show_fps_counter = true; | ||
state.show_debug_borders = true; | ||
state.show_paint_rects = false; | ||
state.show_property_changed_rects = true; | ||
state.show_surface_damage_rects = false; | ||
state.show_screen_space_rects = false; | ||
state.show_replica_screen_space_rects = true; | ||
state.show_touch_event_handler_rects = true; | ||
state.show_wheel_event_handler_rects = true; | ||
state.show_scroll_event_handler_rects = false; | ||
state.show_non_fast_scrollable_rects = true; | ||
state.show_layer_animation_bounds_rects = true; | ||
state.slow_down_raster_scale_factor = 42; | ||
state.rasterize_only_visible_content = false; | ||
state.show_picture_borders = false; | ||
state.SetRecordRenderingStats(true); | ||
VerifySerializeAndDeserializeProto(state); | ||
} | ||
|
||
} // namespace | ||
} // namespace cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
syntax = "proto2"; | ||
|
||
package cc.proto; | ||
|
||
option optimize_for = LITE_RUNTIME; | ||
|
||
message LayerTreeDebugState { | ||
optional bool show_fps_counter = 1; | ||
optional bool show_debug_borders = 2; | ||
|
||
optional bool show_paint_rects = 3; | ||
optional bool show_property_changed_rects = 4; | ||
optional bool show_surface_damage_rects = 5; | ||
optional bool show_screen_space_rects = 6; | ||
optional bool show_replica_screen_space_rects = 7; | ||
optional bool show_touch_event_handler_rects = 8; | ||
optional bool show_wheel_event_handler_rects = 9; | ||
optional bool show_scroll_event_handler_rects = 10; | ||
optional bool show_non_fast_scrollable_rects = 11; | ||
optional bool show_layer_animation_bounds_rects = 12; | ||
|
||
optional int32 slow_down_raster_scale_factor = 13; | ||
optional bool rasterize_only_visible_content = 14; | ||
optional bool show_picture_borders = 15; | ||
|
||
optional bool record_rendering_stats = 16; | ||
} |