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

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)) {
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_.get() && sync_compositor_->OnMessageReceived(message);
dcheng 2015/10/27 21:06:58 No .get(). etc.
boliu 2015/10/28 02:07:06 Done.
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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 base::Bind(&RenderWidgetHostViewAndroid::SendDelegatedFrameAck, 1181 base::Bind(&RenderWidgetHostViewAndroid::SendDelegatedFrameAck,
1174 weak_ptr_factory_.GetWeakPtr(), 1182 weak_ptr_factory_.GetWeakPtr(),
1175 last_frame_info_->output_surface_id); 1183 last_frame_info_->output_surface_id);
1176 1184
1177 ack_callbacks_.push(ack_callback); 1185 ack_callbacks_.push(ack_callback);
1178 } 1186 }
1179 1187
1180 last_frame_info_.reset(new LastFrameInfo(output_surface_id, frame.Pass())); 1188 last_frame_info_.reset(new LastFrameInfo(output_surface_id, frame.Pass()));
1181 } 1189 }
1182 1190
1183 SynchronousCompositorImpl* 1191 SynchronousCompositorBase*
1184 RenderWidgetHostViewAndroid::GetSynchronousCompositorImpl() { 1192 RenderWidgetHostViewAndroid::GetSynchronousCompositor() {
1185 return sync_compositor_.get(); 1193 return sync_compositor_.get();
1186 } 1194 }
1187 1195
1188 void RenderWidgetHostViewAndroid::SynchronousFrameMetadata( 1196 void RenderWidgetHostViewAndroid::SynchronousFrameMetadata(
1189 const cc::CompositorFrameMetadata& frame_metadata) { 1197 const cc::CompositorFrameMetadata& frame_metadata) {
1190 if (!content_view_core_) 1198 if (!content_view_core_)
1191 return; 1199 return;
1192 1200
1193 // This is a subset of OnSwapCompositorFrame() used in the synchronous 1201 // This is a subset of OnSwapCompositorFrame() used in the synchronous
1194 // compositor flow. 1202 // compositor flow.
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 1814
1807 if (!selection_controller_) 1815 if (!selection_controller_)
1808 selection_controller_ = CreateSelectionController(this, content_view_core_); 1816 selection_controller_ = CreateSelectionController(this, content_view_core_);
1809 1817
1810 if (!overscroll_controller_ && 1818 if (!overscroll_controller_ &&
1811 content_view_core_window_android_->GetCompositor()) { 1819 content_view_core_window_android_->GetCompositor()) {
1812 overscroll_controller_ = CreateOverscrollController(content_view_core_); 1820 overscroll_controller_ = CreateOverscrollController(content_view_core_);
1813 } 1821 }
1814 1822
1815 if (!sync_compositor_) { 1823 if (!sync_compositor_) {
1816 sync_compositor_ = SynchronousCompositorImpl::Create( 1824 sync_compositor_ = SynchronousCompositorBase::Create(
1817 this, content_view_core_->GetWebContents()); 1825 this, content_view_core_->GetWebContents());
1818 } 1826 }
1819 } 1827 }
1820 1828
1821 void RenderWidgetHostViewAndroid::RunAckCallbacks( 1829 void RenderWidgetHostViewAndroid::RunAckCallbacks(
1822 cc::SurfaceDrawStatus status) { 1830 cc::SurfaceDrawStatus status) {
1823 while (!ack_callbacks_.empty()) { 1831 while (!ack_callbacks_.empty()) {
1824 ack_callbacks_.front().Run(); 1832 ack_callbacks_.front().Run();
1825 ack_callbacks_.pop(); 1833 ack_callbacks_.pop();
1826 } 1834 }
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 results->orientationAngle = display.RotationAsDegree(); 2052 results->orientationAngle = display.RotationAsDegree();
2045 results->orientationType = 2053 results->orientationType =
2046 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 2054 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
2047 gfx::DeviceDisplayInfo info; 2055 gfx::DeviceDisplayInfo info;
2048 results->depth = info.GetBitsPerPixel(); 2056 results->depth = info.GetBitsPerPixel();
2049 results->depthPerComponent = info.GetBitsPerComponent(); 2057 results->depthPerComponent = info.GetBitsPerComponent();
2050 results->isMonochrome = (results->depthPerComponent == 0); 2058 results->isMonochrome = (results->depthPerComponent == 0);
2051 } 2059 }
2052 2060
2053 } // namespace content 2061 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698