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 211 matching lines...) Loading... |
222 | 222 |
223 LayerTreeHostImpl::LayerTreeHostImpl( | 223 LayerTreeHostImpl::LayerTreeHostImpl( |
224 const LayerTreeSettings& settings, | 224 const LayerTreeSettings& settings, |
225 LayerTreeHostImplClient* client, | 225 LayerTreeHostImplClient* client, |
226 Proxy* proxy, | 226 Proxy* proxy, |
227 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 227 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
228 SharedBitmapManager* manager, | 228 SharedBitmapManager* manager, |
229 int id) | 229 int id) |
230 : client_(client), | 230 : client_(client), |
231 proxy_(proxy), | 231 proxy_(proxy), |
| 232 needs_begin_frames_(false), |
232 use_gpu_rasterization_(false), | 233 use_gpu_rasterization_(false), |
233 input_handler_client_(NULL), | 234 input_handler_client_(NULL), |
234 did_lock_scrolling_layer_(false), | 235 did_lock_scrolling_layer_(false), |
235 should_bubble_scrolls_(false), | 236 should_bubble_scrolls_(false), |
236 wheel_scrolling_(false), | 237 wheel_scrolling_(false), |
237 scroll_affects_scroll_handler_(false), | 238 scroll_affects_scroll_handler_(false), |
238 scroll_layer_id_when_mouse_over_scrollbar_(0), | 239 scroll_layer_id_when_mouse_over_scrollbar_(0), |
239 tile_priorities_dirty_(false), | 240 tile_priorities_dirty_(false), |
240 root_layer_scroll_offset_delegate_(NULL), | 241 root_layer_scroll_offset_delegate_(NULL), |
241 settings_(settings), | 242 settings_(settings), |
(...skipping 1182 matching lines...) Loading... |
1424 } | 1425 } |
1425 | 1426 |
1426 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 1427 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
1427 if (damage_rect.IsEmpty()) | 1428 if (damage_rect.IsEmpty()) |
1428 return; | 1429 return; |
1429 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | 1430 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
1430 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | 1431 client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
1431 } | 1432 } |
1432 | 1433 |
1433 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { | 1434 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { |
1434 client_->BeginFrame(args); | 1435 SendBeginFrame(args); |
1435 } | 1436 } |
1436 | 1437 |
1437 void LayerTreeHostImpl::DidSwapBuffers() { | 1438 void LayerTreeHostImpl::DidSwapBuffers() { |
1438 client_->DidSwapBuffersOnImplThread(); | 1439 client_->DidSwapBuffersOnImplThread(); |
1439 } | 1440 } |
1440 | 1441 |
1441 void LayerTreeHostImpl::DidSwapBuffersComplete() { | 1442 void LayerTreeHostImpl::DidSwapBuffersComplete() { |
1442 client_->DidSwapBuffersCompleteOnImplThread(); | 1443 client_->DidSwapBuffersCompleteOnImplThread(); |
1443 } | 1444 } |
1444 | 1445 |
(...skipping 219 matching lines...) Loading... |
1664 TRACE_EVENT_FLOW_STEP0( | 1665 TRACE_EVENT_FLOW_STEP0( |
1665 "input", | 1666 "input", |
1666 "LatencyInfo.Flow", | 1667 "LatencyInfo.Flow", |
1667 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), | 1668 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), |
1668 "SwapBuffers"); | 1669 "SwapBuffers"); |
1669 } | 1670 } |
1670 renderer_->SwapBuffers(metadata); | 1671 renderer_->SwapBuffers(metadata); |
1671 return true; | 1672 return true; |
1672 } | 1673 } |
1673 | 1674 |
1674 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { | 1675 bool LayerTreeHostImpl::NeedsBeginFrames() { |
| 1676 return needs_begin_frames_; |
| 1677 } |
| 1678 |
| 1679 void LayerTreeHostImpl::SetNeedsBeginFrames(bool enable) { |
| 1680 needs_begin_frames_ = enable; |
1675 if (output_surface_) | 1681 if (output_surface_) |
1676 output_surface_->SetNeedsBeginFrame(enable); | 1682 output_surface_->SetNeedsBeginFrame(enable); |
1677 else | 1683 else |
1678 DCHECK(!enable); | 1684 DCHECK(!enable); |
1679 } | 1685 } |
1680 | 1686 |
1681 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { | 1687 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
1682 // Sample the frame time now. This time will be used for updating animations | 1688 // Sample the frame time now. This time will be used for updating animations |
1683 // when we draw. | 1689 // when we draw. |
1684 UpdateCurrentBeginFrameArgs(args); | 1690 UpdateCurrentBeginFrameArgs(args); |
(...skipping 1455 matching lines...) Loading... |
3140 // Try to use the current frame time to keep animations non-jittery. But if | 3146 // Try to use the current frame time to keep animations non-jittery. But if |
3141 // we're not in a frame (because this is during an input event or a delayed | 3147 // we're not in a frame (because this is during an input event or a delayed |
3142 // task), fall back to physical time. This should still be monotonic. | 3148 // task), fall back to physical time. This should still be monotonic. |
3143 if (current_begin_frame_args_.IsValid()) | 3149 if (current_begin_frame_args_.IsValid()) |
3144 return current_begin_frame_args_; | 3150 return current_begin_frame_args_; |
3145 return BeginFrameArgs::Create(gfx::FrameTime::Now(), | 3151 return BeginFrameArgs::Create(gfx::FrameTime::Now(), |
3146 base::TimeTicks(), | 3152 base::TimeTicks(), |
3147 BeginFrameArgs::DefaultInterval()); | 3153 BeginFrameArgs::DefaultInterval()); |
3148 } | 3154 } |
3149 | 3155 |
| 3156 void LayerTreeHostImpl::AsValueInto(base::debug::TracedValue* value) const { |
| 3157 return AsValueWithFrameInto(NULL, value); |
| 3158 } |
| 3159 |
3150 scoped_refptr<base::debug::ConvertableToTraceFormat> | 3160 scoped_refptr<base::debug::ConvertableToTraceFormat> |
3151 LayerTreeHostImpl::AsValue() const { | 3161 LayerTreeHostImpl::AsValue() const { |
3152 return AsValueWithFrame(NULL); | 3162 return AsValueWithFrame(NULL); |
3153 } | 3163 } |
3154 | 3164 |
3155 scoped_refptr<base::debug::ConvertableToTraceFormat> | 3165 scoped_refptr<base::debug::ConvertableToTraceFormat> |
3156 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { | 3166 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { |
3157 scoped_refptr<base::debug::TracedValue> state = | 3167 scoped_refptr<base::debug::TracedValue> state = |
3158 new base::debug::TracedValue(); | 3168 new base::debug::TracedValue(); |
3159 AsValueWithFrameInto(frame, state.get()); | 3169 AsValueWithFrameInto(frame, state.get()); |
(...skipping 218 matching lines...) Loading... |
3378 } | 3388 } |
3379 | 3389 |
3380 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3390 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3381 std::vector<PictureLayerImpl*>::iterator it = | 3391 std::vector<PictureLayerImpl*>::iterator it = |
3382 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3392 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3383 DCHECK(it != picture_layers_.end()); | 3393 DCHECK(it != picture_layers_.end()); |
3384 picture_layers_.erase(it); | 3394 picture_layers_.erase(it); |
3385 } | 3395 } |
3386 | 3396 |
3387 } // namespace cc | 3397 } // namespace cc |
OLD | NEW |