Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 15836005: cc: Emulate BeginFrame in OutputSurfaces that don't support it natively (Closed) Base URL: http://git.chromium.org/chromium/src.git@nofrc
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 } 1031 }
1032 1032
1033 if (needs_commit) 1033 if (needs_commit)
1034 client_->SetNeedsCommitOnImplThread(); 1034 client_->SetNeedsCommitOnImplThread();
1035 } 1035 }
1036 1036
1037 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { 1037 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) {
1038 client_->SetNeedsRedrawRectOnImplThread(damage_rect); 1038 client_->SetNeedsRedrawRectOnImplThread(damage_rect);
1039 } 1039 }
1040 1040
1041 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase,
1042 base::TimeDelta interval) {
1043 client_->OnVSyncParametersChanged(timebase, interval);
1044 }
1045
1046 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) { 1041 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) {
1047 client_->BeginFrameOnImplThread(frame_time); 1042 client_->BeginFrameOnImplThread(frame_time);
1048 } 1043 }
1049 1044
1050 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck( 1045 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck(
1051 const CompositorFrameAck& ack) { 1046 const CompositorFrameAck& ack) {
1052 if (!renderer_) 1047 if (!renderer_)
1053 return; 1048 return;
1054 1049
1055 // TODO(piman): We may need to do some validation on this ack before 1050 // 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
1460 settings_.num_raster_threads, 1455 settings_.num_raster_threads,
1461 settings_.use_color_estimator, 1456 settings_.use_color_estimator,
1462 rendering_stats_instrumentation_, 1457 rendering_stats_instrumentation_,
1463 using_map_image); 1458 using_map_image);
1464 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); 1459 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy());
1465 } 1460 }
1466 1461
1467 resource_provider_ = resource_provider.Pass(); 1462 resource_provider_ = resource_provider.Pass();
1468 } 1463 }
1469 1464
1465 // Setup BeginFrameEmulation if it's not supported natively
1466 if (!settings_.begin_frame_scheduling_enabled) {
1467 const base::TimeDelta display_refresh_interval =
1468 base::TimeDelta::FromMicroseconds(
1469 base::Time::kMicrosecondsPerSecond /
1470 settings_.refresh_rate);
1471
1472 int max_frames_pending =
1473 output_surface->capabilities().max_frames_pending;
1474 if (max_frames_pending <= 0)
1475 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING;
1476 if (output_surface->capabilities().has_parent_compositor)
1477 max_frames_pending = 1;
1478
1479 output_surface->InitializeBeginFrameEmulation(
1480 proxy_->ImplThread(),
1481 settings_.throttle_frame_production,
1482 display_refresh_interval,
1483 max_frames_pending,
1484 GetRendererCapabilities().using_swap_complete_callback);
1485 }
1486
1470 output_surface_ = output_surface.Pass(); 1487 output_surface_ = output_surface.Pass();
1471 1488
1472 if (!visible_) 1489 if (!visible_)
1473 renderer_->SetVisible(visible_); 1490 renderer_->SetVisible(visible_);
1474 1491
1475 client_->OnCanDrawStateChanged(CanDraw()); 1492 client_->OnCanDrawStateChanged(CanDraw());
1476 1493
1477 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs 1494 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs
1478 // to be initialized to get max texture size. 1495 // to be initialized to get max texture size.
1479 active_tree_->set_needs_update_draw_properties(); 1496 active_tree_->set_needs_update_draw_properties();
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 } 2259 }
2243 2260
2244 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { 2261 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) {
2245 if (debug_state_.continuous_painting != debug_state.continuous_painting) 2262 if (debug_state_.continuous_painting != debug_state.continuous_painting)
2246 paint_time_counter_->ClearHistory(); 2263 paint_time_counter_->ClearHistory();
2247 2264
2248 debug_state_ = debug_state; 2265 debug_state_ = debug_state;
2249 } 2266 }
2250 2267
2251 } // namespace cc 2268 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698