OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 settings, client, proxy, rendering_stats_instrumentation, manager, id)); | 218 settings, client, proxy, rendering_stats_instrumentation, manager, id)); |
219 } | 219 } |
220 | 220 |
221 LayerTreeHostImpl::LayerTreeHostImpl( | 221 LayerTreeHostImpl::LayerTreeHostImpl( |
222 const LayerTreeSettings& settings, | 222 const LayerTreeSettings& settings, |
223 LayerTreeHostImplClient* client, | 223 LayerTreeHostImplClient* client, |
224 Proxy* proxy, | 224 Proxy* proxy, |
225 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 225 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
226 SharedBitmapManager* manager, | 226 SharedBitmapManager* manager, |
227 int id) | 227 int id) |
228 : client_(client), | 228 : BeginFrameSourceMixIn(), |
| 229 client_(client), |
229 proxy_(proxy), | 230 proxy_(proxy), |
230 use_gpu_rasterization_(false), | 231 use_gpu_rasterization_(false), |
231 input_handler_client_(NULL), | 232 input_handler_client_(NULL), |
232 did_lock_scrolling_layer_(false), | 233 did_lock_scrolling_layer_(false), |
233 should_bubble_scrolls_(false), | 234 should_bubble_scrolls_(false), |
234 wheel_scrolling_(false), | 235 wheel_scrolling_(false), |
235 scroll_affects_scroll_handler_(false), | 236 scroll_affects_scroll_handler_(false), |
236 scroll_layer_id_when_mouse_over_scrollbar_(0), | 237 scroll_layer_id_when_mouse_over_scrollbar_(0), |
237 tile_priorities_dirty_(false), | 238 tile_priorities_dirty_(false), |
238 root_layer_scroll_offset_delegate_(NULL), | 239 root_layer_scroll_offset_delegate_(NULL), |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 } | 1427 } |
1427 | 1428 |
1428 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 1429 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
1429 if (damage_rect.IsEmpty()) | 1430 if (damage_rect.IsEmpty()) |
1430 return; | 1431 return; |
1431 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | 1432 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
1432 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | 1433 client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
1433 } | 1434 } |
1434 | 1435 |
1435 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { | 1436 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { |
1436 client_->BeginFrame(args); | 1437 CallOnBeginFrame(args); |
1437 } | 1438 } |
1438 | 1439 |
1439 void LayerTreeHostImpl::DidSwapBuffers() { | 1440 void LayerTreeHostImpl::DidSwapBuffers() { |
1440 client_->DidSwapBuffersOnImplThread(); | 1441 client_->DidSwapBuffersOnImplThread(); |
1441 } | 1442 } |
1442 | 1443 |
1443 void LayerTreeHostImpl::DidSwapBuffersComplete() { | 1444 void LayerTreeHostImpl::DidSwapBuffersComplete() { |
1444 client_->DidSwapBuffersCompleteOnImplThread(); | 1445 client_->DidSwapBuffersCompleteOnImplThread(); |
1445 } | 1446 } |
1446 | 1447 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 TRACE_EVENT_FLOW_STEP0( | 1667 TRACE_EVENT_FLOW_STEP0( |
1667 "input", | 1668 "input", |
1668 "LatencyInfo.Flow", | 1669 "LatencyInfo.Flow", |
1669 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), | 1670 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), |
1670 "SwapBuffers"); | 1671 "SwapBuffers"); |
1671 } | 1672 } |
1672 renderer_->SwapBuffers(metadata); | 1673 renderer_->SwapBuffers(metadata); |
1673 return true; | 1674 return true; |
1674 } | 1675 } |
1675 | 1676 |
1676 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { | 1677 void LayerTreeHostImpl::OnNeedsBeginFramesChange(bool enable) { |
1677 if (output_surface_) | 1678 if (output_surface_) |
1678 output_surface_->SetNeedsBeginFrame(enable); | 1679 output_surface_->SetNeedsBeginFrame(enable); |
1679 else | 1680 else |
1680 DCHECK(!enable); | 1681 DCHECK(!enable); |
1681 } | 1682 } |
1682 | 1683 |
1683 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { | 1684 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
1684 // Sample the frame time now. This time will be used for updating animations | 1685 // Sample the frame time now. This time will be used for updating animations |
1685 // when we draw. | 1686 // when we draw. |
1686 UpdateCurrentBeginFrameArgs(args); | 1687 UpdateCurrentBeginFrameArgs(args); |
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3162 // Try to use the current frame time to keep animations non-jittery. But if | 3163 // Try to use the current frame time to keep animations non-jittery. But if |
3163 // we're not in a frame (because this is during an input event or a delayed | 3164 // we're not in a frame (because this is during an input event or a delayed |
3164 // task), fall back to physical time. This should still be monotonic. | 3165 // task), fall back to physical time. This should still be monotonic. |
3165 if (current_begin_frame_args_.IsValid()) | 3166 if (current_begin_frame_args_.IsValid()) |
3166 return current_begin_frame_args_; | 3167 return current_begin_frame_args_; |
3167 return BeginFrameArgs::Create(gfx::FrameTime::Now(), | 3168 return BeginFrameArgs::Create(gfx::FrameTime::Now(), |
3168 base::TimeTicks(), | 3169 base::TimeTicks(), |
3169 BeginFrameArgs::DefaultInterval()); | 3170 BeginFrameArgs::DefaultInterval()); |
3170 } | 3171 } |
3171 | 3172 |
| 3173 void LayerTreeHostImpl::AsValueInto(base::debug::TracedValue* value) const { |
| 3174 return AsValueWithFrameInto(NULL, value); |
| 3175 } |
| 3176 |
3172 scoped_refptr<base::debug::ConvertableToTraceFormat> | 3177 scoped_refptr<base::debug::ConvertableToTraceFormat> |
3173 LayerTreeHostImpl::AsValue() const { | 3178 LayerTreeHostImpl::AsValue() const { |
3174 return AsValueWithFrame(NULL); | 3179 return AsValueWithFrame(NULL); |
3175 } | 3180 } |
3176 | 3181 |
3177 scoped_refptr<base::debug::ConvertableToTraceFormat> | 3182 scoped_refptr<base::debug::ConvertableToTraceFormat> |
3178 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { | 3183 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { |
3179 scoped_refptr<base::debug::TracedValue> state = | 3184 scoped_refptr<base::debug::TracedValue> state = |
3180 new base::debug::TracedValue(); | 3185 new base::debug::TracedValue(); |
3181 AsValueWithFrameInto(frame, state.get()); | 3186 AsValueWithFrameInto(frame, state.get()); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3400 } | 3405 } |
3401 | 3406 |
3402 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3407 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3403 std::vector<PictureLayerImpl*>::iterator it = | 3408 std::vector<PictureLayerImpl*>::iterator it = |
3404 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3409 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3405 DCHECK(it != picture_layers_.end()); | 3410 DCHECK(it != picture_layers_.end()); |
3406 picture_layers_.erase(it); | 3411 picture_layers_.erase(it); |
3407 } | 3412 } |
3408 | 3413 |
3409 } // namespace cc | 3414 } // namespace cc |
OLD | NEW |