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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 new DebugScopedSetImplThread(layer_tree_host_impl_->proxy())); | 135 new DebugScopedSetImplThread(layer_tree_host_impl_->proxy())); |
136 } | 136 } |
137 | 137 |
138 // TODO(enne): This should probably happen post-animate. | 138 // TODO(enne): This should probably happen post-animate. |
139 if (layer_tree_host_impl_->pending_tree()) { | 139 if (layer_tree_host_impl_->pending_tree()) { |
140 layer_tree_host_impl_->pending_tree()->UpdateDrawProperties(); | 140 layer_tree_host_impl_->pending_tree()->UpdateDrawProperties(); |
141 layer_tree_host_impl_->ManageTiles(); | 141 layer_tree_host_impl_->ManageTiles(); |
142 } | 142 } |
143 | 143 |
144 layer_tree_host_impl_->Animate( | 144 layer_tree_host_impl_->Animate( |
145 layer_tree_host_impl_->CurrentFrameTimeTicks(), | 145 gfx::FrameTime::Now(), |
146 layer_tree_host_impl_->CurrentFrameTime()); | 146 layer_tree_host_impl_->CurrentFrameTime()); |
147 layer_tree_host_impl_->UpdateBackgroundAnimateTicking(true); | 147 layer_tree_host_impl_->UpdateBackgroundAnimateTicking(true); |
148 bool start_ready_animations = true; | 148 bool start_ready_animations = true; |
149 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); | 149 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); |
150 layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame(); | 150 layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame(); |
151 } | 151 } |
152 | 152 |
153 void SetActive(bool active) { | 153 void SetActive(bool active) { |
154 if (active != time_source_->Active()) | 154 if (active != time_source_->Active()) |
155 time_source_->SetActive(active); | 155 time_source_->SetActive(active); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 } | 343 } |
344 if (EvictedUIResourcesExist()) { | 344 if (EvictedUIResourcesExist()) { |
345 TRACE_EVENT_INSTANT0( | 345 TRACE_EVENT_INSTANT0( |
346 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", | 346 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", |
347 TRACE_EVENT_SCOPE_THREAD); | 347 TRACE_EVENT_SCOPE_THREAD); |
348 return false; | 348 return false; |
349 } | 349 } |
350 return true; | 350 return true; |
351 } | 351 } |
352 | 352 |
353 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time, | 353 void LayerTreeHostImpl::Animate(gfx::FrameTime monotonic_time, |
354 base::Time wall_clock_time) { | 354 base::Time wall_clock_time) { |
355 if (input_handler_client_) | 355 if (input_handler_client_) |
356 input_handler_client_->Animate(monotonic_time); | 356 input_handler_client_->Animate(monotonic_time); |
357 AnimatePageScale(monotonic_time); | 357 AnimatePageScale(monotonic_time); |
358 AnimateLayers(monotonic_time, wall_clock_time); | 358 AnimateLayers(monotonic_time, wall_clock_time); |
359 AnimateScrollbars(monotonic_time); | 359 AnimateScrollbars(monotonic_time); |
360 AnimateTopControls(monotonic_time); | 360 AnimateTopControls(monotonic_time); |
361 } | 361 } |
362 | 362 |
363 void LayerTreeHostImpl::ManageTiles() { | 363 void LayerTreeHostImpl::ManageTiles() { |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 metadata.root_scroll_offset = RootScrollLayer()->TotalScrollOffset(); | 1241 metadata.root_scroll_offset = RootScrollLayer()->TotalScrollOffset(); |
1242 | 1242 |
1243 return metadata; | 1243 return metadata; |
1244 } | 1244 } |
1245 | 1245 |
1246 static void LayerTreeHostImplDidBeginTracingCallback(LayerImpl* layer) { | 1246 static void LayerTreeHostImplDidBeginTracingCallback(LayerImpl* layer) { |
1247 layer->DidBeginTracing(); | 1247 layer->DidBeginTracing(); |
1248 } | 1248 } |
1249 | 1249 |
1250 void LayerTreeHostImpl::DrawLayers(FrameData* frame, | 1250 void LayerTreeHostImpl::DrawLayers(FrameData* frame, |
1251 base::TimeTicks frame_begin_time) { | 1251 gfx::FrameTime frame_begin_time) { |
1252 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); | 1252 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); |
1253 DCHECK(CanDraw()); | 1253 DCHECK(CanDraw()); |
1254 | 1254 |
1255 if (frame->has_no_damage) { | 1255 if (frame->has_no_damage) { |
1256 TRACE_EVENT0("cc", "EarlyOut_NoDamage"); | 1256 TRACE_EVENT0("cc", "EarlyOut_NoDamage"); |
1257 DCHECK(!output_surface_->capabilities() | 1257 DCHECK(!output_surface_->capabilities() |
1258 .draw_and_swap_full_viewport_every_frame); | 1258 .draw_and_swap_full_viewport_every_frame); |
1259 return; | 1259 return; |
1260 } | 1260 } |
1261 | 1261 |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2308 return; | 2308 return; |
2309 | 2309 |
2310 if (scroll_layer_id_when_mouse_over_scrollbar_) { | 2310 if (scroll_layer_id_when_mouse_over_scrollbar_) { |
2311 LayerImpl* scroll_layer_impl = active_tree_->LayerById( | 2311 LayerImpl* scroll_layer_impl = active_tree_->LayerById( |
2312 scroll_layer_id_when_mouse_over_scrollbar_); | 2312 scroll_layer_id_when_mouse_over_scrollbar_); |
2313 | 2313 |
2314 ScrollbarAnimationController* animation_controller = | 2314 ScrollbarAnimationController* animation_controller = |
2315 scroll_layer_impl->scrollbar_animation_controller(); | 2315 scroll_layer_impl->scrollbar_animation_controller(); |
2316 if (animation_controller) { | 2316 if (animation_controller) { |
2317 animation_controller->DidMouseMoveOffScrollbar( | 2317 animation_controller->DidMouseMoveOffScrollbar( |
2318 CurrentPhysicalTimeTicks()); | 2318 CurrentPhysicalFrameTime()); |
2319 StartScrollbarAnimation(); | 2319 StartScrollbarAnimation(); |
2320 } | 2320 } |
2321 scroll_layer_id_when_mouse_over_scrollbar_ = 0; | 2321 scroll_layer_id_when_mouse_over_scrollbar_ = 0; |
2322 } | 2322 } |
2323 | 2323 |
2324 bool scroll_on_main_thread = false; | 2324 bool scroll_on_main_thread = false; |
2325 LayerImpl* scroll_layer_impl = FindScrollLayerForDeviceViewportPoint( | 2325 LayerImpl* scroll_layer_impl = FindScrollLayerForDeviceViewportPoint( |
2326 device_viewport_point, InputHandler::Gesture, layer_impl, | 2326 device_viewport_point, InputHandler::Gesture, layer_impl, |
2327 &scroll_on_main_thread); | 2327 &scroll_on_main_thread); |
2328 if (scroll_on_main_thread || !scroll_layer_impl) | 2328 if (scroll_on_main_thread || !scroll_layer_impl) |
2329 return; | 2329 return; |
2330 | 2330 |
2331 ScrollbarAnimationController* animation_controller = | 2331 ScrollbarAnimationController* animation_controller = |
2332 scroll_layer_impl->scrollbar_animation_controller(); | 2332 scroll_layer_impl->scrollbar_animation_controller(); |
2333 if (!animation_controller) | 2333 if (!animation_controller) |
2334 return; | 2334 return; |
2335 | 2335 |
2336 float distance_to_scrollbar = std::min( | 2336 float distance_to_scrollbar = std::min( |
2337 DeviceSpaceDistanceToLayer(device_viewport_point, | 2337 DeviceSpaceDistanceToLayer(device_viewport_point, |
2338 scroll_layer_impl->horizontal_scrollbar_layer()), | 2338 scroll_layer_impl->horizontal_scrollbar_layer()), |
2339 DeviceSpaceDistanceToLayer(device_viewport_point, | 2339 DeviceSpaceDistanceToLayer(device_viewport_point, |
2340 scroll_layer_impl->vertical_scrollbar_layer())); | 2340 scroll_layer_impl->vertical_scrollbar_layer())); |
2341 | 2341 |
2342 bool should_animate = animation_controller->DidMouseMoveNear( | 2342 bool should_animate = animation_controller->DidMouseMoveNear( |
2343 CurrentPhysicalTimeTicks(), distance_to_scrollbar / device_scale_factor_); | 2343 CurrentPhysicalFrameTime(), distance_to_scrollbar / device_scale_factor_); |
2344 if (should_animate) { | 2344 if (should_animate) { |
2345 client_->SetNeedsRedrawOnImplThread(); | 2345 client_->SetNeedsRedrawOnImplThread(); |
2346 StartScrollbarAnimation(); | 2346 StartScrollbarAnimation(); |
2347 } | 2347 } |
2348 } | 2348 } |
2349 | 2349 |
2350 bool LayerTreeHostImpl::HandleMouseOverScrollbar(LayerImpl* layer_impl, | 2350 bool LayerTreeHostImpl::HandleMouseOverScrollbar(LayerImpl* layer_impl, |
2351 gfx::PointF device_viewport_point) { | 2351 gfx::PointF device_viewport_point) { |
2352 if (layer_impl && layer_impl->ToScrollbarLayer()) { | 2352 if (layer_impl && layer_impl->ToScrollbarLayer()) { |
2353 int scroll_layer_id = layer_impl->ToScrollbarLayer()->ScrollLayerId(); | 2353 int scroll_layer_id = layer_impl->ToScrollbarLayer()->ScrollLayerId(); |
2354 layer_impl = active_tree_->LayerById(scroll_layer_id); | 2354 layer_impl = active_tree_->LayerById(scroll_layer_id); |
2355 if (layer_impl && layer_impl->scrollbar_animation_controller()) { | 2355 if (layer_impl && layer_impl->scrollbar_animation_controller()) { |
2356 scroll_layer_id_when_mouse_over_scrollbar_ = scroll_layer_id; | 2356 scroll_layer_id_when_mouse_over_scrollbar_ = scroll_layer_id; |
2357 layer_impl->scrollbar_animation_controller()->DidMouseMoveNear( | 2357 layer_impl->scrollbar_animation_controller()->DidMouseMoveNear( |
2358 CurrentPhysicalTimeTicks(), 0); | 2358 CurrentPhysicalFrameTime(), 0); |
2359 } else { | 2359 } else { |
2360 scroll_layer_id_when_mouse_over_scrollbar_ = 0; | 2360 scroll_layer_id_when_mouse_over_scrollbar_ = 0; |
2361 } | 2361 } |
2362 | 2362 |
2363 return true; | 2363 return true; |
2364 } | 2364 } |
2365 | 2365 |
2366 return false; | 2366 return false; |
2367 } | 2367 } |
2368 | 2368 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2438 scroll_info->page_scale_delta = active_tree_->page_scale_delta(); | 2438 scroll_info->page_scale_delta = active_tree_->page_scale_delta(); |
2439 active_tree_->set_sent_page_scale_delta(scroll_info->page_scale_delta); | 2439 active_tree_->set_sent_page_scale_delta(scroll_info->page_scale_delta); |
2440 | 2440 |
2441 return scroll_info.Pass(); | 2441 return scroll_info.Pass(); |
2442 } | 2442 } |
2443 | 2443 |
2444 void LayerTreeHostImpl::SetFullRootLayerDamage() { | 2444 void LayerTreeHostImpl::SetFullRootLayerDamage() { |
2445 SetViewportDamage(gfx::Rect(DrawViewportSize())); | 2445 SetViewportDamage(gfx::Rect(DrawViewportSize())); |
2446 } | 2446 } |
2447 | 2447 |
2448 void LayerTreeHostImpl::AnimatePageScale(base::TimeTicks time) { | 2448 void LayerTreeHostImpl::AnimatePageScale(gfx::FrameTime time) { |
2449 if (!page_scale_animation_ || !RootScrollLayer()) | 2449 if (!page_scale_animation_ || !RootScrollLayer()) |
2450 return; | 2450 return; |
2451 | 2451 |
2452 double monotonic_time = (time - base::TimeTicks()).InSecondsF(); | 2452 double monotonic_time = time.Unsafe_InSecondsF(); |
2453 gfx::Vector2dF scroll_total = RootScrollLayer()->scroll_offset() + | 2453 gfx::Vector2dF scroll_total = RootScrollLayer()->scroll_offset() + |
2454 RootScrollLayer()->ScrollDelta(); | 2454 RootScrollLayer()->ScrollDelta(); |
2455 | 2455 |
2456 if (!page_scale_animation_->IsAnimationStarted()) | 2456 if (!page_scale_animation_->IsAnimationStarted()) |
2457 page_scale_animation_->StartAnimation(monotonic_time); | 2457 page_scale_animation_->StartAnimation(monotonic_time); |
2458 | 2458 |
2459 active_tree_->SetPageScaleDelta( | 2459 active_tree_->SetPageScaleDelta( |
2460 page_scale_animation_->PageScaleFactorAtTime(monotonic_time) / | 2460 page_scale_animation_->PageScaleFactorAtTime(monotonic_time) / |
2461 active_tree_->page_scale_factor()); | 2461 active_tree_->page_scale_factor()); |
2462 gfx::Vector2dF next_scroll = | 2462 gfx::Vector2dF next_scroll = |
2463 page_scale_animation_->ScrollOffsetAtTime(monotonic_time); | 2463 page_scale_animation_->ScrollOffsetAtTime(monotonic_time); |
2464 | 2464 |
2465 RootScrollLayer()->ScrollBy(next_scroll - scroll_total); | 2465 RootScrollLayer()->ScrollBy(next_scroll - scroll_total); |
2466 client_->SetNeedsRedrawOnImplThread(); | 2466 client_->SetNeedsRedrawOnImplThread(); |
2467 | 2467 |
2468 if (page_scale_animation_->IsAnimationCompleteAtTime(monotonic_time)) { | 2468 if (page_scale_animation_->IsAnimationCompleteAtTime(monotonic_time)) { |
2469 page_scale_animation_.reset(); | 2469 page_scale_animation_.reset(); |
2470 client_->SetNeedsCommitOnImplThread(); | 2470 client_->SetNeedsCommitOnImplThread(); |
2471 client_->RenewTreePriority(); | 2471 client_->RenewTreePriority(); |
2472 } | 2472 } |
2473 } | 2473 } |
2474 | 2474 |
2475 void LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) { | 2475 void LayerTreeHostImpl::AnimateTopControls(gfx::FrameTime time) { |
2476 if (!top_controls_manager_ || !RootScrollLayer()) | 2476 if (!top_controls_manager_ || !RootScrollLayer()) |
2477 return; | 2477 return; |
2478 gfx::Vector2dF scroll = top_controls_manager_->Animate(time); | 2478 gfx::Vector2dF scroll = top_controls_manager_->Animate(time); |
2479 UpdateMaxScrollOffset(); | 2479 UpdateMaxScrollOffset(); |
2480 if (RootScrollLayer()->TotalScrollOffset().y() == 0.f) | 2480 if (RootScrollLayer()->TotalScrollOffset().y() == 0.f) |
2481 return; | 2481 return; |
2482 RootScrollLayer()->ScrollBy(gfx::ScaleVector2d( | 2482 RootScrollLayer()->ScrollBy(gfx::ScaleVector2d( |
2483 scroll, 1.f / active_tree_->total_page_scale_factor())); | 2483 scroll, 1.f / active_tree_->total_page_scale_factor())); |
2484 } | 2484 } |
2485 | 2485 |
2486 void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time, | 2486 void LayerTreeHostImpl::AnimateLayers(gfx::FrameTime monotonic_time, |
2487 base::Time wall_clock_time) { | 2487 base::Time wall_clock_time) { |
2488 if (!settings_.accelerated_animation_enabled || | 2488 if (!settings_.accelerated_animation_enabled || |
2489 animation_registrar_->active_animation_controllers().empty() || | 2489 animation_registrar_->active_animation_controllers().empty() || |
2490 !active_tree_->root_layer()) | 2490 !active_tree_->root_layer()) |
2491 return; | 2491 return; |
2492 | 2492 |
2493 TRACE_EVENT0("cc", "LayerTreeHostImpl::AnimateLayers"); | 2493 TRACE_EVENT0("cc", "LayerTreeHostImpl::AnimateLayers"); |
2494 | 2494 |
2495 last_animation_time_ = wall_clock_time; | 2495 last_animation_time_ = wall_clock_time; |
2496 double monotonic_seconds = (monotonic_time - base::TimeTicks()).InSecondsF(); | 2496 double monotonic_seconds = monotonic_time.Unsafe_InSecondsF(); |
2497 | 2497 |
2498 AnimationRegistrar::AnimationControllerMap copy = | 2498 AnimationRegistrar::AnimationControllerMap copy = |
2499 animation_registrar_->active_animation_controllers(); | 2499 animation_registrar_->active_animation_controllers(); |
2500 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); | 2500 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); |
2501 iter != copy.end(); | 2501 iter != copy.end(); |
2502 ++iter) | 2502 ++iter) |
2503 (*iter).second->Animate(monotonic_seconds); | 2503 (*iter).second->Animate(monotonic_seconds); |
2504 | 2504 |
2505 client_->SetNeedsRedrawOnImplThread(); | 2505 client_->SetNeedsRedrawOnImplThread(); |
2506 } | 2506 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2594 } | 2594 } |
2595 last_sent_memory_visible_bytes_ = memory_visible_bytes; | 2595 last_sent_memory_visible_bytes_ = memory_visible_bytes; |
2596 last_sent_memory_visible_and_nearby_bytes_ = memory_visible_and_nearby_bytes; | 2596 last_sent_memory_visible_and_nearby_bytes_ = memory_visible_and_nearby_bytes; |
2597 last_sent_memory_use_bytes_ = memory_use_bytes; | 2597 last_sent_memory_use_bytes_ = memory_use_bytes; |
2598 | 2598 |
2599 renderer_->SendManagedMemoryStats(last_sent_memory_visible_bytes_, | 2599 renderer_->SendManagedMemoryStats(last_sent_memory_visible_bytes_, |
2600 last_sent_memory_visible_and_nearby_bytes_, | 2600 last_sent_memory_visible_and_nearby_bytes_, |
2601 last_sent_memory_use_bytes_); | 2601 last_sent_memory_use_bytes_); |
2602 } | 2602 } |
2603 | 2603 |
2604 void LayerTreeHostImpl::AnimateScrollbars(base::TimeTicks time) { | 2604 void LayerTreeHostImpl::AnimateScrollbars(gfx::FrameTime time) { |
2605 AnimateScrollbarsRecursive(active_tree_->root_layer(), time); | 2605 AnimateScrollbarsRecursive(active_tree_->root_layer(), time); |
2606 } | 2606 } |
2607 | 2607 |
2608 void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer, | 2608 void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer, |
2609 base::TimeTicks time) { | 2609 gfx::FrameTime time) { |
2610 if (!layer) | 2610 if (!layer) |
2611 return; | 2611 return; |
2612 | 2612 |
2613 ScrollbarAnimationController* scrollbar_controller = | 2613 ScrollbarAnimationController* scrollbar_controller = |
2614 layer->scrollbar_animation_controller(); | 2614 layer->scrollbar_animation_controller(); |
2615 if (scrollbar_controller && scrollbar_controller->Animate(time)) { | 2615 if (scrollbar_controller && scrollbar_controller->Animate(time)) { |
2616 TRACE_EVENT_INSTANT0( | 2616 TRACE_EVENT_INSTANT0( |
2617 "cc", "LayerTreeHostImpl::SetNeedsRedraw due to AnimateScrollbars", | 2617 "cc", "LayerTreeHostImpl::SetNeedsRedraw due to AnimateScrollbars", |
2618 TRACE_EVENT_SCOPE_THREAD); | 2618 TRACE_EVENT_SCOPE_THREAD); |
2619 client_->SetNeedsRedrawOnImplThread(); | 2619 client_->SetNeedsRedrawOnImplThread(); |
2620 } | 2620 } |
2621 | 2621 |
2622 for (size_t i = 0; i < layer->children().size(); ++i) | 2622 for (size_t i = 0; i < layer->children().size(); ++i) |
2623 AnimateScrollbarsRecursive(layer->children()[i], time); | 2623 AnimateScrollbarsRecursive(layer->children()[i], time); |
2624 } | 2624 } |
2625 | 2625 |
2626 void LayerTreeHostImpl::StartScrollbarAnimation() { | 2626 void LayerTreeHostImpl::StartScrollbarAnimation() { |
2627 TRACE_EVENT0("cc", "LayerTreeHostImpl::StartScrollbarAnimation"); | 2627 TRACE_EVENT0("cc", "LayerTreeHostImpl::StartScrollbarAnimation"); |
2628 StartScrollbarAnimationRecursive(RootLayer(), CurrentPhysicalTimeTicks()); | 2628 StartScrollbarAnimationRecursive(RootLayer(), CurrentFrameTimeTicks()); |
2629 } | 2629 } |
2630 | 2630 |
2631 void LayerTreeHostImpl::StartScrollbarAnimationRecursive(LayerImpl* layer, | 2631 void LayerTreeHostImpl::StartScrollbarAnimationRecursive(LayerImpl* layer, |
2632 base::TimeTicks time) { | 2632 gfx::FrameTime time) { |
2633 if (!layer) | 2633 if (!layer) |
2634 return; | 2634 return; |
2635 | 2635 |
2636 ScrollbarAnimationController* scrollbar_controller = | 2636 ScrollbarAnimationController* scrollbar_controller = |
2637 layer->scrollbar_animation_controller(); | 2637 layer->scrollbar_animation_controller(); |
2638 if (scrollbar_controller && scrollbar_controller->IsAnimating()) { | 2638 if (scrollbar_controller && scrollbar_controller->IsAnimating()) { |
2639 base::TimeDelta delay = scrollbar_controller->DelayBeforeStart(time); | 2639 base::TimeDelta delay = scrollbar_controller->DelayBeforeStart(time); |
2640 if (delay > base::TimeDelta()) | 2640 if (delay > base::TimeDelta()) |
2641 client_->RequestScrollbarAnimationOnImplThread(delay); | 2641 client_->RequestScrollbarAnimationOnImplThread(delay); |
2642 else if (scrollbar_controller->Animate(time)) | 2642 else if (scrollbar_controller->Animate(time)) |
2643 client_->SetNeedsRedrawOnImplThread(); | 2643 client_->SetNeedsRedrawOnImplThread(); |
2644 } | 2644 } |
2645 | 2645 |
2646 for (size_t i = 0; i < layer->children().size(); ++i) | 2646 for (size_t i = 0; i < layer->children().size(); ++i) |
2647 StartScrollbarAnimationRecursive(layer->children()[i], time); | 2647 StartScrollbarAnimationRecursive(layer->children()[i], time); |
2648 } | 2648 } |
2649 | 2649 |
2650 void LayerTreeHostImpl::SetTreePriority(TreePriority priority) { | 2650 void LayerTreeHostImpl::SetTreePriority(TreePriority priority) { |
2651 if (!tile_manager_) | 2651 if (!tile_manager_) |
2652 return; | 2652 return; |
2653 | 2653 |
2654 if (global_tile_state_.tree_priority == priority) | 2654 if (global_tile_state_.tree_priority == priority) |
2655 return; | 2655 return; |
2656 global_tile_state_.tree_priority = priority; | 2656 global_tile_state_.tree_priority = priority; |
2657 DidModifyTilePriorities(); | 2657 DidModifyTilePriorities(); |
2658 } | 2658 } |
2659 | 2659 |
2660 void LayerTreeHostImpl::ResetCurrentFrameTimeForNextFrame() { | 2660 void LayerTreeHostImpl::ResetCurrentFrameTimeForNextFrame() { |
2661 current_frame_timeticks_ = base::TimeTicks(); | 2661 current_frame_timeticks_ = gfx::FrameTime(); |
2662 current_frame_time_ = base::Time(); | 2662 current_frame_time_ = base::Time(); |
2663 } | 2663 } |
2664 | 2664 |
2665 void LayerTreeHostImpl::UpdateCurrentFrameTime(base::TimeTicks* ticks, | 2665 void LayerTreeHostImpl::UpdateCurrentFrameTime(gfx::FrameTime* ticks, |
2666 base::Time* now) const { | 2666 base::Time* now) const { |
2667 if (ticks->is_null()) { | 2667 if (ticks->is_null()) { |
2668 DCHECK(now->is_null()); | 2668 DCHECK(now->is_null()); |
2669 *ticks = CurrentPhysicalTimeTicks(); | 2669 *ticks = gfx::FrameTime::Now(); |
2670 *now = base::Time::Now(); | 2670 *now = base::Time::Now(); |
2671 } | 2671 } |
2672 } | 2672 } |
2673 | 2673 |
2674 base::TimeTicks LayerTreeHostImpl::CurrentFrameTimeTicks() { | 2674 gfx::FrameTime LayerTreeHostImpl::CurrentFrameTimeTicks() { |
2675 UpdateCurrentFrameTime(¤t_frame_timeticks_, ¤t_frame_time_); | 2675 UpdateCurrentFrameTime(¤t_frame_timeticks_, ¤t_frame_time_); |
2676 return current_frame_timeticks_; | 2676 return current_frame_timeticks_; |
2677 } | 2677 } |
2678 | 2678 |
2679 base::Time LayerTreeHostImpl::CurrentFrameTime() { | 2679 base::Time LayerTreeHostImpl::CurrentFrameTime() { |
2680 UpdateCurrentFrameTime(¤t_frame_timeticks_, ¤t_frame_time_); | 2680 UpdateCurrentFrameTime(¤t_frame_timeticks_, ¤t_frame_time_); |
2681 return current_frame_time_; | 2681 return current_frame_time_; |
2682 } | 2682 } |
2683 | 2683 |
2684 base::TimeTicks LayerTreeHostImpl::CurrentPhysicalTimeTicks() const { | 2684 gfx::FrameTime LayerTreeHostImpl::CurrentPhysicalFrameTime() const { |
2685 return gfx::FrameTime::Now(); | 2685 return gfx::FrameTime::Now(); |
2686 } | 2686 } |
2687 | 2687 |
2688 scoped_ptr<base::Value> LayerTreeHostImpl::AsValueWithFrame( | 2688 scoped_ptr<base::Value> LayerTreeHostImpl::AsValueWithFrame( |
2689 FrameData* frame) const { | 2689 FrameData* frame) const { |
2690 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 2690 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
2691 if (this->pending_tree_) | 2691 if (this->pending_tree_) |
2692 state->Set("activation_state", ActivationStateAsValue().release()); | 2692 state->Set("activation_state", ActivationStateAsValue().release()); |
2693 state->Set("device_viewport_size", | 2693 state->Set("device_viewport_size", |
2694 MathUtil::AsValue(device_viewport_size_).release()); | 2694 MathUtil::AsValue(device_viewport_size_).release()); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2805 std::set<UIResourceId>::iterator found_in_evicted = | 2805 std::set<UIResourceId>::iterator found_in_evicted = |
2806 evicted_ui_resources_.find(uid); | 2806 evicted_ui_resources_.find(uid); |
2807 if (found_in_evicted == evicted_ui_resources_.end()) | 2807 if (found_in_evicted == evicted_ui_resources_.end()) |
2808 return; | 2808 return; |
2809 evicted_ui_resources_.erase(found_in_evicted); | 2809 evicted_ui_resources_.erase(found_in_evicted); |
2810 if (evicted_ui_resources_.empty()) | 2810 if (evicted_ui_resources_.empty()) |
2811 client_->OnCanDrawStateChanged(CanDraw()); | 2811 client_->OnCanDrawStateChanged(CanDraw()); |
2812 } | 2812 } |
2813 | 2813 |
2814 } // namespace cc | 2814 } // namespace cc |
OLD | NEW |