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

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

Issue 1408123005: Android Webview IPC-based sync compositing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 1 month 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 "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 18 matching lines...) Expand all
29 #include "cc/output/viewport_selection_bound.h" 29 #include "cc/output/viewport_selection_bound.h"
30 #include "cc/resources/single_release_callback.h" 30 #include "cc/resources/single_release_callback.h"
31 #include "cc/surfaces/surface.h" 31 #include "cc/surfaces/surface.h"
32 #include "cc/surfaces/surface_factory.h" 32 #include "cc/surfaces/surface_factory.h"
33 #include "cc/surfaces/surface_id_allocator.h" 33 #include "cc/surfaces/surface_id_allocator.h"
34 #include "cc/surfaces/surface_manager.h" 34 #include "cc/surfaces/surface_manager.h"
35 #include "cc/trees/layer_tree_host.h" 35 #include "cc/trees/layer_tree_host.h"
36 #include "content/browser/accessibility/browser_accessibility_manager_android.h" 36 #include "content/browser/accessibility/browser_accessibility_manager_android.h"
37 #include "content/browser/android/composited_touch_handle_drawable.h" 37 #include "content/browser/android/composited_touch_handle_drawable.h"
38 #include "content/browser/android/content_view_core_impl.h" 38 #include "content/browser/android/content_view_core_impl.h"
39 #include "content/browser/android/in_process/synchronous_compositor_impl.h"
40 #include "content/browser/android/overscroll_controller_android.h" 39 #include "content/browser/android/overscroll_controller_android.h"
41 #include "content/browser/android/popup_touch_handle_drawable.h" 40 #include "content/browser/android/popup_touch_handle_drawable.h"
41 #include "content/browser/android/synchronous_compositor_base.h"
42 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 42 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
43 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 43 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
44 #include "content/browser/gpu/compositor_util.h" 44 #include "content/browser/gpu/compositor_util.h"
45 #include "content/browser/gpu/gpu_data_manager_impl.h" 45 #include "content/browser/gpu/gpu_data_manager_impl.h"
46 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 46 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
47 #include "content/browser/media/media_web_contents_observer.h" 47 #include "content/browser/media/media_web_contents_observer.h"
48 #include "content/browser/renderer_host/compositor_impl_android.h" 48 #include "content/browser/renderer_host/compositor_impl_android.h"
49 #include "content/browser/renderer_host/dip_util.h" 49 #include "content/browser/renderer_host/dip_util.h"
50 #include "content/browser/renderer_host/frame_metadata_util.h" 50 #include "content/browser/renderer_host/frame_metadata_util.h"
51 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h " 51 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h "
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } 349 }
350 350
351 void RenderWidgetHostViewAndroid::Blur() { 351 void RenderWidgetHostViewAndroid::Blur() {
352 host_->Blur(); 352 host_->Blur();
353 if (overscroll_controller_) 353 if (overscroll_controller_)
354 overscroll_controller_->Disable(); 354 overscroll_controller_->Disable();
355 } 355 }
356 356
357 bool RenderWidgetHostViewAndroid::OnMessageReceived( 357 bool RenderWidgetHostViewAndroid::OnMessageReceived(
358 const IPC::Message& message) { 358 const IPC::Message& message) {
359 if (SyncCompositorOnMessageReceived(message)) {
no sievers 2015/10/29 01:37:00 can you do a IPC_MESSAGE_ID_CLASS(message.type())
boliu 2015/10/29 04:24:43 Done.
360 return true;
361 }
359 bool handled = true; 362 bool handled = true;
360 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) 363 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message)
361 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent) 364 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent)
362 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames, 365 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames,
363 OnSetNeedsBeginFrames) 366 OnSetNeedsBeginFrames)
364 IPC_MESSAGE_HANDLER(ViewHostMsg_SmartClipDataExtracted, 367 IPC_MESSAGE_HANDLER(ViewHostMsg_SmartClipDataExtracted,
365 OnSmartClipDataExtracted) 368 OnSmartClipDataExtracted)
366 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, 369 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded,
367 OnShowUnhandledTapUIIfNeeded) 370 OnShowUnhandledTapUIIfNeeded)
368 IPC_MESSAGE_UNHANDLED(handled = false) 371 IPC_MESSAGE_UNHANDLED(handled = false)
369 IPC_END_MESSAGE_MAP() 372 IPC_END_MESSAGE_MAP()
370 return handled; 373 return handled;
371 } 374 }
372 375
376 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived(
377 const IPC::Message& message) {
378 return sync_compositor_ && sync_compositor_->OnMessageReceived(message);
379 }
380
373 void RenderWidgetHostViewAndroid::InitAsChild(gfx::NativeView parent_view) { 381 void RenderWidgetHostViewAndroid::InitAsChild(gfx::NativeView parent_view) {
374 NOTIMPLEMENTED(); 382 NOTIMPLEMENTED();
375 } 383 }
376 384
377 void RenderWidgetHostViewAndroid::InitAsPopup( 385 void RenderWidgetHostViewAndroid::InitAsPopup(
378 RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) { 386 RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) {
379 NOTIMPLEMENTED(); 387 NOTIMPLEMENTED();
380 } 388 }
381 389
382 void RenderWidgetHostViewAndroid::InitAsFullscreen( 390 void RenderWidgetHostViewAndroid::InitAsFullscreen(
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 base::Bind(&RenderWidgetHostViewAndroid::SendDelegatedFrameAck, 1180 base::Bind(&RenderWidgetHostViewAndroid::SendDelegatedFrameAck,
1173 weak_ptr_factory_.GetWeakPtr(), 1181 weak_ptr_factory_.GetWeakPtr(),
1174 last_frame_info_->output_surface_id); 1182 last_frame_info_->output_surface_id);
1175 1183
1176 ack_callbacks_.push(ack_callback); 1184 ack_callbacks_.push(ack_callback);
1177 } 1185 }
1178 1186
1179 last_frame_info_.reset(new LastFrameInfo(output_surface_id, frame.Pass())); 1187 last_frame_info_.reset(new LastFrameInfo(output_surface_id, frame.Pass()));
1180 } 1188 }
1181 1189
1182 SynchronousCompositorImpl* 1190 SynchronousCompositorBase*
1183 RenderWidgetHostViewAndroid::GetSynchronousCompositorImpl() { 1191 RenderWidgetHostViewAndroid::GetSynchronousCompositor() {
1184 return sync_compositor_.get(); 1192 return sync_compositor_.get();
1185 } 1193 }
1186 1194
1187 void RenderWidgetHostViewAndroid::SynchronousFrameMetadata( 1195 void RenderWidgetHostViewAndroid::SynchronousFrameMetadata(
1188 const cc::CompositorFrameMetadata& frame_metadata) { 1196 const cc::CompositorFrameMetadata& frame_metadata) {
1189 if (!content_view_core_) 1197 if (!content_view_core_)
1190 return; 1198 return;
1191 1199
1192 // This is a subset of OnSwapCompositorFrame() used in the synchronous 1200 // This is a subset of OnSwapCompositorFrame() used in the synchronous
1193 // compositor flow. 1201 // compositor flow.
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 1813
1806 if (!selection_controller_) 1814 if (!selection_controller_)
1807 selection_controller_ = CreateSelectionController(this, content_view_core_); 1815 selection_controller_ = CreateSelectionController(this, content_view_core_);
1808 1816
1809 if (!overscroll_controller_ && 1817 if (!overscroll_controller_ &&
1810 content_view_core_window_android_->GetCompositor()) { 1818 content_view_core_window_android_->GetCompositor()) {
1811 overscroll_controller_ = CreateOverscrollController(content_view_core_); 1819 overscroll_controller_ = CreateOverscrollController(content_view_core_);
1812 } 1820 }
1813 1821
1814 if (!sync_compositor_) { 1822 if (!sync_compositor_) {
1815 sync_compositor_ = SynchronousCompositorImpl::Create( 1823 sync_compositor_ = SynchronousCompositorBase::Create(
1816 this, content_view_core_->GetWebContents()); 1824 this, content_view_core_->GetWebContents());
1817 } 1825 }
1818 } 1826 }
1819 1827
1820 void RenderWidgetHostViewAndroid::RunAckCallbacks( 1828 void RenderWidgetHostViewAndroid::RunAckCallbacks(
1821 cc::SurfaceDrawStatus status) { 1829 cc::SurfaceDrawStatus status) {
1822 while (!ack_callbacks_.empty()) { 1830 while (!ack_callbacks_.empty()) {
1823 ack_callbacks_.front().Run(); 1831 ack_callbacks_.front().Run();
1824 ack_callbacks_.pop(); 1832 ack_callbacks_.pop();
1825 } 1833 }
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 results->orientationAngle = display.RotationAsDegree(); 2051 results->orientationAngle = display.RotationAsDegree();
2044 results->orientationType = 2052 results->orientationType =
2045 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 2053 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
2046 gfx::DeviceDisplayInfo info; 2054 gfx::DeviceDisplayInfo info;
2047 results->depth = info.GetBitsPerPixel(); 2055 results->depth = info.GetBitsPerPixel();
2048 results->depthPerComponent = info.GetBitsPerComponent(); 2056 results->depthPerComponent = info.GetBitsPerComponent();
2049 results->isMonochrome = (results->depthPerComponent == 0); 2057 results->isMonochrome = (results->depthPerComponent == 0);
2050 } 2058 }
2051 2059
2052 } // namespace content 2060 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698