OLD | NEW |
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/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 uint32 output_id, | 238 uint32 output_id, |
239 scoped_ptr<cc::CompositorFrame> output_frame) | 239 scoped_ptr<cc::CompositorFrame> output_frame) |
240 : output_surface_id(output_id), frame(output_frame.Pass()) {} | 240 : output_surface_id(output_id), frame(output_frame.Pass()) {} |
241 | 241 |
242 RenderWidgetHostViewAndroid::LastFrameInfo::~LastFrameInfo() {} | 242 RenderWidgetHostViewAndroid::LastFrameInfo::~LastFrameInfo() {} |
243 | 243 |
244 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( | 244 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( |
245 RenderWidgetHostImpl* widget_host, | 245 RenderWidgetHostImpl* widget_host, |
246 ContentViewCoreImpl* content_view_core) | 246 ContentViewCoreImpl* content_view_core) |
247 : host_(widget_host), | 247 : host_(widget_host), |
248 outstanding_vsync_requests_(0), | 248 needs_begin_frame_(false), |
249 is_showing_(!widget_host->is_hidden()), | 249 is_showing_(!widget_host->is_hidden()), |
250 content_view_core_(NULL), | 250 content_view_core_(NULL), |
251 ime_adapter_android_(this), | 251 ime_adapter_android_(this), |
252 cached_background_color_(SK_ColorWHITE), | 252 cached_background_color_(SK_ColorWHITE), |
253 last_output_surface_id_(kUndefinedOutputSurfaceId), | 253 last_output_surface_id_(kUndefinedOutputSurfaceId), |
254 weak_ptr_factory_(this), | 254 weak_ptr_factory_(this), |
255 overscroll_effect_enabled_( | 255 overscroll_effect_enabled_( |
256 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 256 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
257 switches::kDisableOverscrollEdgeEffect)), | 257 switches::kDisableOverscrollEdgeEffect)), |
258 gesture_provider_(CreateGestureProviderConfig(), this), | 258 gesture_provider_(CreateGestureProviderConfig(), this), |
259 gesture_text_selector_(this), | 259 gesture_text_selector_(this), |
260 touch_scrolling_(false), | 260 touch_scrolling_(false), |
261 potentially_active_fling_count_(0), | 261 potentially_active_fling_count_(0), |
| 262 flush_input_requested_(false), |
262 accelerated_surface_route_id_(0), | 263 accelerated_surface_route_id_(0), |
263 using_synchronous_compositor_(SynchronousCompositorImpl::FromID( | 264 using_synchronous_compositor_(SynchronousCompositorImpl::FromID( |
264 widget_host->GetProcess()->GetID(), | 265 widget_host->GetProcess()->GetID(), |
265 widget_host->GetRoutingID()) != NULL), | 266 widget_host->GetRoutingID()) != NULL), |
266 frame_evictor_(new DelegatedFrameEvictor(this)), | 267 frame_evictor_(new DelegatedFrameEvictor(this)), |
267 locks_on_frame_count_(0), | 268 locks_on_frame_count_(0), |
268 observing_root_window_(false) { | 269 observing_root_window_(false) { |
269 host_->SetView(this); | 270 host_->SetView(this); |
270 SetContentViewCore(content_view_core); | 271 SetContentViewCore(content_view_core); |
271 ImageTransportFactoryAndroid::AddObserver(this); | 272 ImageTransportFactoryAndroid::AddObserver(this); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const { | 316 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const { |
316 return host_; | 317 return host_; |
317 } | 318 } |
318 | 319 |
319 void RenderWidgetHostViewAndroid::WasShown() { | 320 void RenderWidgetHostViewAndroid::WasShown() { |
320 if (!host_ || !host_->is_hidden()) | 321 if (!host_ || !host_->is_hidden()) |
321 return; | 322 return; |
322 | 323 |
323 host_->WasShown(ui::LatencyInfo()); | 324 host_->WasShown(ui::LatencyInfo()); |
324 | 325 |
325 if (content_view_core_) { | 326 if (content_view_core_ && !using_synchronous_compositor_) { |
326 StartObservingRootWindow(); | 327 content_view_core_->GetWindowAndroid()->AddObserver(this); |
327 RequestVSyncUpdate(BEGIN_FRAME); | 328 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); |
| 329 observing_root_window_ = true; |
328 } | 330 } |
329 } | 331 } |
330 | 332 |
331 void RenderWidgetHostViewAndroid::WasHidden() { | 333 void RenderWidgetHostViewAndroid::WasHidden() { |
332 RunAckCallbacks(); | 334 RunAckCallbacks(); |
333 | 335 |
334 if (!host_ || host_->is_hidden()) | 336 if (!host_ || host_->is_hidden()) |
335 return; | 337 return; |
336 | 338 |
337 // Inform the renderer that we are being hidden so it can reduce its resource | 339 // Inform the renderer that we are being hidden so it can reduce its resource |
338 // utilization. | 340 // utilization. |
339 host_->WasHidden(); | 341 host_->WasHidden(); |
340 | 342 |
341 StopObservingRootWindow(); | 343 if (content_view_core_ && !using_synchronous_compositor_) { |
| 344 content_view_core_->GetWindowAndroid()->RemoveObserver(this); |
| 345 observing_root_window_ = false; |
| 346 } |
342 } | 347 } |
343 | 348 |
344 void RenderWidgetHostViewAndroid::WasResized() { | 349 void RenderWidgetHostViewAndroid::WasResized() { |
345 host_->WasResized(); | 350 host_->WasResized(); |
346 } | 351 } |
347 | 352 |
348 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { | 353 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { |
349 // Ignore the given size as only the Java code has the power to | 354 // Ignore the given size as only the Java code has the power to |
350 // resize the view on Android. | 355 // resize the view on Android. |
351 default_size_ = size; | 356 default_size_ = size; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 SkColor color) { | 621 SkColor color) { |
617 if (cached_background_color_ == color) | 622 if (cached_background_color_ == color) |
618 return; | 623 return; |
619 | 624 |
620 cached_background_color_ = color; | 625 cached_background_color_ = color; |
621 if (content_view_core_) | 626 if (content_view_core_) |
622 content_view_core_->OnBackgroundColorChanged(color); | 627 content_view_core_->OnBackgroundColorChanged(color); |
623 } | 628 } |
624 | 629 |
625 void RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame(bool enabled) { | 630 void RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame(bool enabled) { |
626 DCHECK(!using_synchronous_compositor_); | 631 if (enabled == needs_begin_frame_) |
| 632 return; |
| 633 |
627 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame", | 634 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame", |
628 "enabled", enabled); | 635 "enabled", enabled); |
629 if (enabled) | 636 if (content_view_core_ && enabled) |
630 RequestVSyncUpdate(PERSISTENT_BEGIN_FRAME); | 637 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); |
631 else | 638 |
632 outstanding_vsync_requests_ &= ~PERSISTENT_BEGIN_FRAME; | 639 needs_begin_frame_ = enabled; |
633 } | 640 } |
634 | 641 |
635 void RenderWidgetHostViewAndroid::OnStartContentIntent( | 642 void RenderWidgetHostViewAndroid::OnStartContentIntent( |
636 const GURL& content_url) { | 643 const GURL& content_url) { |
637 if (content_view_core_) | 644 if (content_view_core_) |
638 content_view_core_->StartContentIntent(content_url); | 645 content_view_core_->StartContentIntent(content_url); |
639 } | 646 } |
640 | 647 |
641 void RenderWidgetHostViewAndroid::OnSmartClipDataExtracted( | 648 void RenderWidgetHostViewAndroid::OnSmartClipDataExtracted( |
642 const base::string16& text, | 649 const base::string16& text, |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 return; | 1250 return; |
1244 | 1251 |
1245 if (!layer_.get()) | 1252 if (!layer_.get()) |
1246 return; | 1253 return; |
1247 | 1254 |
1248 content_view_core_->RemoveLayer(layer_); | 1255 content_view_core_->RemoveLayer(layer_); |
1249 if (overscroll_effect_) | 1256 if (overscroll_effect_) |
1250 overscroll_effect_->Disable(); | 1257 overscroll_effect_->Disable(); |
1251 } | 1258 } |
1252 | 1259 |
1253 void RenderWidgetHostViewAndroid::RequestVSyncUpdate(uint32 requests) { | |
1254 // The synchronous compositor does not requre BeginFrame messages. | |
1255 if (using_synchronous_compositor_) | |
1256 requests &= FLUSH_INPUT; | |
1257 | |
1258 bool should_request_vsync = !outstanding_vsync_requests_ && requests; | |
1259 outstanding_vsync_requests_ |= requests; | |
1260 // Note that if we're not currently observing the root window, outstanding | |
1261 // vsync requests will be pushed if/when we resume observing in | |
1262 // |StartObservingRootWindow()|. | |
1263 if (observing_root_window_ && should_request_vsync) | |
1264 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); | |
1265 } | |
1266 | |
1267 void RenderWidgetHostViewAndroid::StartObservingRootWindow() { | |
1268 DCHECK(content_view_core_); | |
1269 DCHECK(!observing_root_window_); | |
1270 observing_root_window_ = true; | |
1271 content_view_core_->GetWindowAndroid()->AddObserver(this); | |
1272 | |
1273 // Clear existing vsync requests to allow a request to the new window. | |
1274 uint32 outstanding_vsync_requests = outstanding_vsync_requests_; | |
1275 outstanding_vsync_requests_ = 0; | |
1276 RequestVSyncUpdate(outstanding_vsync_requests); | |
1277 } | |
1278 | |
1279 void RenderWidgetHostViewAndroid::StopObservingRootWindow() { | |
1280 if (!content_view_core_) { | |
1281 DCHECK(!observing_root_window_); | |
1282 return; | |
1283 } | |
1284 | |
1285 if (!observing_root_window_) | |
1286 return; | |
1287 | |
1288 observing_root_window_ = false; | |
1289 content_view_core_->GetWindowAndroid()->RemoveObserver(this); | |
1290 } | |
1291 | |
1292 void RenderWidgetHostViewAndroid::SendBeginFrame(base::TimeTicks frame_time, | |
1293 base::TimeDelta vsync_period) { | |
1294 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::SendBeginFrame"); | |
1295 base::TimeTicks display_time = frame_time + vsync_period; | |
1296 | |
1297 // TODO(brianderson): Use adaptive draw-time estimation. | |
1298 base::TimeDelta estimated_browser_composite_time = | |
1299 base::TimeDelta::FromMicroseconds( | |
1300 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60)); | |
1301 | |
1302 base::TimeTicks deadline = display_time - estimated_browser_composite_time; | |
1303 | |
1304 host_->Send(new ViewMsg_BeginFrame( | |
1305 host_->GetRoutingID(), | |
1306 cc::BeginFrameArgs::Create(frame_time, deadline, vsync_period))); | |
1307 } | |
1308 | |
1309 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { | 1260 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { |
1310 bool needs_animate = | 1261 bool needs_animate = |
1311 overscroll_effect_ ? overscroll_effect_->Animate(frame_time) : false; | 1262 overscroll_effect_ ? overscroll_effect_->Animate(frame_time) : false; |
1312 if (selection_controller_) | 1263 if (selection_controller_) |
1313 needs_animate |= selection_controller_->Animate(frame_time); | 1264 needs_animate |= selection_controller_->Animate(frame_time); |
1314 return needs_animate; | 1265 return needs_animate; |
1315 } | 1266 } |
1316 | 1267 |
1317 void RenderWidgetHostViewAndroid::OnContentScrollingChange() { | 1268 void RenderWidgetHostViewAndroid::OnContentScrollingChange() { |
1318 if (selection_controller_) | 1269 if (selection_controller_) |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 | 1398 |
1448 SynchronousCompositorImpl* compositor = | 1399 SynchronousCompositorImpl* compositor = |
1449 SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(), | 1400 SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(), |
1450 host_->GetRoutingID()); | 1401 host_->GetRoutingID()); |
1451 if (compositor) | 1402 if (compositor) |
1452 return compositor->HandleInputEvent(input_event); | 1403 return compositor->HandleInputEvent(input_event); |
1453 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 1404 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
1454 } | 1405 } |
1455 | 1406 |
1456 void RenderWidgetHostViewAndroid::OnSetNeedsFlushInput() { | 1407 void RenderWidgetHostViewAndroid::OnSetNeedsFlushInput() { |
| 1408 if (flush_input_requested_ || !content_view_core_) |
| 1409 return; |
1457 TRACE_EVENT0("input", "RenderWidgetHostViewAndroid::OnSetNeedsFlushInput"); | 1410 TRACE_EVENT0("input", "RenderWidgetHostViewAndroid::OnSetNeedsFlushInput"); |
1458 RequestVSyncUpdate(FLUSH_INPUT); | 1411 flush_input_requested_ = true; |
| 1412 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); |
1459 } | 1413 } |
1460 | 1414 |
1461 BrowserAccessibilityManager* | 1415 BrowserAccessibilityManager* |
1462 RenderWidgetHostViewAndroid::CreateBrowserAccessibilityManager( | 1416 RenderWidgetHostViewAndroid::CreateBrowserAccessibilityManager( |
1463 BrowserAccessibilityDelegate* delegate) { | 1417 BrowserAccessibilityDelegate* delegate) { |
1464 base::android::ScopedJavaLocalRef<jobject> obj; | 1418 base::android::ScopedJavaLocalRef<jobject> obj; |
1465 if (content_view_core_) | 1419 if (content_view_core_) |
1466 obj = content_view_core_->GetJavaObject(); | 1420 obj = content_view_core_->GetJavaObject(); |
1467 return new BrowserAccessibilityManagerAndroid( | 1421 return new BrowserAccessibilityManagerAndroid( |
1468 obj, | 1422 obj, |
(...skipping 20 matching lines...) Expand all Loading... |
1489 | 1443 |
1490 void RenderWidgetHostViewAndroid::SendTouchEvent( | 1444 void RenderWidgetHostViewAndroid::SendTouchEvent( |
1491 const blink::WebTouchEvent& event) { | 1445 const blink::WebTouchEvent& event) { |
1492 if (host_) | 1446 if (host_) |
1493 host_->ForwardTouchEventWithLatencyInfo(event, CreateLatencyInfo(event)); | 1447 host_->ForwardTouchEventWithLatencyInfo(event, CreateLatencyInfo(event)); |
1494 | 1448 |
1495 // Send a proactive BeginFrame on the next vsync to reduce latency. | 1449 // Send a proactive BeginFrame on the next vsync to reduce latency. |
1496 // This is good enough as long as the first touch event has Begin semantics | 1450 // This is good enough as long as the first touch event has Begin semantics |
1497 // and the actual scroll happens on the next vsync. | 1451 // and the actual scroll happens on the next vsync. |
1498 // TODO: Is this actually still needed? | 1452 // TODO: Is this actually still needed? |
1499 if (observing_root_window_) | 1453 if (content_view_core_ && observing_root_window_) { |
1500 RequestVSyncUpdate(BEGIN_FRAME); | 1454 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); |
| 1455 } |
1501 } | 1456 } |
1502 | 1457 |
1503 void RenderWidgetHostViewAndroid::SendMouseEvent( | 1458 void RenderWidgetHostViewAndroid::SendMouseEvent( |
1504 const blink::WebMouseEvent& event) { | 1459 const blink::WebMouseEvent& event) { |
1505 if (host_) | 1460 if (host_) |
1506 host_->ForwardMouseEvent(event); | 1461 host_->ForwardMouseEvent(event); |
1507 } | 1462 } |
1508 | 1463 |
1509 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( | 1464 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( |
1510 const blink::WebMouseWheelEvent& event) { | 1465 const blink::WebMouseWheelEvent& event) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 OnContentScrollingChange(); | 1541 OnContentScrollingChange(); |
1587 } | 1542 } |
1588 | 1543 |
1589 if (content_view_core_) | 1544 if (content_view_core_) |
1590 content_view_core_->DidStopFlinging(); | 1545 content_view_core_->DidStopFlinging(); |
1591 } | 1546 } |
1592 | 1547 |
1593 void RenderWidgetHostViewAndroid::SetContentViewCore( | 1548 void RenderWidgetHostViewAndroid::SetContentViewCore( |
1594 ContentViewCoreImpl* content_view_core) { | 1549 ContentViewCoreImpl* content_view_core) { |
1595 RemoveLayers(); | 1550 RemoveLayers(); |
1596 StopObservingRootWindow(); | 1551 if (observing_root_window_ && content_view_core_) { |
| 1552 content_view_core_->GetWindowAndroid()->RemoveObserver(this); |
| 1553 observing_root_window_ = false; |
| 1554 } |
1597 | 1555 |
1598 bool resize = false; | 1556 bool resize = false; |
1599 if (content_view_core != content_view_core_) { | 1557 if (content_view_core != content_view_core_) { |
1600 selection_controller_.reset(); | 1558 selection_controller_.reset(); |
1601 ReleaseLocksOnSurface(); | 1559 ReleaseLocksOnSurface(); |
1602 resize = true; | 1560 resize = true; |
1603 } | 1561 } |
1604 | 1562 |
1605 content_view_core_ = content_view_core; | 1563 content_view_core_ = content_view_core; |
1606 | 1564 |
1607 BrowserAccessibilityManager* manager = NULL; | 1565 BrowserAccessibilityManager* manager = NULL; |
1608 if (host_) | 1566 if (host_) |
1609 manager = host_->GetRootBrowserAccessibilityManager(); | 1567 manager = host_->GetRootBrowserAccessibilityManager(); |
1610 if (manager) { | 1568 if (manager) { |
1611 base::android::ScopedJavaLocalRef<jobject> obj; | 1569 base::android::ScopedJavaLocalRef<jobject> obj; |
1612 if (content_view_core_) | 1570 if (content_view_core_) |
1613 obj = content_view_core_->GetJavaObject(); | 1571 obj = content_view_core_->GetJavaObject(); |
1614 manager->ToBrowserAccessibilityManagerAndroid()->SetContentViewCore(obj); | 1572 manager->ToBrowserAccessibilityManagerAndroid()->SetContentViewCore(obj); |
1615 } | 1573 } |
1616 | 1574 |
1617 AttachLayers(); | 1575 AttachLayers(); |
1618 | 1576 |
1619 if (!content_view_core_) | 1577 if (!content_view_core_) |
1620 return; | 1578 return; |
1621 | 1579 |
1622 StartObservingRootWindow(); | 1580 if (!using_synchronous_compositor_) { |
| 1581 content_view_core_->GetWindowAndroid()->AddObserver(this); |
| 1582 observing_root_window_ = true; |
| 1583 if (needs_begin_frame_) |
| 1584 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); |
| 1585 } |
1623 | 1586 |
1624 if (resize) | 1587 if (resize) |
1625 WasResized(); | 1588 WasResized(); |
1626 | 1589 |
1627 if (!selection_controller_) | 1590 if (!selection_controller_) |
1628 selection_controller_.reset(new TouchSelectionController(this)); | 1591 selection_controller_.reset(new TouchSelectionController(this)); |
1629 | 1592 |
1630 if (!content_view_core_) | 1593 if (!content_view_core_) |
1631 overscroll_effect_.reset(); | 1594 overscroll_effect_.reset(); |
1632 else if (overscroll_effect_enabled_ && !overscroll_effect_) | 1595 else if (overscroll_effect_enabled_ && !overscroll_effect_) |
(...skipping 24 matching lines...) Expand all Loading... |
1657 DCHECK(!using_synchronous_compositor_); | 1620 DCHECK(!using_synchronous_compositor_); |
1658 RunAckCallbacks(); | 1621 RunAckCallbacks(); |
1659 } | 1622 } |
1660 | 1623 |
1661 void RenderWidgetHostViewAndroid::OnVSync(base::TimeTicks frame_time, | 1624 void RenderWidgetHostViewAndroid::OnVSync(base::TimeTicks frame_time, |
1662 base::TimeDelta vsync_period) { | 1625 base::TimeDelta vsync_period) { |
1663 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync"); | 1626 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync"); |
1664 if (!host_) | 1627 if (!host_) |
1665 return; | 1628 return; |
1666 | 1629 |
1667 const uint32 current_vsync_requests = outstanding_vsync_requests_; | 1630 if (flush_input_requested_) { |
1668 outstanding_vsync_requests_ = 0; | 1631 flush_input_requested_ = false; |
1669 | |
1670 if (current_vsync_requests & FLUSH_INPUT) | |
1671 host_->FlushInput(); | 1632 host_->FlushInput(); |
1672 | |
1673 if (current_vsync_requests & BEGIN_FRAME || | |
1674 current_vsync_requests & PERSISTENT_BEGIN_FRAME) { | |
1675 SendBeginFrame(frame_time, vsync_period); | |
1676 } | 1633 } |
1677 | 1634 |
1678 if (current_vsync_requests & PERSISTENT_BEGIN_FRAME) | 1635 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::SendBeginFrame"); |
1679 RequestVSyncUpdate(PERSISTENT_BEGIN_FRAME); | 1636 base::TimeTicks display_time = frame_time + vsync_period; |
| 1637 |
| 1638 // TODO(brianderson): Use adaptive draw-time estimation. |
| 1639 base::TimeDelta estimated_browser_composite_time = |
| 1640 base::TimeDelta::FromMicroseconds( |
| 1641 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60)); |
| 1642 |
| 1643 base::TimeTicks deadline = display_time - estimated_browser_composite_time; |
| 1644 |
| 1645 host_->Send(new ViewMsg_BeginFrame( |
| 1646 host_->GetRoutingID(), |
| 1647 cc::BeginFrameArgs::Create(frame_time, deadline, vsync_period))); |
| 1648 |
| 1649 if (needs_begin_frame_) |
| 1650 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); |
1680 } | 1651 } |
1681 | 1652 |
1682 void RenderWidgetHostViewAndroid::OnAnimate(base::TimeTicks begin_frame_time) { | 1653 void RenderWidgetHostViewAndroid::OnAnimate(base::TimeTicks begin_frame_time) { |
1683 if (Animate(begin_frame_time)) | 1654 if (Animate(begin_frame_time)) |
1684 SetNeedsAnimate(); | 1655 SetNeedsAnimate(); |
1685 } | 1656 } |
1686 | 1657 |
1687 void RenderWidgetHostViewAndroid::OnLostResources() { | 1658 void RenderWidgetHostViewAndroid::OnLostResources() { |
1688 ReleaseLocksOnSurface(); | 1659 ReleaseLocksOnSurface(); |
1689 if (layer_.get()) | 1660 if (layer_.get()) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 results->orientationAngle = display.RotationAsDegree(); | 1796 results->orientationAngle = display.RotationAsDegree(); |
1826 results->orientationType = | 1797 results->orientationType = |
1827 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1798 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1828 gfx::DeviceDisplayInfo info; | 1799 gfx::DeviceDisplayInfo info; |
1829 results->depth = info.GetBitsPerPixel(); | 1800 results->depth = info.GetBitsPerPixel(); |
1830 results->depthPerComponent = info.GetBitsPerComponent(); | 1801 results->depthPerComponent = info.GetBitsPerComponent(); |
1831 results->isMonochrome = (results->depthPerComponent == 0); | 1802 results->isMonochrome = (results->depthPerComponent == 0); |
1832 } | 1803 } |
1833 | 1804 |
1834 } // namespace content | 1805 } // namespace content |
OLD | NEW |