| 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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 if (needs_commit) | 1039 if (needs_commit) |
| 1040 client_->SetNeedsCommitOnImplThread(); | 1040 client_->SetNeedsCommitOnImplThread(); |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { | 1043 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { |
| 1044 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | 1044 client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase, | |
| 1048 base::TimeDelta interval) { | |
| 1049 client_->OnVSyncParametersChanged(timebase, interval); | |
| 1050 } | |
| 1051 | |
| 1052 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) { | 1047 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) { |
| 1053 client_->BeginFrameOnImplThread(frame_time); | 1048 client_->BeginFrameOnImplThread(frame_time); |
| 1054 } | 1049 } |
| 1055 | 1050 |
| 1056 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck( | 1051 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck( |
| 1057 const CompositorFrameAck& ack) { | 1052 const CompositorFrameAck& ack) { |
| 1058 if (!renderer_) | 1053 if (!renderer_) |
| 1059 return; | 1054 return; |
| 1060 | 1055 |
| 1061 // TODO(piman): We may need to do some validation on this ack before | 1056 // TODO(piman): We may need to do some validation on this ack before |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 settings_.num_raster_threads, | 1480 settings_.num_raster_threads, |
| 1486 settings_.use_color_estimator, | 1481 settings_.use_color_estimator, |
| 1487 rendering_stats_instrumentation_, | 1482 rendering_stats_instrumentation_, |
| 1488 using_map_image); | 1483 using_map_image); |
| 1489 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); | 1484 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); |
| 1490 } | 1485 } |
| 1491 | 1486 |
| 1492 resource_provider_ = resource_provider.Pass(); | 1487 resource_provider_ = resource_provider.Pass(); |
| 1493 } | 1488 } |
| 1494 | 1489 |
| 1490 // Setup BeginFrameEmulation if it's not supported natively |
| 1491 if (!settings_.begin_frame_scheduling_enabled) { |
| 1492 const base::TimeDelta display_refresh_interval = |
| 1493 base::TimeDelta::FromMicroseconds( |
| 1494 base::Time::kMicrosecondsPerSecond / |
| 1495 settings_.refresh_rate); |
| 1496 |
| 1497 output_surface->InitializeBeginFrameEmulation( |
| 1498 proxy_->ImplThread(), |
| 1499 settings_.throttle_frame_production, |
| 1500 display_refresh_interval, |
| 1501 GetRendererCapabilities().using_swap_complete_callback || true); |
| 1502 } |
| 1503 |
| 1504 int max_frames_pending = |
| 1505 output_surface->capabilities().max_frames_pending; |
| 1506 if (max_frames_pending <= 0) |
| 1507 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; |
| 1508 if (output_surface->capabilities().has_parent_compositor) |
| 1509 max_frames_pending = 1; |
| 1510 output_surface->SetMaxFramesPending(max_frames_pending); |
| 1511 |
| 1495 output_surface_ = output_surface.Pass(); | 1512 output_surface_ = output_surface.Pass(); |
| 1496 | 1513 |
| 1497 if (!visible_) | 1514 if (!visible_) |
| 1498 renderer_->SetVisible(visible_); | 1515 renderer_->SetVisible(visible_); |
| 1499 | 1516 |
| 1500 client_->OnCanDrawStateChanged(CanDraw()); | 1517 client_->OnCanDrawStateChanged(CanDraw()); |
| 1501 | 1518 |
| 1502 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs | 1519 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs |
| 1503 // to be initialized to get max texture size. | 1520 // to be initialized to get max texture size. |
| 1504 active_tree_->set_needs_update_draw_properties(); | 1521 active_tree_->set_needs_update_draw_properties(); |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2267 } | 2284 } |
| 2268 | 2285 |
| 2269 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2286 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
| 2270 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2287 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
| 2271 paint_time_counter_->ClearHistory(); | 2288 paint_time_counter_->ClearHistory(); |
| 2272 | 2289 |
| 2273 debug_state_ = debug_state; | 2290 debug_state_ = debug_state; |
| 2274 } | 2291 } |
| 2275 | 2292 |
| 2276 } // namespace cc | 2293 } // namespace cc |
| OLD | NEW |