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

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: fix win compile 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 12 matching lines...) Expand all
64 #include "content/common/view_messages.h" 64 #include "content/common/view_messages.h"
65 #include "content/public/browser/android/compositor.h" 65 #include "content/public/browser/android/compositor.h"
66 #include "content/public/browser/browser_thread.h" 66 #include "content/public/browser/browser_thread.h"
67 #include "content/public/browser/devtools_agent_host.h" 67 #include "content/public/browser/devtools_agent_host.h"
68 #include "content/public/browser/render_view_host.h" 68 #include "content/public/browser/render_view_host.h"
69 #include "content/public/browser/render_widget_host_iterator.h" 69 #include "content/public/browser/render_widget_host_iterator.h"
70 #include "content/public/common/content_switches.h" 70 #include "content/public/common/content_switches.h"
71 #include "gpu/command_buffer/client/gles2_implementation.h" 71 #include "gpu/command_buffer/client/gles2_implementation.h"
72 #include "gpu/command_buffer/client/gles2_interface.h" 72 #include "gpu/command_buffer/client/gles2_interface.h"
73 #include "gpu/config/gpu_driver_bug_workaround_type.h" 73 #include "gpu/config/gpu_driver_bug_workaround_type.h"
74 #include "ipc/ipc_message_macros.h"
75 #include "ipc/ipc_message_start.h"
74 #include "skia/ext/image_operations.h" 76 #include "skia/ext/image_operations.h"
75 #include "third_party/khronos/GLES2/gl2.h" 77 #include "third_party/khronos/GLES2/gl2.h"
76 #include "third_party/khronos/GLES2/gl2ext.h" 78 #include "third_party/khronos/GLES2/gl2ext.h"
77 #include "third_party/skia/include/core/SkCanvas.h" 79 #include "third_party/skia/include/core/SkCanvas.h"
78 #include "ui/android/window_android.h" 80 #include "ui/android/window_android.h"
79 #include "ui/android/window_android_compositor.h" 81 #include "ui/android/window_android_compositor.h"
80 #include "ui/events/blink/blink_event_util.h" 82 #include "ui/events/blink/blink_event_util.h"
81 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" 83 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
82 #include "ui/events/gesture_detection/motion_event.h" 84 #include "ui/events/gesture_detection/motion_event.h"
83 #include "ui/gfx/android/device_display_info.h" 85 #include "ui/gfx/android/device_display_info.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } 351 }
350 352
351 void RenderWidgetHostViewAndroid::Blur() { 353 void RenderWidgetHostViewAndroid::Blur() {
352 host_->Blur(); 354 host_->Blur();
353 if (overscroll_controller_) 355 if (overscroll_controller_)
354 overscroll_controller_->Disable(); 356 overscroll_controller_->Disable();
355 } 357 }
356 358
357 bool RenderWidgetHostViewAndroid::OnMessageReceived( 359 bool RenderWidgetHostViewAndroid::OnMessageReceived(
358 const IPC::Message& message) { 360 const IPC::Message& message) {
361 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) {
362 bool handled = SyncCompositorOnMessageReceived(message);
363 DCHECK(handled);
364 return handled;
365 }
359 bool handled = true; 366 bool handled = true;
360 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) 367 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message)
361 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent) 368 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent)
362 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames, 369 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames,
363 OnSetNeedsBeginFrames) 370 OnSetNeedsBeginFrames)
364 IPC_MESSAGE_HANDLER(ViewHostMsg_SmartClipDataExtracted, 371 IPC_MESSAGE_HANDLER(ViewHostMsg_SmartClipDataExtracted,
365 OnSmartClipDataExtracted) 372 OnSmartClipDataExtracted)
366 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, 373 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded,
367 OnShowUnhandledTapUIIfNeeded) 374 OnShowUnhandledTapUIIfNeeded)
368 IPC_MESSAGE_UNHANDLED(handled = false) 375 IPC_MESSAGE_UNHANDLED(handled = false)
369 IPC_END_MESSAGE_MAP() 376 IPC_END_MESSAGE_MAP()
370 return handled; 377 return handled;
371 } 378 }
372 379
380 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived(
381 const IPC::Message& message) {
382 return sync_compositor_ && sync_compositor_->OnMessageReceived(message);
383 }
384
373 void RenderWidgetHostViewAndroid::InitAsChild(gfx::NativeView parent_view) { 385 void RenderWidgetHostViewAndroid::InitAsChild(gfx::NativeView parent_view) {
374 NOTIMPLEMENTED(); 386 NOTIMPLEMENTED();
375 } 387 }
376 388
377 void RenderWidgetHostViewAndroid::InitAsPopup( 389 void RenderWidgetHostViewAndroid::InitAsPopup(
378 RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) { 390 RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) {
379 NOTIMPLEMENTED(); 391 NOTIMPLEMENTED();
380 } 392 }
381 393
382 void RenderWidgetHostViewAndroid::InitAsFullscreen( 394 void RenderWidgetHostViewAndroid::InitAsFullscreen(
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 base::Bind(&RenderWidgetHostViewAndroid::SendDelegatedFrameAck, 1184 base::Bind(&RenderWidgetHostViewAndroid::SendDelegatedFrameAck,
1173 weak_ptr_factory_.GetWeakPtr(), 1185 weak_ptr_factory_.GetWeakPtr(),
1174 last_frame_info_->output_surface_id); 1186 last_frame_info_->output_surface_id);
1175 1187
1176 ack_callbacks_.push(ack_callback); 1188 ack_callbacks_.push(ack_callback);
1177 } 1189 }
1178 1190
1179 last_frame_info_.reset(new LastFrameInfo(output_surface_id, frame.Pass())); 1191 last_frame_info_.reset(new LastFrameInfo(output_surface_id, frame.Pass()));
1180 } 1192 }
1181 1193
1182 SynchronousCompositorImpl* 1194 SynchronousCompositorBase*
1183 RenderWidgetHostViewAndroid::GetSynchronousCompositorImpl() { 1195 RenderWidgetHostViewAndroid::GetSynchronousCompositor() {
1184 return sync_compositor_.get(); 1196 return sync_compositor_.get();
1185 } 1197 }
1186 1198
1187 void RenderWidgetHostViewAndroid::SynchronousFrameMetadata( 1199 void RenderWidgetHostViewAndroid::SynchronousFrameMetadata(
1188 const cc::CompositorFrameMetadata& frame_metadata) { 1200 const cc::CompositorFrameMetadata& frame_metadata) {
1189 if (!content_view_core_) 1201 if (!content_view_core_)
1190 return; 1202 return;
1191 1203
1192 // This is a subset of OnSwapCompositorFrame() used in the synchronous 1204 // This is a subset of OnSwapCompositorFrame() used in the synchronous
1193 // compositor flow. 1205 // compositor flow.
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 1817
1806 if (!selection_controller_) 1818 if (!selection_controller_)
1807 selection_controller_ = CreateSelectionController(this, content_view_core_); 1819 selection_controller_ = CreateSelectionController(this, content_view_core_);
1808 1820
1809 if (!overscroll_controller_ && 1821 if (!overscroll_controller_ &&
1810 content_view_core_window_android_->GetCompositor()) { 1822 content_view_core_window_android_->GetCompositor()) {
1811 overscroll_controller_ = CreateOverscrollController(content_view_core_); 1823 overscroll_controller_ = CreateOverscrollController(content_view_core_);
1812 } 1824 }
1813 1825
1814 if (!sync_compositor_) { 1826 if (!sync_compositor_) {
1815 sync_compositor_ = SynchronousCompositorImpl::Create( 1827 sync_compositor_ = SynchronousCompositorBase::Create(
1816 this, content_view_core_->GetWebContents()); 1828 this, content_view_core_->GetWebContents());
1817 } 1829 }
1818 } 1830 }
1819 1831
1820 void RenderWidgetHostViewAndroid::RunAckCallbacks( 1832 void RenderWidgetHostViewAndroid::RunAckCallbacks(
1821 cc::SurfaceDrawStatus status) { 1833 cc::SurfaceDrawStatus status) {
1822 while (!ack_callbacks_.empty()) { 1834 while (!ack_callbacks_.empty()) {
1823 ack_callbacks_.front().Run(); 1835 ack_callbacks_.front().Run();
1824 ack_callbacks_.pop(); 1836 ack_callbacks_.pop();
1825 } 1837 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 results->orientationAngle = display.RotationAsDegree(); 2047 results->orientationAngle = display.RotationAsDegree();
2036 results->orientationType = 2048 results->orientationType =
2037 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 2049 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
2038 gfx::DeviceDisplayInfo info; 2050 gfx::DeviceDisplayInfo info;
2039 results->depth = info.GetBitsPerPixel(); 2051 results->depth = info.GetBitsPerPixel();
2040 results->depthPerComponent = info.GetBitsPerComponent(); 2052 results->depthPerComponent = info.GetBitsPerComponent();
2041 results->isMonochrome = (results->depthPerComponent == 0); 2053 results->isMonochrome = (results->depthPerComponent == 0);
2042 } 2054 }
2043 2055
2044 } // namespace content 2056 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | content/common/android/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698