| OLD | NEW |
| 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 #ifndef CC_LAYERS_LAYER_H_ | 5 #ifndef CC_LAYERS_LAYER_H_ |
| 6 #define CC_LAYERS_LAYER_H_ | 6 #define CC_LAYERS_LAYER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 class CopyOutputRequest; | 49 class CopyOutputRequest; |
| 50 class LayerClient; | 50 class LayerClient; |
| 51 class LayerImpl; | 51 class LayerImpl; |
| 52 class LayerTreeHost; | 52 class LayerTreeHost; |
| 53 class LayerTreeHostCommon; | 53 class LayerTreeHostCommon; |
| 54 class LayerTreeImpl; | 54 class LayerTreeImpl; |
| 55 class MutatorHost; | 55 class MutatorHost; |
| 56 class ScrollbarLayerInterface; | 56 class ScrollbarLayerInterface; |
| 57 | 57 |
| 58 namespace proto { | |
| 59 class LayerNode; | |
| 60 class LayerProperties; | |
| 61 } // namespace proto | |
| 62 | |
| 63 // Base class for composited layers. Special layer types are derived from | 58 // Base class for composited layers. Special layer types are derived from |
| 64 // this class. | 59 // this class. |
| 65 class CC_EXPORT Layer : public base::RefCounted<Layer> { | 60 class CC_EXPORT Layer : public base::RefCounted<Layer> { |
| 66 public: | 61 public: |
| 67 using LayerListType = LayerList; | 62 using LayerListType = LayerList; |
| 68 using LayerIdMap = std::unordered_map<int, scoped_refptr<Layer>>; | 63 using LayerIdMap = std::unordered_map<int, scoped_refptr<Layer>>; |
| 69 | 64 |
| 70 enum LayerIdLabels { | 65 enum LayerIdLabels { |
| 71 INVALID_ID = -1, | 66 INVALID_ID = -1, |
| 72 }; | 67 }; |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 virtual std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 318 virtual std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| 324 TakeDebugInfo(); | 319 TakeDebugInfo(); |
| 325 virtual void didUpdateMainThreadScrollingReasons(); | 320 virtual void didUpdateMainThreadScrollingReasons(); |
| 326 | 321 |
| 327 void SetLayerClient(LayerClient* client) { inputs_.client = client; } | 322 void SetLayerClient(LayerClient* client) { inputs_.client = client; } |
| 328 | 323 |
| 329 virtual bool IsSnapped(); | 324 virtual bool IsSnapped(); |
| 330 | 325 |
| 331 virtual void PushPropertiesTo(LayerImpl* layer); | 326 virtual void PushPropertiesTo(LayerImpl* layer); |
| 332 | 327 |
| 333 // Sets the type proto::LayerType that should be used for serialization | |
| 334 // of the current layer by calling LayerNode::set_type(proto::LayerType). | |
| 335 // TODO(nyquist): Start using a forward declared enum class when | |
| 336 // https://github.com/google/protobuf/issues/67 has been fixed and rolled in. | |
| 337 // This function would preferably instead return a proto::LayerType, but | |
| 338 // since that is an enum (the protobuf library does not generate enum | |
| 339 // classes), it can't be forward declared. We don't want to include | |
| 340 // //cc/proto/layer.pb.h in this header file, as it requires that all | |
| 341 // dependent targets would have to be given the config for how to include it. | |
| 342 virtual void SetTypeForProtoSerialization(proto::LayerNode* proto) const; | |
| 343 | |
| 344 // Recursively iterate over this layer and all children and write the | |
| 345 // hierarchical structure to the given LayerNode proto. In addition to the | |
| 346 // structure itself, the Layer id and type is also written to facilitate | |
| 347 // construction of the correct layer on the client. | |
| 348 virtual void ToLayerNodeProto(proto::LayerNode* proto) const; | |
| 349 | |
| 350 // This method is similar to PushPropertiesTo, but instead of pushing to | |
| 351 // a LayerImpl, it pushes the properties to proto::LayerProperties. It is | |
| 352 // called only on layers that have changed properties. The properties | |
| 353 // themselves are pushed to proto::LayerProperties. | |
| 354 virtual void ToLayerPropertiesProto(proto::LayerProperties* proto); | |
| 355 | |
| 356 LayerTreeHost* GetLayerTreeHostForTesting() const { return layer_tree_host_; } | 328 LayerTreeHost* GetLayerTreeHostForTesting() const { return layer_tree_host_; } |
| 357 LayerTree* GetLayerTree() const; | 329 LayerTree* GetLayerTree() const; |
| 358 | 330 |
| 359 virtual ScrollbarLayerInterface* ToScrollbarLayer(); | 331 virtual ScrollbarLayerInterface* ToScrollbarLayer(); |
| 360 | 332 |
| 361 virtual sk_sp<SkPicture> GetPicture() const; | 333 virtual sk_sp<SkPicture> GetPicture() const; |
| 362 | 334 |
| 363 // Constructs a LayerImpl of the correct runtime type for this Layer type. | 335 // Constructs a LayerImpl of the correct runtime type for this Layer type. |
| 364 virtual std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); | 336 virtual std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); |
| 365 | 337 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 } | 430 } |
| 459 const gfx::Size& preferred_raster_bounds() const { | 431 const gfx::Size& preferred_raster_bounds() const { |
| 460 return inputs_.preferred_raster_bounds; | 432 return inputs_.preferred_raster_bounds; |
| 461 } | 433 } |
| 462 void ClearPreferredRasterBounds(); | 434 void ClearPreferredRasterBounds(); |
| 463 | 435 |
| 464 MutatorHost* GetMutatorHost() const; | 436 MutatorHost* GetMutatorHost() const; |
| 465 | 437 |
| 466 ElementListType GetElementTypeForAnimation() const; | 438 ElementListType GetElementTypeForAnimation() const; |
| 467 | 439 |
| 468 // Tests in remote mode need to explicitly set the layer id so it matches the | |
| 469 // layer id for the corresponding Layer on the engine. | |
| 470 void SetLayerIdForTesting(int id); | |
| 471 | |
| 472 void SetScrollbarsHiddenFromImplSide(bool hidden); | 440 void SetScrollbarsHiddenFromImplSide(bool hidden); |
| 473 | 441 |
| 474 const gfx::Rect& update_rect() const { return inputs_.update_rect; } | 442 const gfx::Rect& update_rect() const { return inputs_.update_rect; } |
| 475 | 443 |
| 476 protected: | 444 protected: |
| 477 friend class LayerImpl; | 445 friend class LayerImpl; |
| 478 friend class TreeSynchronizer; | 446 friend class TreeSynchronizer; |
| 479 virtual ~Layer(); | 447 virtual ~Layer(); |
| 480 Layer(); | 448 Layer(); |
| 481 | 449 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 // These all act like draw properties, so don't need push properties. | 659 // These all act like draw properties, so don't need push properties. |
| 692 gfx::Rect visible_layer_rect_; | 660 gfx::Rect visible_layer_rect_; |
| 693 size_t num_unclipped_descendants_; | 661 size_t num_unclipped_descendants_; |
| 694 | 662 |
| 695 DISALLOW_COPY_AND_ASSIGN(Layer); | 663 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 696 }; | 664 }; |
| 697 | 665 |
| 698 } // namespace cc | 666 } // namespace cc |
| 699 | 667 |
| 700 #endif // CC_LAYERS_LAYER_H_ | 668 #endif // CC_LAYERS_LAYER_H_ |
| OLD | NEW |