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

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: Sami's comments 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 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 if (!content_view_core_) 1025 if (!content_view_core_)
1026 return; 1026 return;
1027 if (!layer_.get()) 1027 if (!layer_.get())
1028 return; 1028 return;
1029 1029
1030 content_view_core_->RemoveLayer(layer_); 1030 content_view_core_->RemoveLayer(layer_);
1031 overscroll_effect_->Disable(); 1031 overscroll_effect_->Disable();
1032 } 1032 }
1033 1033
1034 void RenderWidgetHostViewAndroid::SetNeedsAnimate() { 1034 void RenderWidgetHostViewAndroid::SetNeedsAnimate() {
1035 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); 1035 content_view_core_->GetWindowAndroid()->SetNeedsAnimate();
1036 } 1036 }
1037 1037
1038 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { 1038 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) {
1039 return overscroll_effect_->Animate(frame_time); 1039 return overscroll_effect_->Animate(frame_time);
1040 } 1040 }
1041 1041
1042 void RenderWidgetHostViewAndroid::AcceleratedSurfacePostSubBuffer( 1042 void RenderWidgetHostViewAndroid::AcceleratedSurfacePostSubBuffer(
1043 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, 1043 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
1044 int gpu_host_id) { 1044 int gpu_host_id) {
1045 NOTREACHED(); 1045 NOTREACHED();
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 base::TimeDelta estimated_browser_composite_time = 1329 base::TimeDelta estimated_browser_composite_time =
1330 base::TimeDelta::FromMicroseconds( 1330 base::TimeDelta::FromMicroseconds(
1331 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60)); 1331 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60));
1332 1332
1333 base::TimeTicks deadline = display_time - estimated_browser_composite_time; 1333 base::TimeTicks deadline = display_time - estimated_browser_composite_time;
1334 1334
1335 host_->Send(new ViewMsg_BeginFrame( 1335 host_->Send(new ViewMsg_BeginFrame(
1336 host_->GetRoutingID(), 1336 host_->GetRoutingID(),
1337 cc::BeginFrameArgs::Create(frame_time, deadline, vsync_period))); 1337 cc::BeginFrameArgs::Create(frame_time, deadline, vsync_period)));
1338 1338
1339 // TODO(sievers): This should use the LayerTreeHostClient callback 1339 if (needs_begin_frame_)
1340 bool needs_animate = Animate(frame_time);
1341 if (needs_begin_frame_ || needs_animate)
1342 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); 1340 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate();
1343 } 1341 }
1344 1342
1343 void RenderWidgetHostViewAndroid::OnAnimate(base::TimeTicks begin_frame_time) {
1344 if (Animate(begin_frame_time))
1345 SetNeedsAnimate();
1346 }
1347
1345 void RenderWidgetHostViewAndroid::OnLostResources() { 1348 void RenderWidgetHostViewAndroid::OnLostResources() {
1346 ReleaseLocksOnSurface(); 1349 ReleaseLocksOnSurface();
1347 if (layer_.get()) 1350 if (layer_.get())
1348 DestroyDelegatedContent(); 1351 DestroyDelegatedContent();
1349 DCHECK(ack_callbacks_.empty()); 1352 DCHECK(ack_callbacks_.empty());
1350 } 1353 }
1351 1354
1352 // static 1355 // static
1353 void 1356 void
1354 RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResultForDelegatedReadback( 1357 RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResultForDelegatedReadback(
(...skipping 97 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