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/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1297 if (compositor) | 1297 if (compositor) |
1298 return compositor->HandleInputEvent(input_event); | 1298 return compositor->HandleInputEvent(input_event); |
1299 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 1299 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
1300 } | 1300 } |
1301 | 1301 |
1302 void RenderWidgetHostViewAndroid::OnSetNeedsFlushInput() { | 1302 void RenderWidgetHostViewAndroid::OnSetNeedsFlushInput() { |
1303 if (flush_input_requested_ || !content_view_core_) | 1303 if (flush_input_requested_ || !content_view_core_) |
1304 return; | 1304 return; |
1305 TRACE_EVENT0("input", "RenderWidgetHostViewAndroid::OnSetNeedsFlushInput"); | 1305 TRACE_EVENT0("input", "RenderWidgetHostViewAndroid::OnSetNeedsFlushInput"); |
1306 flush_input_requested_ = true; | 1306 flush_input_requested_ = true; |
1307 | |
1308 if (!observing_root_window_) { | |
1309 content_view_core_->GetWindowAndroid()->AddObserver(this); | |
no sievers
2014/08/21 18:01:22
Actually I'm not sure if this is a good idea, sinc
boliu
2014/08/21 18:04:56
Jared's patch came from this. And we should submit
no sievers
2014/08/21 18:11:00
What if OnSetNeedsFlushInput() gets called in Chro
boliu
2014/08/21 18:22:52
Hmm...webview should do what chrome does, which me
| |
1310 observing_root_window_ = true; | |
1311 } | |
1312 | |
1307 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); | 1313 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); |
1308 } | 1314 } |
1309 | 1315 |
1310 BrowserAccessibilityManager* | 1316 BrowserAccessibilityManager* |
1311 RenderWidgetHostViewAndroid::CreateBrowserAccessibilityManager( | 1317 RenderWidgetHostViewAndroid::CreateBrowserAccessibilityManager( |
1312 BrowserAccessibilityDelegate* delegate) { | 1318 BrowserAccessibilityDelegate* delegate) { |
1313 base::android::ScopedJavaLocalRef<jobject> obj; | 1319 base::android::ScopedJavaLocalRef<jobject> obj; |
1314 if (content_view_core_) | 1320 if (content_view_core_) |
1315 obj = content_view_core_->GetJavaObject(); | 1321 obj = content_view_core_->GetJavaObject(); |
1316 return new BrowserAccessibilityManagerAndroid( | 1322 return new BrowserAccessibilityManagerAndroid( |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1522 base::TimeDelta vsync_period) { | 1528 base::TimeDelta vsync_period) { |
1523 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync"); | 1529 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync"); |
1524 if (!host_) | 1530 if (!host_) |
1525 return; | 1531 return; |
1526 | 1532 |
1527 if (flush_input_requested_) { | 1533 if (flush_input_requested_) { |
1528 flush_input_requested_ = false; | 1534 flush_input_requested_ = false; |
1529 host_->FlushInput(); | 1535 host_->FlushInput(); |
1530 } | 1536 } |
1531 | 1537 |
1538 if (using_synchronous_compositor_) | |
1539 return; | |
1540 | |
1532 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::SendBeginFrame"); | 1541 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::SendBeginFrame"); |
1533 base::TimeTicks display_time = frame_time + vsync_period; | 1542 base::TimeTicks display_time = frame_time + vsync_period; |
1534 | 1543 |
1535 // TODO(brianderson): Use adaptive draw-time estimation. | 1544 // TODO(brianderson): Use adaptive draw-time estimation. |
1536 base::TimeDelta estimated_browser_composite_time = | 1545 base::TimeDelta estimated_browser_composite_time = |
1537 base::TimeDelta::FromMicroseconds( | 1546 base::TimeDelta::FromMicroseconds( |
1538 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60)); | 1547 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60)); |
1539 | 1548 |
1540 base::TimeTicks deadline = display_time - estimated_browser_composite_time; | 1549 base::TimeTicks deadline = display_time - estimated_browser_composite_time; |
1541 | 1550 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1691 results->orientationAngle = display.RotationAsDegree(); | 1700 results->orientationAngle = display.RotationAsDegree(); |
1692 results->orientationType = | 1701 results->orientationType = |
1693 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1702 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1694 gfx::DeviceDisplayInfo info; | 1703 gfx::DeviceDisplayInfo info; |
1695 results->depth = info.GetBitsPerPixel(); | 1704 results->depth = info.GetBitsPerPixel(); |
1696 results->depthPerComponent = info.GetBitsPerComponent(); | 1705 results->depthPerComponent = info.GetBitsPerComponent(); |
1697 results->isMonochrome = (results->depthPerComponent == 0); | 1706 results->isMonochrome = (results->depthPerComponent == 0); |
1698 } | 1707 } |
1699 | 1708 |
1700 } // namespace content | 1709 } // namespace content |
OLD | NEW |