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_client.h" | |
8 #include "cc/layers/delegated_renderer_layer_impl.h" | 7 #include "cc/layers/delegated_renderer_layer_impl.h" |
9 #include "cc/output/delegated_frame_data.h" | 8 #include "cc/output/delegated_frame_data.h" |
10 #include "cc/quads/render_pass_draw_quad.h" | 9 #include "cc/quads/render_pass_draw_quad.h" |
11 #include "cc/trees/blocking_task_runner.h" | 10 #include "cc/trees/blocking_task_runner.h" |
12 #include "cc/trees/layer_tree_host.h" | 11 #include "cc/trees/layer_tree_host.h" |
13 | 12 |
14 namespace cc { | 13 namespace cc { |
15 | 14 |
16 scoped_refptr<DelegatedRendererLayer> DelegatedRendererLayer::Create( | 15 scoped_refptr<DelegatedRendererLayer> DelegatedRendererLayer::Create( |
17 DelegatedRendererLayerClient* client, | |
18 const scoped_refptr<DelegatedFrameProvider>& frame_provider) { | 16 const scoped_refptr<DelegatedFrameProvider>& frame_provider) { |
19 return scoped_refptr<DelegatedRendererLayer>( | 17 return scoped_refptr<DelegatedRendererLayer>( |
20 new DelegatedRendererLayer(client, frame_provider)); | 18 new DelegatedRendererLayer(frame_provider)); |
21 } | 19 } |
22 | 20 |
23 DelegatedRendererLayer::DelegatedRendererLayer( | 21 DelegatedRendererLayer::DelegatedRendererLayer( |
24 DelegatedRendererLayerClient* client, | |
25 const scoped_refptr<DelegatedFrameProvider>& frame_provider) | 22 const scoped_refptr<DelegatedFrameProvider>& frame_provider) |
26 : Layer(), | 23 : Layer(), |
27 client_(client), | |
28 frame_provider_(frame_provider), | 24 frame_provider_(frame_provider), |
29 should_collect_new_frame_(true), | 25 should_collect_new_frame_(true), |
30 frame_data_(NULL), | 26 frame_data_(NULL), |
31 main_thread_runner_(BlockingTaskRunner::current()), | 27 main_thread_runner_(BlockingTaskRunner::current()), |
32 weak_ptrs_(this) { | 28 weak_ptrs_(this) { |
33 frame_provider_->AddObserver(this); | 29 frame_provider_->AddObserver(this); |
34 } | 30 } |
35 | 31 |
36 DelegatedRendererLayer::~DelegatedRendererLayer() { | 32 DelegatedRendererLayer::~DelegatedRendererLayer() { |
37 frame_provider_->RemoveObserver(this); | 33 frame_provider_->RemoveObserver(this); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 delegated_impl->SetDisplaySize(display_size_); | 70 delegated_impl->SetDisplaySize(display_size_); |
75 | 71 |
76 delegated_impl->CreateChildIdIfNeeded( | 72 delegated_impl->CreateChildIdIfNeeded( |
77 frame_provider_->GetReturnResourcesCallbackForImplThread()); | 73 frame_provider_->GetReturnResourcesCallbackForImplThread()); |
78 | 74 |
79 if (frame_data_) | 75 if (frame_data_) |
80 delegated_impl->SetFrameData(frame_data_, frame_damage_); | 76 delegated_impl->SetFrameData(frame_data_, frame_damage_); |
81 frame_data_ = NULL; | 77 frame_data_ = NULL; |
82 frame_damage_ = gfx::RectF(); | 78 frame_damage_ = gfx::RectF(); |
83 | 79 |
84 // The ResourceProvider will have the new frame as soon as we push it to the | |
85 // pending tree. So resources no longer in use will be returned as well. | |
86 if (client_) | |
87 client_->DidCommitFrameData(); | |
88 | |
89 // TODO(danakj): The DidCommitFrameData() notification requires a push | 80 // TODO(danakj): The DidCommitFrameData() notification requires a push |
90 // properties to happen in order to notify about resources returned | 81 // properties to happen in order to notify about resources returned |
91 // from the parent compositor that are no longer in use. crbug.com/259090 | 82 // from the parent compositor that are no longer in use. crbug.com/259090 |
92 needs_push_properties_ = true; | 83 needs_push_properties_ = true; |
powei
2013/12/02 22:26:47
@danakj. so I probably cannot remove this, but sho
danakj
2013/12/02 22:41:30
We should work on removing this, the TODO should r
piman
2013/12/03 01:46:41
I don't see a reason why a needs_push_properties i
powei
2013/12/03 02:11:11
crbug.com/259090 has been merged into crbug.com/26
| |
93 } | 84 } |
94 | 85 |
95 void DelegatedRendererLayer::ProviderHasNewFrame() { | 86 void DelegatedRendererLayer::ProviderHasNewFrame() { |
96 should_collect_new_frame_ = true; | 87 should_collect_new_frame_ = true; |
97 SetNeedsUpdate(); | 88 SetNeedsUpdate(); |
98 // The active frame needs to be replaced and resources returned before the | 89 // The active frame needs to be replaced and resources returned before the |
99 // commit is called complete. | 90 // commit is called complete. |
100 SetNextCommitWaitsForActivation(); | 91 SetNextCommitWaitsForActivation(); |
101 } | 92 } |
102 | 93 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 | 129 |
139 // If any quad has a filter operation or a blend mode other than normal, | 130 // If any quad has a filter operation or a blend mode other than normal, |
140 // then we need an offscreen context to draw this layer's content. | 131 // then we need an offscreen context to draw this layer's content. |
141 if (FrameDataRequiresFilterContext(frame_data_)) | 132 if (FrameDataRequiresFilterContext(frame_data_)) |
142 layer_tree_host()->set_needs_filter_context(); | 133 layer_tree_host()->set_needs_filter_context(); |
143 | 134 |
144 return true; | 135 return true; |
145 } | 136 } |
146 | 137 |
147 } // namespace cc | 138 } // namespace cc |
OLD | NEW |