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

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

Issue 457913002: Android WebView: flush input events during onVSync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fixups Created 6 years, 4 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 (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/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 uint32 output_id, 176 uint32 output_id,
177 scoped_ptr<cc::CompositorFrame> output_frame) 177 scoped_ptr<cc::CompositorFrame> output_frame)
178 : output_surface_id(output_id), frame(output_frame.Pass()) {} 178 : output_surface_id(output_id), frame(output_frame.Pass()) {}
179 179
180 RenderWidgetHostViewAndroid::LastFrameInfo::~LastFrameInfo() {} 180 RenderWidgetHostViewAndroid::LastFrameInfo::~LastFrameInfo() {}
181 181
182 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( 182 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
183 RenderWidgetHostImpl* widget_host, 183 RenderWidgetHostImpl* widget_host,
184 ContentViewCoreImpl* content_view_core) 184 ContentViewCoreImpl* content_view_core)
185 : host_(widget_host), 185 : host_(widget_host),
186 needs_begin_frame_(false),
187 is_showing_(!widget_host->is_hidden()), 186 is_showing_(!widget_host->is_hidden()),
188 content_view_core_(NULL), 187 content_view_core_(NULL),
189 ime_adapter_android_(this), 188 ime_adapter_android_(this),
190 cached_background_color_(SK_ColorWHITE), 189 cached_background_color_(SK_ColorWHITE),
191 last_output_surface_id_(kUndefinedOutputSurfaceId), 190 last_output_surface_id_(kUndefinedOutputSurfaceId),
192 weak_ptr_factory_(this), 191 weak_ptr_factory_(this),
193 overscroll_effect_enabled_(!CommandLine::ForCurrentProcess()->HasSwitch( 192 overscroll_effect_enabled_(!CommandLine::ForCurrentProcess()->HasSwitch(
194 switches::kDisableOverscrollEdgeEffect)), 193 switches::kDisableOverscrollEdgeEffect)),
195 gesture_provider_(CreateGestureProviderConfig(), this), 194 gesture_provider_(CreateGestureProviderConfig(), this),
196 gesture_text_selector_(this), 195 gesture_text_selector_(this),
197 touch_scrolling_(false), 196 touch_scrolling_(false),
198 potentially_active_fling_count_(0), 197 potentially_active_fling_count_(0),
199 flush_input_requested_(false),
200 accelerated_surface_route_id_(0), 198 accelerated_surface_route_id_(0),
201 using_synchronous_compositor_(SynchronousCompositorImpl::FromID( 199 using_synchronous_compositor_(SynchronousCompositorImpl::FromID(
202 widget_host->GetProcess()->GetID(), 200 widget_host->GetProcess()->GetID(),
203 widget_host->GetRoutingID()) != NULL), 201 widget_host->GetRoutingID()) != NULL),
202 vsync_subscribers_bitmask_(0),
204 frame_evictor_(new DelegatedFrameEvictor(this)), 203 frame_evictor_(new DelegatedFrameEvictor(this)),
205 locks_on_frame_count_(0), 204 locks_on_frame_count_(0) {
206 observing_root_window_(false) {
207 host_->SetView(this); 205 host_->SetView(this);
208 SetContentViewCore(content_view_core); 206 SetContentViewCore(content_view_core);
209 ImageTransportFactoryAndroid::AddObserver(this); 207 ImageTransportFactoryAndroid::AddObserver(this);
210 } 208 }
211 209
212 RenderWidgetHostViewAndroid::~RenderWidgetHostViewAndroid() { 210 RenderWidgetHostViewAndroid::~RenderWidgetHostViewAndroid() {
213 ImageTransportFactoryAndroid::RemoveObserver(this); 211 ImageTransportFactoryAndroid::RemoveObserver(this);
214 SetContentViewCore(NULL); 212 SetContentViewCore(NULL);
215 DCHECK(ack_callbacks_.empty()); 213 DCHECK(ack_callbacks_.empty());
216 if (resource_collection_.get()) 214 if (resource_collection_.get())
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const { 250 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const {
253 return host_; 251 return host_;
254 } 252 }
255 253
256 void RenderWidgetHostViewAndroid::WasShown() { 254 void RenderWidgetHostViewAndroid::WasShown() {
257 if (!host_ || !host_->is_hidden()) 255 if (!host_ || !host_->is_hidden())
258 return; 256 return;
259 257
260 host_->WasShown(ui::LatencyInfo()); 258 host_->WasShown(ui::LatencyInfo());
261 259
262 if (content_view_core_ && !using_synchronous_compositor_) { 260 if (content_view_core_ && !using_synchronous_compositor_)
263 content_view_core_->GetWindowAndroid()->AddObserver(this); 261 SubscribeToVSync(INPUT | BEGIN_FRAME);
264 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate();
265 observing_root_window_ = true;
266 }
267 } 262 }
268 263
269 void RenderWidgetHostViewAndroid::WasHidden() { 264 void RenderWidgetHostViewAndroid::WasHidden() {
270 RunAckCallbacks(); 265 RunAckCallbacks();
271 266
272 if (!host_ || host_->is_hidden()) 267 if (!host_ || host_->is_hidden())
273 return; 268 return;
274 269
275 // Inform the renderer that we are being hidden so it can reduce its resource 270 // Inform the renderer that we are being hidden so it can reduce its resource
276 // utilization. 271 // utilization.
277 host_->WasHidden(); 272 host_->WasHidden();
278 273
279 if (content_view_core_ && !using_synchronous_compositor_) { 274 if (content_view_core_ && !using_synchronous_compositor_)
280 content_view_core_->GetWindowAndroid()->RemoveObserver(this); 275 UnsubscribeToVSync(INPUT | BEGIN_FRAME);
281 observing_root_window_ = false;
282 }
283 } 276 }
284 277
285 void RenderWidgetHostViewAndroid::WasResized() { 278 void RenderWidgetHostViewAndroid::WasResized() {
286 host_->WasResized(); 279 host_->WasResized();
287 } 280 }
288 281
289 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { 282 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) {
290 // Ignore the given size as only the Java code has the power to 283 // Ignore the given size as only the Java code has the power to
291 // resize the view on Android. 284 // resize the view on Android.
292 default_size_ = size; 285 default_size_ = size;
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 SkColor color) { 537 SkColor color) {
545 if (cached_background_color_ == color) 538 if (cached_background_color_ == color)
546 return; 539 return;
547 540
548 cached_background_color_ = color; 541 cached_background_color_ = color;
549 if (content_view_core_) 542 if (content_view_core_)
550 content_view_core_->OnBackgroundColorChanged(color); 543 content_view_core_->OnBackgroundColorChanged(color);
551 } 544 }
552 545
553 void RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame(bool enabled) { 546 void RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame(bool enabled) {
554 if (enabled == needs_begin_frame_) 547 if (enabled == IsSubscribedToType(BEGIN_FRAME) || !content_view_core_)
boliu 2014/08/20 20:30:00 No need to check for !content_view_core_ here.
555 return; 548 return;
556 549
557 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame", 550 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame",
558 "enabled", enabled); 551 "enabled", enabled);
559 if (content_view_core_ && enabled) 552 if (enabled)
560 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); 553 SubscribeToVSync(BEGIN_FRAME);
561 554 else
562 needs_begin_frame_ = enabled; 555 UnsubscribeToVSync(BEGIN_FRAME);
563 } 556 }
564 557
565 void RenderWidgetHostViewAndroid::OnStartContentIntent( 558 void RenderWidgetHostViewAndroid::OnStartContentIntent(
566 const GURL& content_url) { 559 const GURL& content_url) {
567 if (content_view_core_) 560 if (content_view_core_)
568 content_view_core_->StartContentIntent(content_url); 561 content_view_core_->StartContentIntent(content_url);
569 } 562 }
570 563
571 void RenderWidgetHostViewAndroid::OnSmartClipDataExtracted( 564 void RenderWidgetHostViewAndroid::OnSmartClipDataExtracted(
572 const base::string16& text, 565 const base::string16& text,
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 void RenderWidgetHostViewAndroid::ShowDisambiguationPopup( 797 void RenderWidgetHostViewAndroid::ShowDisambiguationPopup(
805 const gfx::Rect& target_rect, const SkBitmap& zoomed_bitmap) { 798 const gfx::Rect& target_rect, const SkBitmap& zoomed_bitmap) {
806 if (!content_view_core_) 799 if (!content_view_core_)
807 return; 800 return;
808 801
809 content_view_core_->ShowDisambiguationPopup(target_rect, zoomed_bitmap); 802 content_view_core_->ShowDisambiguationPopup(target_rect, zoomed_bitmap);
810 } 803 }
811 804
812 scoped_ptr<SyntheticGestureTarget> 805 scoped_ptr<SyntheticGestureTarget>
813 RenderWidgetHostViewAndroid::CreateSyntheticGestureTarget() { 806 RenderWidgetHostViewAndroid::CreateSyntheticGestureTarget() {
807 DCHECK(content_view_core_);
808 if (using_synchronous_compositor_)
809 SubscribeToVSync(INPUT);
810
814 return scoped_ptr<SyntheticGestureTarget>(new SyntheticGestureTargetAndroid( 811 return scoped_ptr<SyntheticGestureTarget>(new SyntheticGestureTargetAndroid(
815 host_, content_view_core_->CreateTouchEventSynthesizer())); 812 host_, content_view_core_->CreateTouchEventSynthesizer()));
816 } 813 }
817 814
818 void RenderWidgetHostViewAndroid::SendDelegatedFrameAck( 815 void RenderWidgetHostViewAndroid::SendDelegatedFrameAck(
819 uint32 output_surface_id) { 816 uint32 output_surface_id) {
820 DCHECK(host_); 817 DCHECK(host_);
821 cc::CompositorFrameAck ack; 818 cc::CompositorFrameAck ack;
822 if (resource_collection_.get()) 819 if (resource_collection_.get())
823 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources); 820 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources);
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 1290
1294 SynchronousCompositorImpl* compositor = 1291 SynchronousCompositorImpl* compositor =
1295 SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(), 1292 SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(),
1296 host_->GetRoutingID()); 1293 host_->GetRoutingID());
1297 if (compositor) 1294 if (compositor)
1298 return compositor->HandleInputEvent(input_event); 1295 return compositor->HandleInputEvent(input_event);
1299 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 1296 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
1300 } 1297 }
1301 1298
1302 void RenderWidgetHostViewAndroid::OnSetNeedsFlushInput() { 1299 void RenderWidgetHostViewAndroid::OnSetNeedsFlushInput() {
1303 if (flush_input_requested_ || !content_view_core_) 1300 if ((IsSubscribedToType(INPUT)) || !content_view_core_)
1304 return; 1301 return;
1302
1305 TRACE_EVENT0("input", "RenderWidgetHostViewAndroid::OnSetNeedsFlushInput"); 1303 TRACE_EVENT0("input", "RenderWidgetHostViewAndroid::OnSetNeedsFlushInput");
boliu 2014/08/20 20:30:00 unrelated side note, this should be an instant eve
1306 flush_input_requested_ = true; 1304 SubscribeToVSync(INPUT);
1307 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate();
1308 } 1305 }
1309 1306
1310 BrowserAccessibilityManager* 1307 BrowserAccessibilityManager*
1311 RenderWidgetHostViewAndroid::CreateBrowserAccessibilityManager( 1308 RenderWidgetHostViewAndroid::CreateBrowserAccessibilityManager(
1312 BrowserAccessibilityDelegate* delegate) { 1309 BrowserAccessibilityDelegate* delegate) {
1313 base::android::ScopedJavaLocalRef<jobject> obj; 1310 base::android::ScopedJavaLocalRef<jobject> obj;
1314 if (content_view_core_) 1311 if (content_view_core_)
1315 obj = content_view_core_->GetJavaObject(); 1312 obj = content_view_core_->GetJavaObject();
1316 return new BrowserAccessibilityManagerAndroid( 1313 return new BrowserAccessibilityManagerAndroid(
1317 obj, 1314 obj,
(...skipping 20 matching lines...) Expand all
1338 1335
1339 void RenderWidgetHostViewAndroid::SendTouchEvent( 1336 void RenderWidgetHostViewAndroid::SendTouchEvent(
1340 const blink::WebTouchEvent& event) { 1337 const blink::WebTouchEvent& event) {
1341 if (host_) 1338 if (host_)
1342 host_->ForwardTouchEventWithLatencyInfo(event, CreateLatencyInfo(event)); 1339 host_->ForwardTouchEventWithLatencyInfo(event, CreateLatencyInfo(event));
1343 1340
1344 // Send a proactive BeginFrame on the next vsync to reduce latency. 1341 // Send a proactive BeginFrame on the next vsync to reduce latency.
1345 // This is good enough as long as the first touch event has Begin semantics 1342 // This is good enough as long as the first touch event has Begin semantics
1346 // and the actual scroll happens on the next vsync. 1343 // and the actual scroll happens on the next vsync.
1347 // TODO: Is this actually still needed? 1344 // TODO: Is this actually still needed?
1348 if (content_view_core_) { 1345 if (content_view_core_)
boliu 2014/08/20 20:30:00 You need to rebase, I added something here to not
1349 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); 1346 SubscribeToVSync(BEGIN_FRAME);
boliu 2014/08/20 20:30:00 This is not the same as simply calling RequestVSyn
1350 }
1351 } 1347 }
1352 1348
1353 void RenderWidgetHostViewAndroid::SendMouseEvent( 1349 void RenderWidgetHostViewAndroid::SendMouseEvent(
1354 const blink::WebMouseEvent& event) { 1350 const blink::WebMouseEvent& event) {
1355 if (host_) 1351 if (host_)
1356 host_->ForwardMouseEvent(event); 1352 host_->ForwardMouseEvent(event);
1357 } 1353 }
1358 1354
1359 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( 1355 void RenderWidgetHostViewAndroid::SendMouseWheelEvent(
1360 const blink::WebMouseWheelEvent& event) { 1356 const blink::WebMouseWheelEvent& event) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 OnContentScrollingChange(); 1429 OnContentScrollingChange();
1434 } 1430 }
1435 1431
1436 if (content_view_core_) 1432 if (content_view_core_)
1437 content_view_core_->DidStopFlinging(); 1433 content_view_core_->DidStopFlinging();
1438 } 1434 }
1439 1435
1440 void RenderWidgetHostViewAndroid::SetContentViewCore( 1436 void RenderWidgetHostViewAndroid::SetContentViewCore(
1441 ContentViewCoreImpl* content_view_core) { 1437 ContentViewCoreImpl* content_view_core) {
1442 RemoveLayers(); 1438 RemoveLayers();
1443 if (observing_root_window_ && content_view_core_) { 1439 if (vsync_subscribers_bitmask_ && content_view_core_)
1444 content_view_core_->GetWindowAndroid()->RemoveObserver(this); 1440 UnsubscribeToVSync(INPUT | BEGIN_FRAME);
boliu 2014/08/20 20:30:00 I think we need an catch all enum value here.
1445 observing_root_window_ = false;
1446 }
1447 1441
1448 bool resize = false; 1442 bool resize = false;
1449 if (content_view_core != content_view_core_) { 1443 if (content_view_core != content_view_core_) {
1450 selection_controller_.reset(); 1444 selection_controller_.reset();
1451 ReleaseLocksOnSurface(); 1445 ReleaseLocksOnSurface();
1452 resize = true; 1446 resize = true;
1453 } 1447 }
1454 1448
1455 content_view_core_ = content_view_core; 1449 content_view_core_ = content_view_core;
1456 1450
1457 BrowserAccessibilityManager* manager = NULL; 1451 BrowserAccessibilityManager* manager = NULL;
1458 if (host_) 1452 if (host_)
1459 manager = host_->GetRootBrowserAccessibilityManager(); 1453 manager = host_->GetRootBrowserAccessibilityManager();
1460 if (manager) { 1454 if (manager) {
1461 base::android::ScopedJavaLocalRef<jobject> obj; 1455 base::android::ScopedJavaLocalRef<jobject> obj;
1462 if (content_view_core_) 1456 if (content_view_core_)
1463 obj = content_view_core_->GetJavaObject(); 1457 obj = content_view_core_->GetJavaObject();
1464 manager->ToBrowserAccessibilityManagerAndroid()->SetContentViewCore(obj); 1458 manager->ToBrowserAccessibilityManagerAndroid()->SetContentViewCore(obj);
1465 } 1459 }
1466 1460
1467 AttachLayers(); 1461 AttachLayers();
1468 1462
1469 if (!content_view_core_) 1463 if (!content_view_core_)
1470 return; 1464 return;
1471 1465
1472 if (!using_synchronous_compositor_) { 1466 if (!using_synchronous_compositor_)
1473 content_view_core_->GetWindowAndroid()->AddObserver(this); 1467 SubscribeToVSync(INPUT | BEGIN_FRAME);
boliu 2014/08/20 20:30:00 Only subscribe to what was subscribed before.
1474 observing_root_window_ = true; 1468
1475 if (needs_begin_frame_)
1476 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate();
1477 }
1478 1469
1479 if (resize) 1470 if (resize)
1480 WasResized(); 1471 WasResized();
1481 1472
1482 if (!selection_controller_) 1473 if (!selection_controller_)
1483 selection_controller_.reset(new TouchSelectionController(this)); 1474 selection_controller_.reset(new TouchSelectionController(this));
1484 1475
1485 if (!content_view_core_) { 1476 if (!content_view_core_) {
1486 overscroll_effect_.reset(); 1477 overscroll_effect_.reset();
1487 } else if (overscroll_effect_enabled_ && !overscroll_effect_) { 1478 } else if (overscroll_effect_enabled_ && !overscroll_effect_) {
(...skipping 23 matching lines...) Expand all
1511 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() { 1502 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() {
1512 RunAckCallbacks(); 1503 RunAckCallbacks();
1513 } 1504 }
1514 1505
1515 void RenderWidgetHostViewAndroid::OnDetachCompositor() { 1506 void RenderWidgetHostViewAndroid::OnDetachCompositor() {
1516 DCHECK(content_view_core_); 1507 DCHECK(content_view_core_);
1517 DCHECK(!using_synchronous_compositor_); 1508 DCHECK(!using_synchronous_compositor_);
1518 RunAckCallbacks(); 1509 RunAckCallbacks();
1519 } 1510 }
1520 1511
1512 void RenderWidgetHostViewAndroid::SubscribeToVSync(uint32 type) {
1513 if (!vsync_subscribers_bitmask_)
1514 content_view_core_->GetWindowAndroid()->AddObserver(this);
1515
1516 vsync_subscribers_bitmask_ |= type;
1517
1518 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate();
1519
1520 // Synchronous compositor does not request begin frames OnVSync.
1521 DCHECK(!using_synchronous_compositor_ || !IsSubscribedToType(BEGIN_FRAME));
1522 }
1523
1524 void RenderWidgetHostViewAndroid::UnsubscribeToVSync(uint32 type) {
1525 vsync_subscribers_bitmask_ &= ~type;
1526 if (!vsync_subscribers_bitmask_)
1527 content_view_core_->GetWindowAndroid()->RemoveObserver(this);
1528 }
1529
1530 bool RenderWidgetHostViewAndroid::IsSubscribedToType(uint32 type) {
boliu 2014/08/20 20:30:00 const
1531 return !!(vsync_subscribers_bitmask_ & type);
1532 }
1533
1521 void RenderWidgetHostViewAndroid::OnVSync(base::TimeTicks frame_time, 1534 void RenderWidgetHostViewAndroid::OnVSync(base::TimeTicks frame_time,
1522 base::TimeDelta vsync_period) { 1535 base::TimeDelta vsync_period) {
1523 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync"); 1536 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync");
1524 if (!host_) 1537 if (!host_)
1525 return; 1538 return;
1526 1539
1527 if (flush_input_requested_) { 1540 if (IsSubscribedToType(INPUT)) {
1528 flush_input_requested_ = false; 1541 // Need to unsubscribe before host_->FlushInput(), because FlushInput()
1542 // could cause RWHVA to subscribe to input again.
1543 UnsubscribeToVSync(INPUT);
1529 host_->FlushInput(); 1544 host_->FlushInput();
1530 } 1545 }
1531 1546
1547 if (!IsSubscribedToType(BEGIN_FRAME))
1548 return;
1549
1532 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::SendBeginFrame"); 1550 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::SendBeginFrame");
1533 base::TimeTicks display_time = frame_time + vsync_period; 1551 base::TimeTicks display_time = frame_time + vsync_period;
1534 1552
1535 // TODO(brianderson): Use adaptive draw-time estimation. 1553 // TODO(brianderson): Use adaptive draw-time estimation.
1536 base::TimeDelta estimated_browser_composite_time = 1554 base::TimeDelta estimated_browser_composite_time =
1537 base::TimeDelta::FromMicroseconds( 1555 base::TimeDelta::FromMicroseconds(
1538 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60)); 1556 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60));
1539 1557
1540 base::TimeTicks deadline = display_time - estimated_browser_composite_time; 1558 base::TimeTicks deadline = display_time - estimated_browser_composite_time;
1541 1559
1542 host_->Send(new ViewMsg_BeginFrame( 1560 host_->Send(new ViewMsg_BeginFrame(
1543 host_->GetRoutingID(), 1561 host_->GetRoutingID(),
1544 cc::BeginFrameArgs::Create(frame_time, deadline, vsync_period))); 1562 cc::BeginFrameArgs::Create(frame_time, deadline, vsync_period)));
1545 1563
1546 if (needs_begin_frame_) 1564 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate();
boliu 2014/08/20 20:30:00 This is still called outside of SubscribeToVSync.
1547 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate();
1548 } 1565 }
1549 1566
1550 void RenderWidgetHostViewAndroid::OnAnimate(base::TimeTicks begin_frame_time) { 1567 void RenderWidgetHostViewAndroid::OnAnimate(base::TimeTicks begin_frame_time) {
1551 if (Animate(begin_frame_time)) 1568 if (Animate(begin_frame_time))
1552 SetNeedsAnimate(); 1569 SetNeedsAnimate();
1553 } 1570 }
1554 1571
1555 void RenderWidgetHostViewAndroid::OnLostResources() { 1572 void RenderWidgetHostViewAndroid::OnLostResources() {
1556 ReleaseLocksOnSurface(); 1573 ReleaseLocksOnSurface();
1557 if (layer_.get()) 1574 if (layer_.get())
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 results->orientationAngle = display.RotationAsDegree(); 1708 results->orientationAngle = display.RotationAsDegree();
1692 results->orientationType = 1709 results->orientationType =
1693 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 1710 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
1694 gfx::DeviceDisplayInfo info; 1711 gfx::DeviceDisplayInfo info;
1695 results->depth = info.GetBitsPerPixel(); 1712 results->depth = info.GetBitsPerPixel();
1696 results->depthPerComponent = info.GetBitsPerComponent(); 1713 results->depthPerComponent = info.GetBitsPerComponent();
1697 results->isMonochrome = (results->depthPerComponent == 0); 1714 results->isMonochrome = (results->depthPerComponent == 0);
1698 } 1715 }
1699 1716
1700 } // namespace content 1717 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698