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

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: Fix PRId64 for Windows 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 const gfx::Transform& transform, 1050 const gfx::Transform& transform,
1051 gfx::Rect viewport) { 1051 gfx::Rect viewport) {
1052 external_transform_ = transform; 1052 external_transform_ = transform;
1053 external_viewport_ = viewport; 1053 external_viewport_ = viewport;
1054 } 1054 }
1055 1055
1056 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { 1056 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) {
1057 client_->SetNeedsRedrawRectOnImplThread(damage_rect); 1057 client_->SetNeedsRedrawRectOnImplThread(damage_rect);
1058 } 1058 }
1059 1059
1060 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase,
1061 base::TimeDelta interval) {
1062 client_->OnVSyncParametersChanged(timebase, interval);
1063 }
1064
1065 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) { 1060 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) {
1066 client_->BeginFrameOnImplThread(frame_time); 1061 client_->BeginFrameOnImplThread(frame_time);
1067 } 1062 }
1068 1063
1069 void LayerTreeHostImpl::OnSwapBuffersComplete( 1064 void LayerTreeHostImpl::OnSwapBuffersComplete(
1070 const CompositorFrameAck* ack) { 1065 const CompositorFrameAck* ack) {
1071 // TODO(piman): We may need to do some validation on this ack before 1066 // TODO(piman): We may need to do some validation on this ack before
1072 // processing it. 1067 // processing it.
1073 if (ack && renderer_) 1068 if (ack && renderer_)
1074 renderer_->ReceiveSwapBuffersAck(*ack); 1069 renderer_->ReceiveSwapBuffersAck(*ack);
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 settings_.num_raster_threads, 1493 settings_.num_raster_threads,
1499 settings_.use_color_estimator, 1494 settings_.use_color_estimator,
1500 rendering_stats_instrumentation_, 1495 rendering_stats_instrumentation_,
1501 using_map_image); 1496 using_map_image);
1502 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); 1497 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy());
1503 } 1498 }
1504 1499
1505 resource_provider_ = resource_provider.Pass(); 1500 resource_provider_ = resource_provider.Pass();
1506 } 1501 }
1507 1502
1503 // Setup BeginFrameEmulation if it's not supported natively
1504 if (!settings_.begin_frame_scheduling_enabled) {
1505 const base::TimeDelta display_refresh_interval =
1506 base::TimeDelta::FromMicroseconds(
1507 base::Time::kMicrosecondsPerSecond /
1508 settings_.refresh_rate);
1509
1510 output_surface->InitializeBeginFrameEmulation(
1511 proxy_->ImplThread(),
1512 settings_.throttle_frame_production,
1513 display_refresh_interval);
1514 }
1515
1516 int max_frames_pending =
1517 output_surface->capabilities().max_frames_pending;
1518 if (max_frames_pending <= 0)
1519 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING;
1520 output_surface->SetMaxFramesPending(max_frames_pending);
1521
1508 output_surface_ = output_surface.Pass(); 1522 output_surface_ = output_surface.Pass();
1509 1523
1510 if (!visible_) 1524 if (!visible_)
1511 renderer_->SetVisible(visible_); 1525 renderer_->SetVisible(visible_);
1512 1526
1513 client_->OnCanDrawStateChanged(CanDraw()); 1527 client_->OnCanDrawStateChanged(CanDraw());
1514 1528
1515 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs 1529 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs
1516 // to be initialized to get max texture size. 1530 // to be initialized to get max texture size.
1517 active_tree_->set_needs_update_draw_properties(); 1531 active_tree_->set_needs_update_draw_properties();
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
2308 } 2322 }
2309 2323
2310 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { 2324 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) {
2311 if (debug_state_.continuous_painting != debug_state.continuous_painting) 2325 if (debug_state_.continuous_painting != debug_state.continuous_painting)
2312 paint_time_counter_->ClearHistory(); 2326 paint_time_counter_->ClearHistory();
2313 2327
2314 debug_state_ = debug_state; 2328 debug_state_ = debug_state;
2315 } 2329 }
2316 2330
2317 } // namespace cc 2331 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698