Chromium Code Reviews| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1424 void RenderWidgetHostViewAndroid::StartObservingRootWindow() { | 1424 void RenderWidgetHostViewAndroid::StartObservingRootWindow() { |
| 1425 DCHECK(content_view_core_); | 1425 DCHECK(content_view_core_); |
| 1426 // TODO(yusufo): This will need to have a better fallback for cases where | 1426 // TODO(yusufo): This will need to have a better fallback for cases where |
| 1427 // setContentViewCore is called with a valid ContentViewCore without a window. | 1427 // setContentViewCore is called with a valid ContentViewCore without a window. |
| 1428 DCHECK(content_view_core_->GetWindowAndroid()); | 1428 DCHECK(content_view_core_->GetWindowAndroid()); |
| 1429 DCHECK(is_showing_); | 1429 DCHECK(is_showing_); |
| 1430 if (observing_root_window_) | 1430 if (observing_root_window_) |
| 1431 return; | 1431 return; |
| 1432 | 1432 |
| 1433 observing_root_window_ = true; | 1433 observing_root_window_ = true; |
| 1434 if (host_) | |
| 1435 host_->Send(new ViewMsg_SetBeginFramePaused(host_->GetRoutingID(), false)); | |
| 1434 content_view_core_->GetWindowAndroid()->AddObserver(this); | 1436 content_view_core_->GetWindowAndroid()->AddObserver(this); |
| 1435 | 1437 |
| 1436 // Clear existing vsync requests to allow a request to the new window. | 1438 // Clear existing vsync requests to allow a request to the new window. |
| 1437 uint32_t outstanding_vsync_requests = outstanding_vsync_requests_; | 1439 uint32_t outstanding_vsync_requests = outstanding_vsync_requests_; |
| 1438 outstanding_vsync_requests_ = 0; | 1440 outstanding_vsync_requests_ = 0; |
| 1439 RequestVSyncUpdate(outstanding_vsync_requests); | 1441 RequestVSyncUpdate(outstanding_vsync_requests); |
| 1440 } | 1442 } |
| 1441 | 1443 |
| 1442 void RenderWidgetHostViewAndroid::StopObservingRootWindow() { | 1444 void RenderWidgetHostViewAndroid::StopObservingRootWindow() { |
| 1443 if (!content_view_core_ || !(content_view_core_->GetWindowAndroid())) { | 1445 if (!content_view_core_ || !(content_view_core_->GetWindowAndroid())) { |
| 1444 DCHECK(!observing_root_window_); | 1446 DCHECK(!observing_root_window_); |
| 1445 return; | 1447 return; |
| 1446 } | 1448 } |
| 1447 | 1449 |
| 1448 if (!observing_root_window_) | 1450 if (!observing_root_window_) |
| 1449 return; | 1451 return; |
| 1450 | 1452 |
| 1451 // Reset window state variables to their defaults. | 1453 // Reset window state variables to their defaults. |
| 1452 is_window_activity_started_ = true; | 1454 is_window_activity_started_ = true; |
| 1453 is_window_visible_ = true; | 1455 is_window_visible_ = true; |
| 1454 observing_root_window_ = false; | 1456 observing_root_window_ = false; |
| 1457 if (host_) | |
| 1458 host_->Send(new ViewMsg_SetBeginFramePaused(host_->GetRoutingID(), true)); | |
|
enne (OOO)
2016/05/16 17:22:30
Does StopObservingRootWindow (and this set begin f
boliu
2016/05/16 17:27:01
Good question. Looks yes:
~RenderWidgetHostViewAn
| |
| 1455 content_view_core_->GetWindowAndroid()->RemoveObserver(this); | 1459 content_view_core_->GetWindowAndroid()->RemoveObserver(this); |
| 1456 } | 1460 } |
| 1457 | 1461 |
| 1458 void RenderWidgetHostViewAndroid::SendBeginFrame(base::TimeTicks frame_time, | 1462 void RenderWidgetHostViewAndroid::SendBeginFrame(base::TimeTicks frame_time, |
| 1459 base::TimeDelta vsync_period) { | 1463 base::TimeDelta vsync_period) { |
| 1460 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SendBeginFrame", | 1464 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SendBeginFrame", |
| 1461 "frame_time_us", frame_time.ToInternalValue()); | 1465 "frame_time_us", frame_time.ToInternalValue()); |
| 1462 | 1466 |
| 1463 if (using_browser_compositor_) { | 1467 if (using_browser_compositor_) { |
| 1464 // TODO(brianderson): Replace this hardcoded deadline after Android | 1468 // TODO(brianderson): Replace this hardcoded deadline after Android |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2019 results->orientationAngle = display.RotationAsDegree(); | 2023 results->orientationAngle = display.RotationAsDegree(); |
| 2020 results->orientationType = | 2024 results->orientationType = |
| 2021 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2025 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 2022 gfx::DeviceDisplayInfo info; | 2026 gfx::DeviceDisplayInfo info; |
| 2023 results->depth = info.GetBitsPerPixel(); | 2027 results->depth = info.GetBitsPerPixel(); |
| 2024 results->depthPerComponent = info.GetBitsPerComponent(); | 2028 results->depthPerComponent = info.GetBitsPerComponent(); |
| 2025 results->isMonochrome = (results->depthPerComponent == 0); | 2029 results->isMonochrome = (results->depthPerComponent == 0); |
| 2026 } | 2030 } |
| 2027 | 2031 |
| 2028 } // namespace content | 2032 } // namespace content |
| OLD | NEW |