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 needs_begin_frame_(false), | 248 outstanding_vsync_requests_(0), |
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), | |
263 accelerated_surface_route_id_(0), | 262 accelerated_surface_route_id_(0), |
264 using_synchronous_compositor_(SynchronousCompositorImpl::FromID( | 263 using_synchronous_compositor_(SynchronousCompositorImpl::FromID( |
265 widget_host->GetProcess()->GetID(), | 264 widget_host->GetProcess()->GetID(), |
266 widget_host->GetRoutingID()) != NULL), | 265 widget_host->GetRoutingID()) != NULL), |
267 frame_evictor_(new DelegatedFrameEvictor(this)), | 266 frame_evictor_(new DelegatedFrameEvictor(this)), |
268 locks_on_frame_count_(0), | 267 locks_on_frame_count_(0), |
269 observing_root_window_(false) { | 268 observing_root_window_(false) { |
270 host_->SetView(this); | 269 host_->SetView(this); |
271 SetContentViewCore(content_view_core); | 270 SetContentViewCore(content_view_core); |
272 ImageTransportFactoryAndroid::AddObserver(this); | 271 ImageTransportFactoryAndroid::AddObserver(this); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const { | 315 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const { |
317 return host_; | 316 return host_; |
318 } | 317 } |
319 | 318 |
320 void RenderWidgetHostViewAndroid::WasShown() { | 319 void RenderWidgetHostViewAndroid::WasShown() { |
321 if (!host_ || !host_->is_hidden()) | 320 if (!host_ || !host_->is_hidden()) |
322 return; | 321 return; |
323 | 322 |
324 host_->WasShown(ui::LatencyInfo()); | 323 host_->WasShown(ui::LatencyInfo()); |
325 | 324 |
326 if (content_view_core_ && !using_synchronous_compositor_) { | 325 if (content_view_core_) { |
327 content_view_core_->GetWindowAndroid()->AddObserver(this); | 326 StartObservingRootWindow(); |
328 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); | 327 RequestVSyncUpdate(BEGIN_FRAME); |
329 observing_root_window_ = true; | |
330 } | 328 } |
331 } | 329 } |
332 | 330 |
333 void RenderWidgetHostViewAndroid::WasHidden() { | 331 void RenderWidgetHostViewAndroid::WasHidden() { |
334 RunAckCallbacks(); | 332 RunAckCallbacks(); |
335 | 333 |
336 if (!host_ || host_->is_hidden()) | 334 if (!host_ || host_->is_hidden()) |
337 return; | 335 return; |
338 | 336 |
339 // Inform the renderer that we are being hidden so it can reduce its resource | 337 // Inform the renderer that we are being hidden so it can reduce its resource |
340 // utilization. | 338 // utilization. |
341 host_->WasHidden(); | 339 host_->WasHidden(); |
342 | 340 |
343 if (content_view_core_ && !using_synchronous_compositor_) { | 341 StopObservingRootWindow(); |
344 content_view_core_->GetWindowAndroid()->RemoveObserver(this); | |
345 observing_root_window_ = false; | |
346 } | |
347 } | 342 } |
348 | 343 |
349 void RenderWidgetHostViewAndroid::WasResized() { | 344 void RenderWidgetHostViewAndroid::WasResized() { |
350 host_->WasResized(); | 345 host_->WasResized(); |
351 } | 346 } |
352 | 347 |
353 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { | 348 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { |
354 // Ignore the given size as only the Java code has the power to | 349 // Ignore the given size as only the Java code has the power to |
355 // resize the view on Android. | 350 // resize the view on Android. |
356 default_size_ = size; | 351 default_size_ = size; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 SkColor color) { | 616 SkColor color) { |
622 if (cached_background_color_ == color) | 617 if (cached_background_color_ == color) |
623 return; | 618 return; |
624 | 619 |
625 cached_background_color_ = color; | 620 cached_background_color_ = color; |
626 if (content_view_core_) | 621 if (content_view_core_) |
627 content_view_core_->OnBackgroundColorChanged(color); | 622 content_view_core_->OnBackgroundColorChanged(color); |
628 } | 623 } |
629 | 624 |
630 void RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame(bool enabled) { | 625 void RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame(bool enabled) { |
631 if (enabled == needs_begin_frame_) | 626 DCHECK(!using_synchronous_compositor_); |
632 return; | |
633 | |
634 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame", | 627 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame", |
635 "enabled", enabled); | 628 "enabled", enabled); |
636 if (content_view_core_ && enabled) | 629 if (enabled) |
637 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); | 630 RequestVSyncUpdate(PERSISTENT_BEGIN_FRAME); |
638 | 631 else |
639 needs_begin_frame_ = enabled; | 632 outstanding_vsync_requests_ &= ~PERSISTENT_BEGIN_FRAME; |
640 } | 633 } |
641 | 634 |
642 void RenderWidgetHostViewAndroid::OnStartContentIntent( | 635 void RenderWidgetHostViewAndroid::OnStartContentIntent( |
643 const GURL& content_url) { | 636 const GURL& content_url) { |
644 if (content_view_core_) | 637 if (content_view_core_) |
645 content_view_core_->StartContentIntent(content_url); | 638 content_view_core_->StartContentIntent(content_url); |
646 } | 639 } |
647 | 640 |
648 void RenderWidgetHostViewAndroid::OnSmartClipDataExtracted( | 641 void RenderWidgetHostViewAndroid::OnSmartClipDataExtracted( |
649 const base::string16& text, | 642 const base::string16& text, |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 return; | 1243 return; |
1251 | 1244 |
1252 if (!layer_.get()) | 1245 if (!layer_.get()) |
1253 return; | 1246 return; |
1254 | 1247 |
1255 content_view_core_->RemoveLayer(layer_); | 1248 content_view_core_->RemoveLayer(layer_); |
1256 if (overscroll_effect_) | 1249 if (overscroll_effect_) |
1257 overscroll_effect_->Disable(); | 1250 overscroll_effect_->Disable(); |
1258 } | 1251 } |
1259 | 1252 |
| 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 |
1260 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { | 1309 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { |
1261 bool needs_animate = | 1310 bool needs_animate = |
1262 overscroll_effect_ ? overscroll_effect_->Animate(frame_time) : false; | 1311 overscroll_effect_ ? overscroll_effect_->Animate(frame_time) : false; |
1263 if (selection_controller_) | 1312 if (selection_controller_) |
1264 needs_animate |= selection_controller_->Animate(frame_time); | 1313 needs_animate |= selection_controller_->Animate(frame_time); |
1265 return needs_animate; | 1314 return needs_animate; |
1266 } | 1315 } |
1267 | 1316 |
1268 void RenderWidgetHostViewAndroid::OnContentScrollingChange() { | 1317 void RenderWidgetHostViewAndroid::OnContentScrollingChange() { |
1269 if (selection_controller_) | 1318 if (selection_controller_) |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 | 1447 |
1399 SynchronousCompositorImpl* compositor = | 1448 SynchronousCompositorImpl* compositor = |
1400 SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(), | 1449 SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(), |
1401 host_->GetRoutingID()); | 1450 host_->GetRoutingID()); |
1402 if (compositor) | 1451 if (compositor) |
1403 return compositor->HandleInputEvent(input_event); | 1452 return compositor->HandleInputEvent(input_event); |
1404 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 1453 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
1405 } | 1454 } |
1406 | 1455 |
1407 void RenderWidgetHostViewAndroid::OnSetNeedsFlushInput() { | 1456 void RenderWidgetHostViewAndroid::OnSetNeedsFlushInput() { |
1408 if (flush_input_requested_ || !content_view_core_) | |
1409 return; | |
1410 TRACE_EVENT0("input", "RenderWidgetHostViewAndroid::OnSetNeedsFlushInput"); | 1457 TRACE_EVENT0("input", "RenderWidgetHostViewAndroid::OnSetNeedsFlushInput"); |
1411 flush_input_requested_ = true; | 1458 RequestVSyncUpdate(FLUSH_INPUT); |
1412 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); | |
1413 } | 1459 } |
1414 | 1460 |
1415 BrowserAccessibilityManager* | 1461 BrowserAccessibilityManager* |
1416 RenderWidgetHostViewAndroid::CreateBrowserAccessibilityManager( | 1462 RenderWidgetHostViewAndroid::CreateBrowserAccessibilityManager( |
1417 BrowserAccessibilityDelegate* delegate) { | 1463 BrowserAccessibilityDelegate* delegate) { |
1418 base::android::ScopedJavaLocalRef<jobject> obj; | 1464 base::android::ScopedJavaLocalRef<jobject> obj; |
1419 if (content_view_core_) | 1465 if (content_view_core_) |
1420 obj = content_view_core_->GetJavaObject(); | 1466 obj = content_view_core_->GetJavaObject(); |
1421 return new BrowserAccessibilityManagerAndroid( | 1467 return new BrowserAccessibilityManagerAndroid( |
1422 obj, | 1468 obj, |
(...skipping 20 matching lines...) Expand all Loading... |
1443 | 1489 |
1444 void RenderWidgetHostViewAndroid::SendTouchEvent( | 1490 void RenderWidgetHostViewAndroid::SendTouchEvent( |
1445 const blink::WebTouchEvent& event) { | 1491 const blink::WebTouchEvent& event) { |
1446 if (host_) | 1492 if (host_) |
1447 host_->ForwardTouchEventWithLatencyInfo(event, CreateLatencyInfo(event)); | 1493 host_->ForwardTouchEventWithLatencyInfo(event, CreateLatencyInfo(event)); |
1448 | 1494 |
1449 // Send a proactive BeginFrame on the next vsync to reduce latency. | 1495 // Send a proactive BeginFrame on the next vsync to reduce latency. |
1450 // This is good enough as long as the first touch event has Begin semantics | 1496 // This is good enough as long as the first touch event has Begin semantics |
1451 // and the actual scroll happens on the next vsync. | 1497 // and the actual scroll happens on the next vsync. |
1452 // TODO: Is this actually still needed? | 1498 // TODO: Is this actually still needed? |
1453 if (content_view_core_ && observing_root_window_) { | 1499 if (observing_root_window_) |
1454 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); | 1500 RequestVSyncUpdate(BEGIN_FRAME); |
1455 } | |
1456 } | 1501 } |
1457 | 1502 |
1458 void RenderWidgetHostViewAndroid::SendMouseEvent( | 1503 void RenderWidgetHostViewAndroid::SendMouseEvent( |
1459 const blink::WebMouseEvent& event) { | 1504 const blink::WebMouseEvent& event) { |
1460 if (host_) | 1505 if (host_) |
1461 host_->ForwardMouseEvent(event); | 1506 host_->ForwardMouseEvent(event); |
1462 } | 1507 } |
1463 | 1508 |
1464 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( | 1509 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( |
1465 const blink::WebMouseWheelEvent& event) { | 1510 const blink::WebMouseWheelEvent& event) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 OnContentScrollingChange(); | 1586 OnContentScrollingChange(); |
1542 } | 1587 } |
1543 | 1588 |
1544 if (content_view_core_) | 1589 if (content_view_core_) |
1545 content_view_core_->DidStopFlinging(); | 1590 content_view_core_->DidStopFlinging(); |
1546 } | 1591 } |
1547 | 1592 |
1548 void RenderWidgetHostViewAndroid::SetContentViewCore( | 1593 void RenderWidgetHostViewAndroid::SetContentViewCore( |
1549 ContentViewCoreImpl* content_view_core) { | 1594 ContentViewCoreImpl* content_view_core) { |
1550 RemoveLayers(); | 1595 RemoveLayers(); |
1551 if (observing_root_window_ && content_view_core_) { | 1596 StopObservingRootWindow(); |
1552 content_view_core_->GetWindowAndroid()->RemoveObserver(this); | |
1553 observing_root_window_ = false; | |
1554 } | |
1555 | 1597 |
1556 bool resize = false; | 1598 bool resize = false; |
1557 if (content_view_core != content_view_core_) { | 1599 if (content_view_core != content_view_core_) { |
1558 selection_controller_.reset(); | 1600 selection_controller_.reset(); |
1559 ReleaseLocksOnSurface(); | 1601 ReleaseLocksOnSurface(); |
1560 resize = true; | 1602 resize = true; |
1561 } | 1603 } |
1562 | 1604 |
1563 content_view_core_ = content_view_core; | 1605 content_view_core_ = content_view_core; |
1564 | 1606 |
1565 BrowserAccessibilityManager* manager = NULL; | 1607 BrowserAccessibilityManager* manager = NULL; |
1566 if (host_) | 1608 if (host_) |
1567 manager = host_->GetRootBrowserAccessibilityManager(); | 1609 manager = host_->GetRootBrowserAccessibilityManager(); |
1568 if (manager) { | 1610 if (manager) { |
1569 base::android::ScopedJavaLocalRef<jobject> obj; | 1611 base::android::ScopedJavaLocalRef<jobject> obj; |
1570 if (content_view_core_) | 1612 if (content_view_core_) |
1571 obj = content_view_core_->GetJavaObject(); | 1613 obj = content_view_core_->GetJavaObject(); |
1572 manager->ToBrowserAccessibilityManagerAndroid()->SetContentViewCore(obj); | 1614 manager->ToBrowserAccessibilityManagerAndroid()->SetContentViewCore(obj); |
1573 } | 1615 } |
1574 | 1616 |
1575 AttachLayers(); | 1617 AttachLayers(); |
1576 | 1618 |
1577 if (!content_view_core_) | 1619 if (!content_view_core_) |
1578 return; | 1620 return; |
1579 | 1621 |
1580 if (!using_synchronous_compositor_) { | 1622 StartObservingRootWindow(); |
1581 content_view_core_->GetWindowAndroid()->AddObserver(this); | |
1582 observing_root_window_ = true; | |
1583 if (needs_begin_frame_) | |
1584 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); | |
1585 } | |
1586 | 1623 |
1587 if (resize) | 1624 if (resize) |
1588 WasResized(); | 1625 WasResized(); |
1589 | 1626 |
1590 if (!selection_controller_) | 1627 if (!selection_controller_) |
1591 selection_controller_.reset(new TouchSelectionController(this)); | 1628 selection_controller_.reset(new TouchSelectionController(this)); |
1592 | 1629 |
1593 if (!content_view_core_) | 1630 if (!content_view_core_) |
1594 overscroll_effect_.reset(); | 1631 overscroll_effect_.reset(); |
1595 else if (overscroll_effect_enabled_ && !overscroll_effect_) | 1632 else if (overscroll_effect_enabled_ && !overscroll_effect_) |
(...skipping 24 matching lines...) Expand all Loading... |
1620 DCHECK(!using_synchronous_compositor_); | 1657 DCHECK(!using_synchronous_compositor_); |
1621 RunAckCallbacks(); | 1658 RunAckCallbacks(); |
1622 } | 1659 } |
1623 | 1660 |
1624 void RenderWidgetHostViewAndroid::OnVSync(base::TimeTicks frame_time, | 1661 void RenderWidgetHostViewAndroid::OnVSync(base::TimeTicks frame_time, |
1625 base::TimeDelta vsync_period) { | 1662 base::TimeDelta vsync_period) { |
1626 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync"); | 1663 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync"); |
1627 if (!host_) | 1664 if (!host_) |
1628 return; | 1665 return; |
1629 | 1666 |
1630 if (flush_input_requested_) { | 1667 const uint32 current_vsync_requests = outstanding_vsync_requests_; |
1631 flush_input_requested_ = false; | 1668 outstanding_vsync_requests_ = 0; |
| 1669 |
| 1670 if (current_vsync_requests & FLUSH_INPUT) |
1632 host_->FlushInput(); | 1671 host_->FlushInput(); |
| 1672 |
| 1673 if (current_vsync_requests & BEGIN_FRAME || |
| 1674 current_vsync_requests & PERSISTENT_BEGIN_FRAME) { |
| 1675 SendBeginFrame(frame_time, vsync_period); |
1633 } | 1676 } |
1634 | 1677 |
1635 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::SendBeginFrame"); | 1678 if (current_vsync_requests & PERSISTENT_BEGIN_FRAME) |
1636 base::TimeTicks display_time = frame_time + vsync_period; | 1679 RequestVSyncUpdate(PERSISTENT_BEGIN_FRAME); |
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(); | |
1651 } | 1680 } |
1652 | 1681 |
1653 void RenderWidgetHostViewAndroid::OnAnimate(base::TimeTicks begin_frame_time) { | 1682 void RenderWidgetHostViewAndroid::OnAnimate(base::TimeTicks begin_frame_time) { |
1654 if (Animate(begin_frame_time)) | 1683 if (Animate(begin_frame_time)) |
1655 SetNeedsAnimate(); | 1684 SetNeedsAnimate(); |
1656 } | 1685 } |
1657 | 1686 |
1658 void RenderWidgetHostViewAndroid::OnLostResources() { | 1687 void RenderWidgetHostViewAndroid::OnLostResources() { |
1659 ReleaseLocksOnSurface(); | 1688 ReleaseLocksOnSurface(); |
1660 if (layer_.get()) | 1689 if (layer_.get()) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 results->orientationAngle = display.RotationAsDegree(); | 1825 results->orientationAngle = display.RotationAsDegree(); |
1797 results->orientationType = | 1826 results->orientationType = |
1798 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1827 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1799 gfx::DeviceDisplayInfo info; | 1828 gfx::DeviceDisplayInfo info; |
1800 results->depth = info.GetBitsPerPixel(); | 1829 results->depth = info.GetBitsPerPixel(); |
1801 results->depthPerComponent = info.GetBitsPerComponent(); | 1830 results->depthPerComponent = info.GetBitsPerComponent(); |
1802 results->isMonochrome = (results->depthPerComponent == 0); | 1831 results->isMonochrome = (results->depthPerComponent == 0); |
1803 } | 1832 } |
1804 | 1833 |
1805 } // namespace content | 1834 } // namespace content |
OLD | NEW |