| 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/layers/surface_layer.h" | 5 #include "cc/layers/surface_layer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 SatisfyDestroySequence(); | 63 SatisfyDestroySequence(); |
| 64 surface_id_ = surface_id; | 64 surface_id_ = surface_id; |
| 65 surface_size_ = size; | 65 surface_size_ = size; |
| 66 surface_scale_ = scale; | 66 surface_scale_ = scale; |
| 67 CreateNewDestroySequence(); | 67 CreateNewDestroySequence(); |
| 68 | 68 |
| 69 UpdateDrawsContent(HasDrawableContent()); | 69 UpdateDrawsContent(HasDrawableContent()); |
| 70 SetNeedsPushProperties(); | 70 SetNeedsPushProperties(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 scoped_ptr<LayerImpl> SurfaceLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 73 std::unique_ptr<LayerImpl> SurfaceLayer::CreateLayerImpl( |
| 74 LayerTreeImpl* tree_impl) { |
| 74 return SurfaceLayerImpl::Create(tree_impl, id()); | 75 return SurfaceLayerImpl::Create(tree_impl, id()); |
| 75 } | 76 } |
| 76 | 77 |
| 77 bool SurfaceLayer::HasDrawableContent() const { | 78 bool SurfaceLayer::HasDrawableContent() const { |
| 78 return !surface_id_.is_null() && Layer::HasDrawableContent(); | 79 return !surface_id_.is_null() && Layer::HasDrawableContent(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 void SurfaceLayer::SetLayerTreeHost(LayerTreeHost* host) { | 82 void SurfaceLayer::SetLayerTreeHost(LayerTreeHost* host) { |
| 82 if (layer_tree_host() == host) { | 83 if (layer_tree_host() == host) { |
| 83 Layer::SetLayerTreeHost(host); | 84 Layer::SetLayerTreeHost(host); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 104 if (layer_tree_host()) { | 105 if (layer_tree_host()) { |
| 105 destroy_sequence_ = layer_tree_host()->CreateSurfaceSequence(); | 106 destroy_sequence_ = layer_tree_host()->CreateSurfaceSequence(); |
| 106 require_callback_.Run(surface_id_, destroy_sequence_); | 107 require_callback_.Run(surface_id_, destroy_sequence_); |
| 107 } | 108 } |
| 108 } | 109 } |
| 109 | 110 |
| 110 void SurfaceLayer::SatisfyDestroySequence() { | 111 void SurfaceLayer::SatisfyDestroySequence() { |
| 111 if (!layer_tree_host()) | 112 if (!layer_tree_host()) |
| 112 return; | 113 return; |
| 113 DCHECK(!destroy_sequence_.is_null()); | 114 DCHECK(!destroy_sequence_.is_null()); |
| 114 scoped_ptr<SatisfySwapPromise> satisfy( | 115 std::unique_ptr<SatisfySwapPromise> satisfy( |
| 115 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); | 116 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); |
| 116 layer_tree_host()->QueueSwapPromise(std::move(satisfy)); | 117 layer_tree_host()->QueueSwapPromise(std::move(satisfy)); |
| 117 destroy_sequence_ = SurfaceSequence(); | 118 destroy_sequence_ = SurfaceSequence(); |
| 118 } | 119 } |
| 119 | 120 |
| 120 } // namespace cc | 121 } // namespace cc |
| OLD | NEW |