Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2382873002: Replace usage of SurfaceId's client_id with FrameSinkId (Closed)
Patch Set: Rebased Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 content_view_core_->GetWindowAndroid()->AddObserver(this); 1384 content_view_core_->GetWindowAndroid()->AddObserver(this);
1385 1385
1386 // Clear existing vsync requests to allow a request to the new window. 1386 // Clear existing vsync requests to allow a request to the new window.
1387 uint32_t outstanding_vsync_requests = outstanding_vsync_requests_; 1387 uint32_t outstanding_vsync_requests = outstanding_vsync_requests_;
1388 outstanding_vsync_requests_ = 0; 1388 outstanding_vsync_requests_ = 0;
1389 RequestVSyncUpdate(outstanding_vsync_requests); 1389 RequestVSyncUpdate(outstanding_vsync_requests);
1390 1390
1391 ui::WindowAndroidCompositor* compositor = 1391 ui::WindowAndroidCompositor* compositor =
1392 content_view_core_->GetWindowAndroid()->GetCompositor(); 1392 content_view_core_->GetWindowAndroid()->GetCompositor();
1393 if (compositor) { 1393 if (compositor) {
1394 delegated_frame_host_->RegisterSurfaceNamespaceHierarchy( 1394 delegated_frame_host_->RegisterFrameSinkHierarchy(
1395 compositor->GetSurfaceClientId()); 1395 compositor->GetFrameSinkId());
1396 } 1396 }
1397 } 1397 }
1398 1398
1399 void RenderWidgetHostViewAndroid::StopObservingRootWindow() { 1399 void RenderWidgetHostViewAndroid::StopObservingRootWindow() {
1400 if (!content_view_core_ || !(content_view_core_->GetWindowAndroid())) { 1400 if (!content_view_core_ || !(content_view_core_->GetWindowAndroid())) {
1401 DCHECK(!observing_root_window_); 1401 DCHECK(!observing_root_window_);
1402 return; 1402 return;
1403 } 1403 }
1404 1404
1405 if (!observing_root_window_) 1405 if (!observing_root_window_)
1406 return; 1406 return;
1407 1407
1408 // Reset window state variables to their defaults. 1408 // Reset window state variables to their defaults.
1409 is_window_activity_started_ = true; 1409 is_window_activity_started_ = true;
1410 is_window_visible_ = true; 1410 is_window_visible_ = true;
1411 observing_root_window_ = false; 1411 observing_root_window_ = false;
1412 if (host_) 1412 if (host_)
1413 host_->Send(new ViewMsg_SetBeginFramePaused(host_->GetRoutingID(), true)); 1413 host_->Send(new ViewMsg_SetBeginFramePaused(host_->GetRoutingID(), true));
1414 content_view_core_->GetWindowAndroid()->RemoveObserver(this); 1414 content_view_core_->GetWindowAndroid()->RemoveObserver(this);
1415 // If the DFH has already been destroyed, it will have cleaned itself up. 1415 // If the DFH has already been destroyed, it will have cleaned itself up.
1416 // This happens in some WebView cases. 1416 // This happens in some WebView cases.
1417 if (delegated_frame_host_) 1417 if (delegated_frame_host_)
1418 delegated_frame_host_->UnregisterSurfaceNamespaceHierarchy(); 1418 delegated_frame_host_->UnregisterFrameSinkHierarchy();
1419 } 1419 }
1420 1420
1421 void RenderWidgetHostViewAndroid::SendBeginFrame(base::TimeTicks frame_time, 1421 void RenderWidgetHostViewAndroid::SendBeginFrame(base::TimeTicks frame_time,
1422 base::TimeDelta vsync_period) { 1422 base::TimeDelta vsync_period) {
1423 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SendBeginFrame", 1423 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SendBeginFrame",
1424 "frame_time_us", frame_time.ToInternalValue()); 1424 "frame_time_us", frame_time.ToInternalValue());
1425 1425
1426 // Synchronous compositor does not use deadline-based scheduling. 1426 // Synchronous compositor does not use deadline-based scheduling.
1427 // TODO(brianderson): Replace this hardcoded deadline after Android 1427 // TODO(brianderson): Replace this hardcoded deadline after Android
1428 // switches to Surfaces and the Browser's commit isn't in the critcal path. 1428 // switches to Surfaces and the Browser's commit isn't in the critcal path.
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 1666
1667 if (overscroll_controller_) 1667 if (overscroll_controller_)
1668 overscroll_controller_->OnOverscrolled(params); 1668 overscroll_controller_->OnOverscrolled(params);
1669 } 1669 }
1670 1670
1671 void RenderWidgetHostViewAndroid::DidStopFlinging() { 1671 void RenderWidgetHostViewAndroid::DidStopFlinging() {
1672 if (content_view_core_) 1672 if (content_view_core_)
1673 content_view_core_->DidStopFlinging(); 1673 content_view_core_->DidStopFlinging();
1674 } 1674 }
1675 1675
1676 uint32_t RenderWidgetHostViewAndroid::GetSurfaceClientId() { 1676 cc::FrameSinkId RenderWidgetHostViewAndroid::GetFrameSinkId() {
1677 if (!delegated_frame_host_) 1677 if (!delegated_frame_host_)
1678 return 0; 1678 return cc::FrameSinkId();
1679 1679
1680 return delegated_frame_host_->GetSurfaceClientId(); 1680 return delegated_frame_host_->GetFrameSinkId();
1681 } 1681 }
1682 1682
1683 void RenderWidgetHostViewAndroid::SetContentViewCore( 1683 void RenderWidgetHostViewAndroid::SetContentViewCore(
1684 ContentViewCoreImpl* content_view_core) { 1684 ContentViewCoreImpl* content_view_core) {
1685 DCHECK(!content_view_core || !content_view_core_ || 1685 DCHECK(!content_view_core || !content_view_core_ ||
1686 (content_view_core_ == content_view_core)); 1686 (content_view_core_ == content_view_core));
1687 StopObservingRootWindow(); 1687 StopObservingRootWindow();
1688 1688
1689 bool resize = false; 1689 bool resize = false;
1690 if (content_view_core != content_view_core_) { 1690 if (content_view_core != content_view_core_) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 OnDetachCompositor(); 1807 OnDetachCompositor();
1808 } 1808 }
1809 1809
1810 void RenderWidgetHostViewAndroid::OnAttachCompositor() { 1810 void RenderWidgetHostViewAndroid::OnAttachCompositor() {
1811 DCHECK(content_view_core_); 1811 DCHECK(content_view_core_);
1812 if (!overscroll_controller_) 1812 if (!overscroll_controller_)
1813 overscroll_controller_ = CreateOverscrollController( 1813 overscroll_controller_ = CreateOverscrollController(
1814 content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView())); 1814 content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView()));
1815 ui::WindowAndroidCompositor* compositor = 1815 ui::WindowAndroidCompositor* compositor =
1816 content_view_core_->GetWindowAndroid()->GetCompositor(); 1816 content_view_core_->GetWindowAndroid()->GetCompositor();
1817 delegated_frame_host_->RegisterSurfaceNamespaceHierarchy( 1817 delegated_frame_host_->RegisterFrameSinkHierarchy(
1818 compositor->GetSurfaceClientId()); 1818 compositor->GetFrameSinkId());
1819 } 1819 }
1820 1820
1821 void RenderWidgetHostViewAndroid::OnDetachCompositor() { 1821 void RenderWidgetHostViewAndroid::OnDetachCompositor() {
1822 DCHECK(content_view_core_); 1822 DCHECK(content_view_core_);
1823 DCHECK(using_browser_compositor_); 1823 DCHECK(using_browser_compositor_);
1824 RunAckCallbacks(); 1824 RunAckCallbacks();
1825 overscroll_controller_.reset(); 1825 overscroll_controller_.reset();
1826 delegated_frame_host_->UnregisterSurfaceNamespaceHierarchy(); 1826 delegated_frame_host_->UnregisterFrameSinkHierarchy();
1827 } 1827 }
1828 1828
1829 void RenderWidgetHostViewAndroid::OnVSync(base::TimeTicks frame_time, 1829 void RenderWidgetHostViewAndroid::OnVSync(base::TimeTicks frame_time,
1830 base::TimeDelta vsync_period) { 1830 base::TimeDelta vsync_period) {
1831 TRACE_EVENT0("cc,benchmark", "RenderWidgetHostViewAndroid::OnVSync"); 1831 TRACE_EVENT0("cc,benchmark", "RenderWidgetHostViewAndroid::OnVSync");
1832 if (!host_) 1832 if (!host_)
1833 return; 1833 return;
1834 1834
1835 if (outstanding_vsync_requests_ & FLUSH_INPUT) { 1835 if (outstanding_vsync_requests_ & FLUSH_INPUT) {
1836 outstanding_vsync_requests_ &= ~FLUSH_INPUT; 1836 outstanding_vsync_requests_ &= ~FLUSH_INPUT;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 case ui::MotionEvent::ACTION_UP: 1980 case ui::MotionEvent::ACTION_UP:
1981 case ui::MotionEvent::ACTION_POINTER_UP: 1981 case ui::MotionEvent::ACTION_POINTER_UP:
1982 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", 1982 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED",
1983 delta.InMicroseconds(), 1, 1000000, 50); 1983 delta.InMicroseconds(), 1, 1000000, 50);
1984 default: 1984 default:
1985 return; 1985 return;
1986 } 1986 }
1987 } 1987 }
1988 1988
1989 } // namespace content 1989 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698