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(), | |
1436 !observing_root_window_)); | |
sunnyps
2016/05/14 00:56:02
nit: Change !observing_root_window_ to false.
| |
1437 } | |
1434 content_view_core_->GetWindowAndroid()->AddObserver(this); | 1438 content_view_core_->GetWindowAndroid()->AddObserver(this); |
1435 | 1439 |
1436 // Clear existing vsync requests to allow a request to the new window. | 1440 // Clear existing vsync requests to allow a request to the new window. |
1437 uint32_t outstanding_vsync_requests = outstanding_vsync_requests_; | 1441 uint32_t outstanding_vsync_requests = outstanding_vsync_requests_; |
1438 outstanding_vsync_requests_ = 0; | 1442 outstanding_vsync_requests_ = 0; |
1439 RequestVSyncUpdate(outstanding_vsync_requests); | 1443 RequestVSyncUpdate(outstanding_vsync_requests); |
1440 } | 1444 } |
1441 | 1445 |
1442 void RenderWidgetHostViewAndroid::StopObservingRootWindow() { | 1446 void RenderWidgetHostViewAndroid::StopObservingRootWindow() { |
1443 if (!content_view_core_ || !(content_view_core_->GetWindowAndroid())) { | 1447 if (!content_view_core_ || !(content_view_core_->GetWindowAndroid())) { |
1444 DCHECK(!observing_root_window_); | 1448 DCHECK(!observing_root_window_); |
1445 return; | 1449 return; |
1446 } | 1450 } |
1447 | 1451 |
1448 if (!observing_root_window_) | 1452 if (!observing_root_window_) |
1449 return; | 1453 return; |
1450 | 1454 |
1451 // Reset window state variables to their defaults. | 1455 // Reset window state variables to their defaults. |
1452 is_window_activity_started_ = true; | 1456 is_window_activity_started_ = true; |
1453 is_window_visible_ = true; | 1457 is_window_visible_ = true; |
1454 observing_root_window_ = false; | 1458 observing_root_window_ = false; |
1459 if (host_) { | |
1460 host_->Send(new ViewMsg_SetBeginFramePaused(host_->GetRoutingID(), | |
1461 !observing_root_window_)); | |
sunnyps
2016/05/14 00:56:02
nit: Change !observing_root_window_ to true.
| |
1462 } | |
1455 content_view_core_->GetWindowAndroid()->RemoveObserver(this); | 1463 content_view_core_->GetWindowAndroid()->RemoveObserver(this); |
1456 } | 1464 } |
1457 | 1465 |
1458 void RenderWidgetHostViewAndroid::SendBeginFrame(base::TimeTicks frame_time, | 1466 void RenderWidgetHostViewAndroid::SendBeginFrame(base::TimeTicks frame_time, |
1459 base::TimeDelta vsync_period) { | 1467 base::TimeDelta vsync_period) { |
1460 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SendBeginFrame", | 1468 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SendBeginFrame", |
1461 "frame_time_us", frame_time.ToInternalValue()); | 1469 "frame_time_us", frame_time.ToInternalValue()); |
1462 | 1470 |
1463 if (using_browser_compositor_) { | 1471 if (using_browser_compositor_) { |
1464 // TODO(brianderson): Replace this hardcoded deadline after Android | 1472 // 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(); | 2027 results->orientationAngle = display.RotationAsDegree(); |
2020 results->orientationType = | 2028 results->orientationType = |
2021 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2029 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
2022 gfx::DeviceDisplayInfo info; | 2030 gfx::DeviceDisplayInfo info; |
2023 results->depth = info.GetBitsPerPixel(); | 2031 results->depth = info.GetBitsPerPixel(); |
2024 results->depthPerComponent = info.GetBitsPerComponent(); | 2032 results->depthPerComponent = info.GetBitsPerComponent(); |
2025 results->isMonochrome = (results->depthPerComponent == 0); | 2033 results->isMonochrome = (results->depthPerComponent == 0); |
2026 } | 2034 } |
2027 | 2035 |
2028 } // namespace content | 2036 } // namespace content |
OLD | NEW |