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...) Expand 10 before | Expand all | Expand 10 after 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 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1422 } | 1423 } |
1423 | 1424 |
1424 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 1425 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
1425 if (damage_rect.IsEmpty()) | 1426 if (damage_rect.IsEmpty()) |
1426 return; | 1427 return; |
1427 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | 1428 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
1428 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | 1429 client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
1429 } | 1430 } |
1430 | 1431 |
1431 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { | 1432 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { |
1432 client_->BeginFrame(args); | 1433 CallOnBeginFrame(args); |
1433 } | 1434 } |
1434 | 1435 |
1435 void LayerTreeHostImpl::DidSwapBuffers() { | 1436 void LayerTreeHostImpl::DidSwapBuffers() { |
1436 client_->DidSwapBuffersOnImplThread(); | 1437 client_->DidSwapBuffersOnImplThread(); |
1437 } | 1438 } |
1438 | 1439 |
1439 void LayerTreeHostImpl::DidSwapBuffersComplete() { | 1440 void LayerTreeHostImpl::DidSwapBuffersComplete() { |
1440 client_->DidSwapBuffersCompleteOnImplThread(); | 1441 client_->DidSwapBuffersCompleteOnImplThread(); |
1441 } | 1442 } |
1442 | 1443 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 TRACE_EVENT_FLOW_STEP0( | 1663 TRACE_EVENT_FLOW_STEP0( |
1663 "input", | 1664 "input", |
1664 "LatencyInfo.Flow", | 1665 "LatencyInfo.Flow", |
1665 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), | 1666 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), |
1666 "SwapBuffers"); | 1667 "SwapBuffers"); |
1667 } | 1668 } |
1668 renderer_->SwapBuffers(metadata); | 1669 renderer_->SwapBuffers(metadata); |
1669 return true; | 1670 return true; |
1670 } | 1671 } |
1671 | 1672 |
1672 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { | 1673 bool LayerTreeHostImpl::NeedsBeginFrames() const { |
| 1674 return needs_begin_frames_; |
| 1675 } |
| 1676 |
| 1677 void LayerTreeHostImpl::SetNeedsBeginFrames(bool enable) { |
| 1678 needs_begin_frames_ = enable; |
1673 if (output_surface_) | 1679 if (output_surface_) |
1674 output_surface_->SetNeedsBeginFrame(enable); | 1680 output_surface_->SetNeedsBeginFrame(enable); |
1675 else | 1681 else |
1676 DCHECK(!enable); | 1682 DCHECK(!enable); |
1677 } | 1683 } |
1678 | 1684 |
1679 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { | 1685 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
1680 // Sample the frame time now. This time will be used for updating animations | 1686 // Sample the frame time now. This time will be used for updating animations |
1681 // when we draw. | 1687 // when we draw. |
1682 UpdateCurrentBeginFrameArgs(args); | 1688 UpdateCurrentBeginFrameArgs(args); |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after 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...) Expand 10 before | Expand all | Expand 10 after 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 |