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

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

Issue 16833003: cc: Emulate BeginFrame in OutputSurfaces that don't support it natively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
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
« 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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 const gfx::Transform& transform, 1064 const gfx::Transform& transform,
1065 gfx::Rect viewport) { 1065 gfx::Rect viewport) {
1066 external_transform_ = transform; 1066 external_transform_ = transform;
1067 external_viewport_ = viewport; 1067 external_viewport_ = viewport;
1068 } 1068 }
1069 1069
1070 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { 1070 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) {
1071 client_->SetNeedsRedrawRectOnImplThread(damage_rect); 1071 client_->SetNeedsRedrawRectOnImplThread(damage_rect);
1072 } 1072 }
1073 1073
1074 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase,
1075 base::TimeDelta interval) {
1076 client_->OnVSyncParametersChanged(timebase, interval);
1077 }
1078
1079 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) { 1074 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) {
1080 client_->BeginFrameOnImplThread(frame_time); 1075 client_->BeginFrameOnImplThread(frame_time);
1081 } 1076 }
1082 1077
1083 void LayerTreeHostImpl::OnSwapBuffersComplete( 1078 void LayerTreeHostImpl::OnSwapBuffersComplete(
1084 const CompositorFrameAck* ack) { 1079 const CompositorFrameAck* ack) {
1085 // TODO(piman): We may need to do some validation on this ack before 1080 // TODO(piman): We may need to do some validation on this ack before
1086 // processing it. 1081 // processing it.
1087 if (ack && renderer_) 1082 if (ack && renderer_)
1088 renderer_->ReceiveSwapBuffersAck(*ack); 1083 renderer_->ReceiveSwapBuffersAck(*ack);
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 settings_.num_raster_threads, 1502 settings_.num_raster_threads,
1508 settings_.use_color_estimator, 1503 settings_.use_color_estimator,
1509 rendering_stats_instrumentation_, 1504 rendering_stats_instrumentation_,
1510 using_map_image); 1505 using_map_image);
1511 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); 1506 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy());
1512 } 1507 }
1513 1508
1514 resource_provider_ = resource_provider.Pass(); 1509 resource_provider_ = resource_provider.Pass();
1515 } 1510 }
1516 1511
1512 // Setup BeginFrameEmulation if it's not supported natively
1513 if (!settings_.begin_frame_scheduling_enabled) {
1514 const base::TimeDelta display_refresh_interval =
1515 base::TimeDelta::FromMicroseconds(
1516 base::Time::kMicrosecondsPerSecond /
1517 settings_.refresh_rate);
1518
1519 output_surface->InitializeBeginFrameEmulation(
1520 proxy_->ImplThread(),
1521 settings_.throttle_frame_production,
1522 display_refresh_interval);
1523 }
1524
1525 int max_frames_pending =
1526 output_surface->capabilities().max_frames_pending;
1527 if (max_frames_pending <= 0)
1528 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING;
1529 output_surface->SetMaxFramesPending(max_frames_pending);
1530
1517 output_surface_ = output_surface.Pass(); 1531 output_surface_ = output_surface.Pass();
1518 1532
1519 if (!visible_) 1533 if (!visible_)
1520 renderer_->SetVisible(visible_); 1534 renderer_->SetVisible(visible_);
1521 1535
1522 client_->OnCanDrawStateChanged(CanDraw()); 1536 client_->OnCanDrawStateChanged(CanDraw());
1523 1537
1524 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs 1538 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs
1525 // to be initialized to get max texture size. 1539 // to be initialized to get max texture size.
1526 active_tree_->set_needs_update_draw_properties(); 1540 active_tree_->set_needs_update_draw_properties();
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
2317 } 2331 }
2318 2332
2319 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { 2333 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) {
2320 if (debug_state_.continuous_painting != debug_state.continuous_painting) 2334 if (debug_state_.continuous_painting != debug_state.continuous_painting)
2321 paint_time_counter_->ClearHistory(); 2335 paint_time_counter_->ClearHistory();
2322 2336
2323 debug_state_ = debug_state; 2337 debug_state_ = debug_state;
2324 } 2338 }
2325 2339
2326 } // namespace cc 2340 } // 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