Chromium Code Reviews| 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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 return make_scoped_refptr(new SurfaceLayer(std::move(ref_factory))); | 55 return make_scoped_refptr(new SurfaceLayer(std::move(ref_factory))); |
| 56 } | 56 } |
| 57 | 57 |
| 58 SurfaceLayer::SurfaceLayer(scoped_refptr<SurfaceReferenceFactory> ref_factory) | 58 SurfaceLayer::SurfaceLayer(scoped_refptr<SurfaceReferenceFactory> ref_factory) |
| 59 : ref_factory_(std::move(ref_factory)) {} | 59 : ref_factory_(std::move(ref_factory)) {} |
| 60 | 60 |
| 61 SurfaceLayer::~SurfaceLayer() { | 61 SurfaceLayer::~SurfaceLayer() { |
| 62 DCHECK(!layer_tree_host()); | 62 DCHECK(!layer_tree_host()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void SurfaceLayer::SetSurfaceInfo(const SurfaceInfo& surface_info, | 65 void SurfaceLayer::SetSurfaceInfo(const SurfaceInfo& surface_info) { |
| 66 bool stretch_content_to_fill_bounds) { | |
| 67 RemoveCurrentReference(); | 66 RemoveCurrentReference(); |
| 68 surface_info_ = surface_info; | 67 surface_info_ = surface_info; |
| 69 if (layer_tree_host()) { | 68 if (layer_tree_host()) { |
| 70 current_ref_ = | 69 current_ref_ = |
| 71 ref_factory_->CreateReference(layer_tree_host(), surface_info_.id()); | 70 ref_factory_->CreateReference(layer_tree_host(), surface_info_.id()); |
| 72 } | 71 } |
| 72 UpdateDrawsContent(HasDrawableContent()); | |
| 73 SetNeedsPushProperties(); | |
| 74 } | |
| 75 | |
| 76 void SurfaceLayer::SetStretchContentToFillBounds( | |
| 77 bool stretch_content_to_fill_bounds) { | |
| 73 stretch_content_to_fill_bounds_ = stretch_content_to_fill_bounds; | 78 stretch_content_to_fill_bounds_ = stretch_content_to_fill_bounds; |
| 74 UpdateDrawsContent(HasDrawableContent()); | 79 UpdateDrawsContent(HasDrawableContent()); |
|
danakj
2017/01/09 19:37:12
HasDrawableContent does not depend on stretch_cont
| |
| 75 SetNeedsPushProperties(); | 80 SetNeedsPushProperties(); |
| 76 } | 81 } |
| 77 | 82 |
| 78 std::unique_ptr<LayerImpl> SurfaceLayer::CreateLayerImpl( | 83 std::unique_ptr<LayerImpl> SurfaceLayer::CreateLayerImpl( |
| 79 LayerTreeImpl* tree_impl) { | 84 LayerTreeImpl* tree_impl) { |
| 80 return SurfaceLayerImpl::Create(tree_impl, id()); | 85 return SurfaceLayerImpl::Create(tree_impl, id()); |
| 81 } | 86 } |
| 82 | 87 |
| 83 bool SurfaceLayer::HasDrawableContent() const { | 88 bool SurfaceLayer::HasDrawableContent() const { |
| 84 return surface_info_.id().is_valid() && Layer::HasDrawableContent(); | 89 return surface_info_.id().is_valid() && Layer::HasDrawableContent(); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 108 void SurfaceLayer::RemoveCurrentReference() { | 113 void SurfaceLayer::RemoveCurrentReference() { |
| 109 if (!current_ref_) | 114 if (!current_ref_) |
| 110 return; | 115 return; |
| 111 auto swap_promise = base::MakeUnique<SatisfySwapPromise>( | 116 auto swap_promise = base::MakeUnique<SatisfySwapPromise>( |
| 112 std::move(current_ref_), base::ThreadTaskRunnerHandle::Get()); | 117 std::move(current_ref_), base::ThreadTaskRunnerHandle::Get()); |
| 113 layer_tree_host()->GetSwapPromiseManager()->QueueSwapPromise( | 118 layer_tree_host()->GetSwapPromiseManager()->QueueSwapPromise( |
| 114 std::move(swap_promise)); | 119 std::move(swap_promise)); |
| 115 } | 120 } |
| 116 | 121 |
| 117 } // namespace cc | 122 } // namespace cc |
| OLD | NEW |