| 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 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 } | 1042 } |
| 1043 | 1043 |
| 1044 if (needs_commit) | 1044 if (needs_commit) |
| 1045 client_->SetNeedsCommitOnImplThread(); | 1045 client_->SetNeedsCommitOnImplThread(); |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { | 1048 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { |
| 1049 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | 1049 client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
| 1050 } | 1050 } |
| 1051 | 1051 |
| 1052 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase, | |
| 1053 base::TimeDelta interval) { | |
| 1054 client_->OnVSyncParametersChanged(timebase, interval); | |
| 1055 } | |
| 1056 | |
| 1057 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) { | 1052 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) { |
| 1058 client_->BeginFrameOnImplThread(frame_time); | 1053 client_->BeginFrameOnImplThread(frame_time); |
| 1059 } | 1054 } |
| 1060 | 1055 |
| 1061 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck( | 1056 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck( |
| 1062 const CompositorFrameAck& ack) { | 1057 const CompositorFrameAck& ack) { |
| 1063 if (!renderer_) | 1058 if (!renderer_) |
| 1064 return; | 1059 return; |
| 1065 | 1060 |
| 1066 // TODO(piman): We may need to do some validation on this ack before | 1061 // TODO(piman): We may need to do some validation on this ack before |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 settings_.num_raster_threads, | 1466 settings_.num_raster_threads, |
| 1472 settings_.use_color_estimator, | 1467 settings_.use_color_estimator, |
| 1473 rendering_stats_instrumentation_, | 1468 rendering_stats_instrumentation_, |
| 1474 using_map_image); | 1469 using_map_image); |
| 1475 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); | 1470 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); |
| 1476 } | 1471 } |
| 1477 | 1472 |
| 1478 resource_provider_ = resource_provider.Pass(); | 1473 resource_provider_ = resource_provider.Pass(); |
| 1479 } | 1474 } |
| 1480 | 1475 |
| 1476 // Setup BeginFrameEmulation if it's not supported natively |
| 1477 if (!settings_.begin_frame_scheduling_enabled) { |
| 1478 const base::TimeDelta display_refresh_interval = |
| 1479 base::TimeDelta::FromMicroseconds( |
| 1480 base::Time::kMicrosecondsPerSecond / |
| 1481 settings_.refresh_rate); |
| 1482 |
| 1483 int max_frames_pending = |
| 1484 output_surface->capabilities().max_frames_pending; |
| 1485 if (max_frames_pending <= 0) |
| 1486 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; |
| 1487 if (output_surface->capabilities().has_parent_compositor) |
| 1488 max_frames_pending = 1; |
| 1489 |
| 1490 output_surface->InitializeBeginFrameEmulation( |
| 1491 proxy_->ImplThread(), |
| 1492 settings_.throttle_frame_production, |
| 1493 display_refresh_interval, |
| 1494 max_frames_pending, |
| 1495 GetRendererCapabilities().using_swap_complete_callback); |
| 1496 } |
| 1497 |
| 1481 output_surface_ = output_surface.Pass(); | 1498 output_surface_ = output_surface.Pass(); |
| 1482 | 1499 |
| 1483 if (!visible_) | 1500 if (!visible_) |
| 1484 renderer_->SetVisible(visible_); | 1501 renderer_->SetVisible(visible_); |
| 1485 | 1502 |
| 1486 client_->OnCanDrawStateChanged(CanDraw()); | 1503 client_->OnCanDrawStateChanged(CanDraw()); |
| 1487 | 1504 |
| 1488 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs | 1505 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs |
| 1489 // to be initialized to get max texture size. | 1506 // to be initialized to get max texture size. |
| 1490 active_tree_->set_needs_update_draw_properties(); | 1507 active_tree_->set_needs_update_draw_properties(); |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2253 } | 2270 } |
| 2254 | 2271 |
| 2255 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2272 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
| 2256 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2273 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
| 2257 paint_time_counter_->ClearHistory(); | 2274 paint_time_counter_->ClearHistory(); |
| 2258 | 2275 |
| 2259 debug_state_ = debug_state; | 2276 debug_state_ = debug_state; |
| 2260 } | 2277 } |
| 2261 | 2278 |
| 2262 } // namespace cc | 2279 } // namespace cc |
| OLD | NEW |