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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 285373008: Android: Decouple animate from vsync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "base/android/sys_utils.h" 9 #include "base/android/sys_utils.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 if (!content_view_core_) 1045 if (!content_view_core_)
1046 return; 1046 return;
1047 if (!layer_.get()) 1047 if (!layer_.get())
1048 return; 1048 return;
1049 1049
1050 content_view_core_->RemoveLayer(layer_); 1050 content_view_core_->RemoveLayer(layer_);
1051 overscroll_effect_->Disable(); 1051 overscroll_effect_->Disable();
1052 } 1052 }
1053 1053
1054 void RenderWidgetHostViewAndroid::SetNeedsAnimate() { 1054 void RenderWidgetHostViewAndroid::SetNeedsAnimate() {
1055 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); 1055 content_view_core_->GetWindowAndroid()->SetNeedsAnimate();
1056 } 1056 }
1057 1057
1058 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { 1058 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) {
1059 return overscroll_effect_->Animate(frame_time); 1059 return overscroll_effect_->Animate(frame_time);
1060 } 1060 }
1061 1061
1062 void RenderWidgetHostViewAndroid::AcceleratedSurfacePostSubBuffer( 1062 void RenderWidgetHostViewAndroid::AcceleratedSurfacePostSubBuffer(
1063 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, 1063 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
1064 int gpu_host_id) { 1064 int gpu_host_id) {
1065 NOTREACHED(); 1065 NOTREACHED();
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 base::TimeDelta estimated_browser_composite_time = 1330 base::TimeDelta estimated_browser_composite_time =
1331 base::TimeDelta::FromMicroseconds( 1331 base::TimeDelta::FromMicroseconds(
1332 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60)); 1332 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60));
1333 1333
1334 base::TimeTicks deadline = display_time - estimated_browser_composite_time; 1334 base::TimeTicks deadline = display_time - estimated_browser_composite_time;
1335 1335
1336 host_->Send(new ViewMsg_BeginFrame( 1336 host_->Send(new ViewMsg_BeginFrame(
1337 host_->GetRoutingID(), 1337 host_->GetRoutingID(),
1338 cc::BeginFrameArgs::Create(frame_time, deadline, vsync_period))); 1338 cc::BeginFrameArgs::Create(frame_time, deadline, vsync_period)));
1339 1339
1340 // TODO(sievers): This should use the LayerTreeHostClient callback 1340 if (needs_begin_frame_)
1341 bool needs_animate = Animate(frame_time);
1342 if (needs_begin_frame_ || needs_animate)
1343 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); 1341 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate();
1344 } 1342 }
1345 1343
1344 void RenderWidgetHostViewAndroid::OnAnimate(base::TimeTicks frame_begin_time) {
1345 if (Animate(frame_begin_time))
1346 SetNeedsAnimate();
1347 }
1348
1346 void RenderWidgetHostViewAndroid::OnLostResources() { 1349 void RenderWidgetHostViewAndroid::OnLostResources() {
1347 ReleaseLocksOnSurface(); 1350 ReleaseLocksOnSurface();
1348 if (layer_.get()) 1351 if (layer_.get())
1349 DestroyDelegatedContent(); 1352 DestroyDelegatedContent();
1350 DCHECK(ack_callbacks_.empty()); 1353 DCHECK(ack_callbacks_.empty());
1351 } 1354 }
1352 1355
1353 // static 1356 // static
1354 void 1357 void
1355 RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResultForDelegatedReadback( 1358 RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResultForDelegatedReadback(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 results->availableRect = display.work_area(); 1455 results->availableRect = display.work_area();
1453 results->deviceScaleFactor = display.device_scale_factor(); 1456 results->deviceScaleFactor = display.device_scale_factor();
1454 results->orientationAngle = display.RotationAsDegree(); 1457 results->orientationAngle = display.RotationAsDegree();
1455 gfx::DeviceDisplayInfo info; 1458 gfx::DeviceDisplayInfo info;
1456 results->depth = info.GetBitsPerPixel(); 1459 results->depth = info.GetBitsPerPixel();
1457 results->depthPerComponent = info.GetBitsPerComponent(); 1460 results->depthPerComponent = info.GetBitsPerComponent();
1458 results->isMonochrome = (results->depthPerComponent == 0); 1461 results->isMonochrome = (results->depthPerComponent == 0);
1459 } 1462 }
1460 1463
1461 } // namespace content 1464 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698