OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/delegated_renderer_layer.h" | 5 #include "cc/layers/delegated_renderer_layer.h" |
6 | 6 |
7 #include "cc/layers/delegated_renderer_layer_impl.h" | 7 #include "cc/layers/delegated_renderer_layer_impl.h" |
8 #include "cc/output/delegated_frame_data.h" | 8 #include "cc/output/delegated_frame_data.h" |
9 #include "cc/quads/render_pass_draw_quad.h" | 9 #include "cc/quads/render_pass_draw_quad.h" |
10 #include "cc/trees/layer_tree_host.h" | 10 #include "cc/trees/layer_tree_host.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 scoped_refptr<DelegatedRendererLayer> DelegatedRendererLayer::Create( | 14 scoped_refptr<DelegatedRendererLayer> DelegatedRendererLayer::Create( |
15 const scoped_refptr<DelegatedFrameProvider>& frame_provider) { | 15 const scoped_refptr<DelegatedFrameProvider>& frame_provider) { |
16 return scoped_refptr<DelegatedRendererLayer>( | 16 return scoped_refptr<DelegatedRendererLayer>( |
17 new DelegatedRendererLayer(frame_provider)); | 17 new DelegatedRendererLayer(frame_provider)); |
18 } | 18 } |
19 | 19 |
20 DelegatedRendererLayer::DelegatedRendererLayer( | 20 DelegatedRendererLayer::DelegatedRendererLayer( |
21 const scoped_refptr<DelegatedFrameProvider>& frame_provider) | 21 const scoped_refptr<DelegatedFrameProvider>& frame_provider) |
22 : Layer(), | 22 : Layer(), |
23 frame_provider_(frame_provider), | 23 frame_provider_(frame_provider), |
24 should_collect_new_frame_(true), | 24 should_collect_new_frame_(true), |
25 frame_data_(NULL), | 25 frame_data_(nullptr), |
26 weak_ptrs_(this) { | 26 weak_ptrs_(this) { |
27 frame_provider_->AddObserver(this); | 27 frame_provider_->AddObserver(this); |
28 } | 28 } |
29 | 29 |
30 DelegatedRendererLayer::~DelegatedRendererLayer() { | 30 DelegatedRendererLayer::~DelegatedRendererLayer() { |
31 frame_provider_->RemoveObserver(this); | 31 frame_provider_->RemoveObserver(this); |
32 } | 32 } |
33 | 33 |
34 scoped_ptr<LayerImpl> DelegatedRendererLayer::CreateLayerImpl( | 34 scoped_ptr<LayerImpl> DelegatedRendererLayer::CreateLayerImpl( |
35 LayerTreeImpl* tree_impl) { | 35 LayerTreeImpl* tree_impl) { |
(...skipping 26 matching lines...) Expand all Loading... |
62 Layer::PushPropertiesTo(impl); | 62 Layer::PushPropertiesTo(impl); |
63 | 63 |
64 DelegatedRendererLayerImpl* delegated_impl = | 64 DelegatedRendererLayerImpl* delegated_impl = |
65 static_cast<DelegatedRendererLayerImpl*>(impl); | 65 static_cast<DelegatedRendererLayerImpl*>(impl); |
66 | 66 |
67 delegated_impl->CreateChildIdIfNeeded( | 67 delegated_impl->CreateChildIdIfNeeded( |
68 frame_provider_->GetReturnResourcesCallbackForImplThread()); | 68 frame_provider_->GetReturnResourcesCallbackForImplThread()); |
69 | 69 |
70 if (frame_data_) | 70 if (frame_data_) |
71 delegated_impl->SetFrameData(frame_data_, frame_damage_); | 71 delegated_impl->SetFrameData(frame_data_, frame_damage_); |
72 frame_data_ = NULL; | 72 frame_data_ = nullptr; |
73 frame_damage_ = gfx::RectF(); | 73 frame_damage_ = gfx::RectF(); |
74 } | 74 } |
75 | 75 |
76 void DelegatedRendererLayer::ProviderHasNewFrame() { | 76 void DelegatedRendererLayer::ProviderHasNewFrame() { |
77 should_collect_new_frame_ = true; | 77 should_collect_new_frame_ = true; |
78 SetNeedsUpdate(); | 78 SetNeedsUpdate(); |
79 // The active frame needs to be replaced and resources returned before the | 79 // The active frame needs to be replaced and resources returned before the |
80 // commit is called complete. | 80 // commit is called complete. |
81 SetNextCommitWaitsForActivation(); | 81 SetNextCommitWaitsForActivation(); |
82 } | 82 } |
(...skipping 10 matching lines...) Expand all Loading... |
93 | 93 |
94 SetNeedsPushProperties(); | 94 SetNeedsPushProperties(); |
95 return true; | 95 return true; |
96 } | 96 } |
97 | 97 |
98 bool DelegatedRendererLayer::HasDelegatedContent() const { | 98 bool DelegatedRendererLayer::HasDelegatedContent() const { |
99 return true; | 99 return true; |
100 } | 100 } |
101 | 101 |
102 } // namespace cc | 102 } // namespace cc |
OLD | NEW |