| 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 device_scale_factor_(1.f), | 222 device_scale_factor_(1.f), |
| 223 resourceless_software_draw_(false), | 223 resourceless_software_draw_(false), |
| 224 begin_impl_frame_interval_(BeginFrameArgs::DefaultInterval()), | 224 begin_impl_frame_interval_(BeginFrameArgs::DefaultInterval()), |
| 225 animation_registrar_(AnimationRegistrar::Create()), | 225 animation_registrar_(AnimationRegistrar::Create()), |
| 226 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 226 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
| 227 micro_benchmark_controller_(this), | 227 micro_benchmark_controller_(this), |
| 228 shared_bitmap_manager_(shared_bitmap_manager), | 228 shared_bitmap_manager_(shared_bitmap_manager), |
| 229 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | 229 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
| 230 id_(id), | 230 id_(id), |
| 231 requires_high_res_to_draw_(false), | 231 requires_high_res_to_draw_(false), |
| 232 is_likely_to_require_a_draw_(false) { | 232 is_likely_to_require_a_draw_(false), |
| 233 frame_timing_tracker_(FrameTimingTracker::Create()) { |
| 233 DCHECK(proxy_->IsImplThread()); | 234 DCHECK(proxy_->IsImplThread()); |
| 234 DidVisibilityChange(this, visible_); | 235 DidVisibilityChange(this, visible_); |
| 235 animation_registrar_->set_supports_scroll_animations( | 236 animation_registrar_->set_supports_scroll_animations( |
| 236 proxy_->SupportsImplScrolling()); | 237 proxy_->SupportsImplScrolling()); |
| 237 | 238 |
| 238 SetDebugState(settings.initial_debug_state); | 239 SetDebugState(settings.initial_debug_state); |
| 239 | 240 |
| 240 // LTHI always has an active tree. | 241 // LTHI always has an active tree. |
| 241 active_tree_ = LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(), | 242 active_tree_ = LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(), |
| 242 new SyncedElasticOverscroll); | 243 new SyncedElasticOverscroll); |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 | 807 |
| 807 contributing_render_pass_id = | 808 contributing_render_pass_id = |
| 808 it->NextContributingRenderPassId(contributing_render_pass_id); | 809 it->NextContributingRenderPassId(contributing_render_pass_id); |
| 809 } | 810 } |
| 810 } | 811 } |
| 811 | 812 |
| 812 AppendQuadsForLayer(target_render_pass, | 813 AppendQuadsForLayer(target_render_pass, |
| 813 *it, | 814 *it, |
| 814 occlusion_tracker, | 815 occlusion_tracker, |
| 815 &append_quads_data); | 816 &append_quads_data); |
| 817 |
| 818 // For layers that represent themselves, add composite frame timing |
| 819 // requests if the visible rect intersects the requested rect. |
| 820 for (const auto& request : it->frame_timing_requests()) { |
| 821 const gfx::Rect& request_content_rect = |
| 822 it->LayerRectToContentRect(request.rect()); |
| 823 if (request_content_rect.Intersects(it->visible_content_rect())) { |
| 824 frame->composite_events.push_back( |
| 825 FrameTimingTracker::FrameAndRectIds( |
| 826 active_tree_->source_frame_number(), request.id())); |
| 827 } |
| 828 } |
| 816 } | 829 } |
| 817 | 830 |
| 818 ++layers_drawn; | 831 ++layers_drawn; |
| 819 } | 832 } |
| 820 | 833 |
| 821 rendering_stats_instrumentation_->AddVisibleContentArea( | 834 rendering_stats_instrumentation_->AddVisibleContentArea( |
| 822 append_quads_data.visible_content_area); | 835 append_quads_data.visible_content_area); |
| 823 rendering_stats_instrumentation_->AddApproximatedVisibleContentArea( | 836 rendering_stats_instrumentation_->AddApproximatedVisibleContentArea( |
| 824 append_quads_data.approximated_visible_content_area); | 837 append_quads_data.approximated_visible_content_area); |
| 825 | 838 |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 | 1444 |
| 1432 static void LayerTreeHostImplDidBeginTracingCallback(LayerImpl* layer) { | 1445 static void LayerTreeHostImplDidBeginTracingCallback(LayerImpl* layer) { |
| 1433 layer->DidBeginTracing(); | 1446 layer->DidBeginTracing(); |
| 1434 } | 1447 } |
| 1435 | 1448 |
| 1436 void LayerTreeHostImpl::DrawLayers(FrameData* frame, | 1449 void LayerTreeHostImpl::DrawLayers(FrameData* frame, |
| 1437 base::TimeTicks frame_begin_time) { | 1450 base::TimeTicks frame_begin_time) { |
| 1438 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); | 1451 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); |
| 1439 DCHECK(CanDraw()); | 1452 DCHECK(CanDraw()); |
| 1440 | 1453 |
| 1454 if (!frame->composite_events.empty()) { |
| 1455 frame_timing_tracker_->SaveTimeStamps(frame_begin_time, |
| 1456 frame->composite_events); |
| 1457 } |
| 1458 |
| 1441 if (frame->has_no_damage) { | 1459 if (frame->has_no_damage) { |
| 1442 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoDamage", TRACE_EVENT_SCOPE_THREAD); | 1460 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoDamage", TRACE_EVENT_SCOPE_THREAD); |
| 1443 DCHECK(!output_surface_->capabilities() | 1461 DCHECK(!output_surface_->capabilities() |
| 1444 .draw_and_swap_full_viewport_every_frame); | 1462 .draw_and_swap_full_viewport_every_frame); |
| 1445 return; | 1463 return; |
| 1446 } | 1464 } |
| 1447 | 1465 |
| 1448 DCHECK(!frame->render_passes.empty()); | 1466 DCHECK(!frame->render_passes.empty()); |
| 1449 | 1467 |
| 1450 fps_counter_->SaveTimeStamp(frame_begin_time, | 1468 fps_counter_->SaveTimeStamp(frame_begin_time, |
| (...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3459 } | 3477 } |
| 3460 | 3478 |
| 3461 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3479 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
| 3462 std::vector<PictureLayerImpl*>::iterator it = | 3480 std::vector<PictureLayerImpl*>::iterator it = |
| 3463 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3481 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
| 3464 DCHECK(it != picture_layers_.end()); | 3482 DCHECK(it != picture_layers_.end()); |
| 3465 picture_layers_.erase(it); | 3483 picture_layers_.erase(it); |
| 3466 } | 3484 } |
| 3467 | 3485 |
| 3468 } // namespace cc | 3486 } // namespace cc |
| OLD | NEW |