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

Side by Side Diff: cc/layers/layer.cc

Issue 2646623002: cc: Remove all blimp code from cc. (Closed)
Patch Set: test build Created 3 years, 11 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 | « cc/layers/layer.h ('k') | cc/layers/layer_position_constraint.h » ('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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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/layers/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 11
12 #include "base/atomic_sequence_num.h" 12 #include "base/atomic_sequence_num.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
18 #include "cc/base/simple_enclosed_region.h" 18 #include "cc/base/simple_enclosed_region.h"
19 #include "cc/debug/frame_viewer_instrumentation.h" 19 #include "cc/debug/frame_viewer_instrumentation.h"
20 #include "cc/input/main_thread_scrolling_reason.h" 20 #include "cc/input/main_thread_scrolling_reason.h"
21 #include "cc/layers/layer_client.h" 21 #include "cc/layers/layer_client.h"
22 #include "cc/layers/layer_impl.h" 22 #include "cc/layers/layer_impl.h"
23 #include "cc/layers/scrollbar_layer_interface.h" 23 #include "cc/layers/scrollbar_layer_interface.h"
24 #include "cc/output/copy_output_request.h" 24 #include "cc/output/copy_output_request.h"
25 #include "cc/output/copy_output_result.h" 25 #include "cc/output/copy_output_result.h"
26 #include "cc/proto/cc_conversions.h"
27 #include "cc/proto/gfx_conversions.h"
28 #include "cc/proto/layer.pb.h"
29 #include "cc/proto/skia_conversions.h"
30 #include "cc/trees/draw_property_utils.h" 26 #include "cc/trees/draw_property_utils.h"
31 #include "cc/trees/effect_node.h" 27 #include "cc/trees/effect_node.h"
32 #include "cc/trees/layer_tree_host.h" 28 #include "cc/trees/layer_tree_host.h"
33 #include "cc/trees/layer_tree_impl.h" 29 #include "cc/trees/layer_tree_impl.h"
34 #include "cc/trees/mutable_properties.h" 30 #include "cc/trees/mutable_properties.h"
35 #include "cc/trees/mutator_host.h" 31 #include "cc/trees/mutator_host.h"
36 #include "cc/trees/transform_node.h" 32 #include "cc/trees/transform_node.h"
37 #include "third_party/skia/include/core/SkImageFilter.h" 33 #include "third_party/skia/include/core/SkImageFilter.h"
38 #include "ui/gfx/geometry/rect_conversions.h" 34 #include "ui/gfx/geometry/rect_conversions.h"
39 #include "ui/gfx/geometry/vector2d_conversions.h" 35 #include "ui/gfx/geometry/vector2d_conversions.h"
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 if (main_thread_request->has_area()) { 1215 if (main_thread_request->has_area()) {
1220 main_thread_request->set_area(gfx::IntersectRects( 1216 main_thread_request->set_area(gfx::IntersectRects(
1221 main_thread_request->area(), gfx::Rect(bounds()))); 1217 main_thread_request->area(), gfx::Rect(bounds())));
1222 } 1218 }
1223 requests->push_back(std::move(main_thread_request)); 1219 requests->push_back(std::move(main_thread_request));
1224 } 1220 }
1225 1221
1226 inputs_.copy_requests.clear(); 1222 inputs_.copy_requests.clear();
1227 } 1223 }
1228 1224
1229 void Layer::SetTypeForProtoSerialization(proto::LayerNode* proto) const {
1230 proto->set_type(proto::LayerNode::LAYER);
1231 }
1232
1233 void Layer::ToLayerNodeProto(proto::LayerNode* proto) const {
1234 proto->set_id(inputs_.layer_id);
1235 SetTypeForProtoSerialization(proto);
1236
1237 if (parent_)
1238 proto->set_parent_id(parent_->id());
1239
1240 DCHECK_EQ(0, proto->children_size());
1241 for (const auto& child : inputs_.children) {
1242 child->ToLayerNodeProto(proto->add_children());
1243 }
1244
1245 if (inputs_.mask_layer)
1246 inputs_.mask_layer->ToLayerNodeProto(proto->mutable_mask_layer());
1247 }
1248
1249 void Layer::ToLayerPropertiesProto(proto::LayerProperties* proto) {
1250 proto->set_id(inputs_.layer_id);
1251
1252 proto::BaseLayerProperties* base = proto->mutable_base();
1253 RectToProto(inputs_.update_rect, base->mutable_update_rect());
1254 inputs_.update_rect = gfx::Rect();
1255
1256 bool use_paint_properties = layer_tree_host_ &&
1257 paint_properties_.source_frame_number ==
1258 layer_tree_host_->SourceFrameNumber();
1259 SizeToProto(use_paint_properties ? paint_properties_.bounds : inputs_.bounds,
1260 base->mutable_bounds());
1261
1262 base->set_masks_to_bounds(inputs_.masks_to_bounds);
1263 base->set_opacity(inputs_.opacity);
1264 base->set_blend_mode(SkXfermodeModeToProto(inputs_.blend_mode));
1265 base->set_is_root_for_isolated_group(inputs_.is_root_for_isolated_group);
1266 base->set_contents_opaque(inputs_.contents_opaque);
1267 PointFToProto(inputs_.position, base->mutable_position());
1268 TransformToProto(inputs_.transform, base->mutable_transform());
1269 Point3FToProto(inputs_.transform_origin, base->mutable_transform_origin());
1270 base->set_is_drawable(inputs_.is_drawable);
1271 base->set_double_sided(inputs_.double_sided);
1272 base->set_should_flatten_transform(inputs_.should_flatten_transform);
1273 base->set_sorting_context_id(inputs_.sorting_context_id);
1274 base->set_use_parent_backface_visibility(
1275 inputs_.use_parent_backface_visibility);
1276 base->set_background_color(inputs_.background_color);
1277 ScrollOffsetToProto(inputs_.scroll_offset, base->mutable_scroll_offset());
1278 base->set_scroll_clip_layer_id(inputs_.scroll_clip_layer_id);
1279 base->set_user_scrollable_horizontal(inputs_.user_scrollable_horizontal);
1280 base->set_user_scrollable_vertical(inputs_.user_scrollable_vertical);
1281 base->set_main_thread_scrolling_reasons(
1282 inputs_.main_thread_scrolling_reasons);
1283 RegionToProto(inputs_.non_fast_scrollable_region,
1284 base->mutable_non_fast_scrollable_region());
1285 RegionToProto(inputs_.touch_event_handler_region,
1286 base->mutable_touch_event_handler_region());
1287 base->set_is_container_for_fixed_position_layers(
1288 inputs_.is_container_for_fixed_position_layers);
1289 inputs_.position_constraint.ToProtobuf(base->mutable_position_constraint());
1290 inputs_.sticky_position_constraint.ToProtobuf(
1291 base->mutable_sticky_position_constraint());
1292
1293 int scroll_parent_id =
1294 inputs_.scroll_parent ? inputs_.scroll_parent->id() : INVALID_ID;
1295 base->set_scroll_parent_id(scroll_parent_id);
1296
1297 int clip_parent_id =
1298 inputs_.clip_parent ? inputs_.clip_parent->id() : INVALID_ID;
1299 base->set_clip_parent_id(clip_parent_id);
1300
1301 base->set_has_will_change_transform_hint(
1302 inputs_.has_will_change_transform_hint);
1303 base->set_hide_layer_and_subtree(inputs_.hide_layer_and_subtree);
1304
1305 // TODO(nyquist): Add support for serializing FilterOperations for
1306 // |filters_| and |background_filters_|. See crbug.com/541321.
1307 }
1308
1309 std::unique_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) { 1225 std::unique_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
1310 return LayerImpl::Create(tree_impl, inputs_.layer_id); 1226 return LayerImpl::Create(tree_impl, inputs_.layer_id);
1311 } 1227 }
1312 1228
1313 bool Layer::DrawsContent() const { 1229 bool Layer::DrawsContent() const {
1314 return draws_content_; 1230 return draws_content_;
1315 } 1231 }
1316 1232
1317 bool Layer::HasDrawableContent() const { 1233 bool Layer::HasDrawableContent() const {
1318 return inputs_.is_drawable; 1234 return inputs_.is_drawable;
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 gfx::Transform Layer::screen_space_transform() const { 1577 gfx::Transform Layer::screen_space_transform() const {
1662 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); 1578 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId);
1663 return draw_property_utils::ScreenSpaceTransform( 1579 return draw_property_utils::ScreenSpaceTransform(
1664 this, layer_tree_->property_trees()->transform_tree); 1580 this, layer_tree_->property_trees()->transform_tree);
1665 } 1581 }
1666 1582
1667 LayerTree* Layer::GetLayerTree() const { 1583 LayerTree* Layer::GetLayerTree() const {
1668 return layer_tree_; 1584 return layer_tree_;
1669 } 1585 }
1670 1586
1671 void Layer::SetLayerIdForTesting(int id) {
1672 inputs_.layer_id = id;
1673 }
1674
1675 } // namespace cc 1587 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_position_constraint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698