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 : BeginFrameSourceMixIn(), | 228 : client_(client), |
229 client_(client), | |
230 proxy_(proxy), | 229 proxy_(proxy), |
231 use_gpu_rasterization_(false), | 230 use_gpu_rasterization_(false), |
232 input_handler_client_(NULL), | 231 input_handler_client_(NULL), |
233 did_lock_scrolling_layer_(false), | 232 did_lock_scrolling_layer_(false), |
234 should_bubble_scrolls_(false), | 233 should_bubble_scrolls_(false), |
235 wheel_scrolling_(false), | 234 wheel_scrolling_(false), |
236 scroll_affects_scroll_handler_(false), | 235 scroll_affects_scroll_handler_(false), |
237 scroll_layer_id_when_mouse_over_scrollbar_(0), | 236 scroll_layer_id_when_mouse_over_scrollbar_(0), |
238 tile_priorities_dirty_(false), | 237 tile_priorities_dirty_(false), |
239 root_layer_scroll_offset_delegate_(NULL), | 238 root_layer_scroll_offset_delegate_(NULL), |
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 resourceless_software_draw_ = resourceless_software_draw; | 1390 resourceless_software_draw_ = resourceless_software_draw; |
1392 } | 1391 } |
1393 | 1392 |
1394 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 1393 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
1395 if (damage_rect.IsEmpty()) | 1394 if (damage_rect.IsEmpty()) |
1396 return; | 1395 return; |
1397 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | 1396 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
1398 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | 1397 client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
1399 } | 1398 } |
1400 | 1399 |
1401 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { | |
1402 CallOnBeginFrame(args); | |
1403 } | |
1404 | |
1405 void LayerTreeHostImpl::DidSwapBuffers() { | 1400 void LayerTreeHostImpl::DidSwapBuffers() { |
1406 client_->DidSwapBuffersOnImplThread(); | 1401 client_->DidSwapBuffersOnImplThread(); |
1407 } | 1402 } |
1408 | 1403 |
1409 void LayerTreeHostImpl::DidSwapBuffersComplete() { | 1404 void LayerTreeHostImpl::DidSwapBuffersComplete() { |
1410 client_->DidSwapBuffersCompleteOnImplThread(); | 1405 client_->DidSwapBuffersCompleteOnImplThread(); |
1411 } | 1406 } |
1412 | 1407 |
1413 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) { | 1408 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) { |
1414 // TODO(piman): We may need to do some validation on this ack before | 1409 // TODO(piman): We may need to do some validation on this ack before |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 TRACE_EVENT_FLOW_STEP0( | 1627 TRACE_EVENT_FLOW_STEP0( |
1633 "input", | 1628 "input", |
1634 "LatencyInfo.Flow", | 1629 "LatencyInfo.Flow", |
1635 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), | 1630 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), |
1636 "SwapBuffers"); | 1631 "SwapBuffers"); |
1637 } | 1632 } |
1638 renderer_->SwapBuffers(metadata); | 1633 renderer_->SwapBuffers(metadata); |
1639 return true; | 1634 return true; |
1640 } | 1635 } |
1641 | 1636 |
1642 void LayerTreeHostImpl::OnNeedsBeginFramesChange(bool enable) { | |
1643 if (output_surface_) | |
1644 output_surface_->SetNeedsBeginFrame(enable); | |
1645 else | |
1646 DCHECK(!enable); | |
1647 } | |
1648 | |
1649 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { | 1637 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
1650 // Sample the frame time now. This time will be used for updating animations | 1638 // Sample the frame time now. This time will be used for updating animations |
1651 // when we draw. | 1639 // when we draw. |
1652 UpdateCurrentBeginFrameArgs(args); | 1640 UpdateCurrentBeginFrameArgs(args); |
1653 // Cache the begin impl frame interval | 1641 // Cache the begin impl frame interval |
1654 begin_impl_frame_interval_ = args.interval; | 1642 begin_impl_frame_interval_ = args.interval; |
1655 } | 1643 } |
1656 | 1644 |
1657 void LayerTreeHostImpl::UpdateInnerViewportContainerSize() { | 1645 void LayerTreeHostImpl::UpdateInnerViewportContainerSize() { |
1658 LayerImpl* container_layer = active_tree_->InnerViewportContainerLayer(); | 1646 LayerImpl* container_layer = active_tree_->InnerViewportContainerLayer(); |
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3141 // Try to use the current frame time to keep animations non-jittery. But if | 3129 // Try to use the current frame time to keep animations non-jittery. But if |
3142 // we're not in a frame (because this is during an input event or a delayed | 3130 // we're not in a frame (because this is during an input event or a delayed |
3143 // task), fall back to physical time. This should still be monotonic. | 3131 // task), fall back to physical time. This should still be monotonic. |
3144 if (current_begin_frame_args_.IsValid()) | 3132 if (current_begin_frame_args_.IsValid()) |
3145 return current_begin_frame_args_; | 3133 return current_begin_frame_args_; |
3146 return BeginFrameArgs::Create(gfx::FrameTime::Now(), | 3134 return BeginFrameArgs::Create(gfx::FrameTime::Now(), |
3147 base::TimeTicks(), | 3135 base::TimeTicks(), |
3148 BeginFrameArgs::DefaultInterval()); | 3136 BeginFrameArgs::DefaultInterval()); |
3149 } | 3137 } |
3150 | 3138 |
3151 void LayerTreeHostImpl::AsValueInto(base::debug::TracedValue* value) const { | |
3152 return AsValueWithFrameInto(NULL, value); | |
3153 } | |
3154 | |
3155 scoped_refptr<base::debug::ConvertableToTraceFormat> | 3139 scoped_refptr<base::debug::ConvertableToTraceFormat> |
3156 LayerTreeHostImpl::AsValue() const { | 3140 LayerTreeHostImpl::AsValue() const { |
3157 return AsValueWithFrame(NULL); | 3141 return AsValueWithFrame(NULL); |
3158 } | 3142 } |
3159 | 3143 |
3160 scoped_refptr<base::debug::ConvertableToTraceFormat> | 3144 scoped_refptr<base::debug::ConvertableToTraceFormat> |
3161 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { | 3145 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { |
3162 scoped_refptr<base::debug::TracedValue> state = | 3146 scoped_refptr<base::debug::TracedValue> state = |
3163 new base::debug::TracedValue(); | 3147 new base::debug::TracedValue(); |
3164 AsValueWithFrameInto(frame, state.get()); | 3148 AsValueWithFrameInto(frame, state.get()); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3383 } | 3367 } |
3384 | 3368 |
3385 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3369 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3386 std::vector<PictureLayerImpl*>::iterator it = | 3370 std::vector<PictureLayerImpl*>::iterator it = |
3387 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3371 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3388 DCHECK(it != picture_layers_.end()); | 3372 DCHECK(it != picture_layers_.end()); |
3389 picture_layers_.erase(it); | 3373 picture_layers_.erase(it); |
3390 } | 3374 } |
3391 | 3375 |
3392 } // namespace cc | 3376 } // namespace cc |
OLD | NEW |