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 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1296 | 1296 |
| 1297 observing_root_window_ = true; | 1297 observing_root_window_ = true; |
| 1298 if (host_) | 1298 if (host_) |
| 1299 host_->Send(new ViewMsg_SetBeginFramePaused(host_->GetRoutingID(), false)); | 1299 host_->Send(new ViewMsg_SetBeginFramePaused(host_->GetRoutingID(), false)); |
| 1300 content_view_core_->GetWindowAndroid()->AddObserver(this); | 1300 content_view_core_->GetWindowAndroid()->AddObserver(this); |
| 1301 | 1301 |
| 1302 // Clear existing vsync requests to allow a request to the new window. | 1302 // Clear existing vsync requests to allow a request to the new window. |
| 1303 uint32_t outstanding_vsync_requests = outstanding_vsync_requests_; | 1303 uint32_t outstanding_vsync_requests = outstanding_vsync_requests_; |
| 1304 outstanding_vsync_requests_ = 0; | 1304 outstanding_vsync_requests_ = 0; |
| 1305 RequestVSyncUpdate(outstanding_vsync_requests); | 1305 RequestVSyncUpdate(outstanding_vsync_requests); |
| 1306 | |
| 1307 ui::WindowAndroidCompositor* compositor = | |
| 1308 content_view_core_->GetWindowAndroid()->GetCompositor(); | |
|
enne (OOO)
2016/09/23 22:58:09
Can I assume that there's always a compositor at t
no sievers
2016/09/23 23:16:09
I don't trust the logic here with 'observing' but
| |
| 1309 delegated_frame_host_->RegisterSurfaceNamespaceHierarchy( | |
| 1310 compositor->GetSurfaceClientId()); | |
| 1306 } | 1311 } |
| 1307 | 1312 |
| 1308 void RenderWidgetHostViewAndroid::StopObservingRootWindow() { | 1313 void RenderWidgetHostViewAndroid::StopObservingRootWindow() { |
| 1309 if (!content_view_core_ || !(content_view_core_->GetWindowAndroid())) { | 1314 if (!content_view_core_ || !(content_view_core_->GetWindowAndroid())) { |
| 1310 DCHECK(!observing_root_window_); | 1315 DCHECK(!observing_root_window_); |
| 1311 return; | 1316 return; |
| 1312 } | 1317 } |
| 1313 | 1318 |
| 1314 if (!observing_root_window_) | 1319 if (!observing_root_window_) |
| 1315 return; | 1320 return; |
| 1316 | 1321 |
| 1317 // Reset window state variables to their defaults. | 1322 // Reset window state variables to their defaults. |
| 1318 is_window_activity_started_ = true; | 1323 is_window_activity_started_ = true; |
| 1319 is_window_visible_ = true; | 1324 is_window_visible_ = true; |
| 1320 observing_root_window_ = false; | 1325 observing_root_window_ = false; |
| 1321 if (host_) | 1326 if (host_) |
| 1322 host_->Send(new ViewMsg_SetBeginFramePaused(host_->GetRoutingID(), true)); | 1327 host_->Send(new ViewMsg_SetBeginFramePaused(host_->GetRoutingID(), true)); |
| 1323 content_view_core_->GetWindowAndroid()->RemoveObserver(this); | 1328 content_view_core_->GetWindowAndroid()->RemoveObserver(this); |
| 1329 delegated_frame_host_->UnregisterSurfaceNamespaceHierarchy(); | |
| 1324 } | 1330 } |
| 1325 | 1331 |
| 1326 void RenderWidgetHostViewAndroid::SendBeginFrame(base::TimeTicks frame_time, | 1332 void RenderWidgetHostViewAndroid::SendBeginFrame(base::TimeTicks frame_time, |
| 1327 base::TimeDelta vsync_period) { | 1333 base::TimeDelta vsync_period) { |
| 1328 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SendBeginFrame", | 1334 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SendBeginFrame", |
| 1329 "frame_time_us", frame_time.ToInternalValue()); | 1335 "frame_time_us", frame_time.ToInternalValue()); |
| 1330 | 1336 |
| 1331 // Synchronous compositor does not use deadline-based scheduling. | 1337 // Synchronous compositor does not use deadline-based scheduling. |
| 1332 // TODO(brianderson): Replace this hardcoded deadline after Android | 1338 // TODO(brianderson): Replace this hardcoded deadline after Android |
| 1333 // switches to Surfaces and the Browser's commit isn't in the critcal path. | 1339 // switches to Surfaces and the Browser's commit isn't in the critcal path. |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1880 case ui::MotionEvent::ACTION_UP: | 1886 case ui::MotionEvent::ACTION_UP: |
| 1881 case ui::MotionEvent::ACTION_POINTER_UP: | 1887 case ui::MotionEvent::ACTION_POINTER_UP: |
| 1882 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1888 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
| 1883 delta.InMicroseconds(), 1, 1000000, 50); | 1889 delta.InMicroseconds(), 1, 1000000, 50); |
| 1884 default: | 1890 default: |
| 1885 return; | 1891 return; |
| 1886 } | 1892 } |
| 1887 } | 1893 } |
| 1888 | 1894 |
| 1889 } // namespace content | 1895 } // namespace content |
| OLD | NEW |