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 28 matching lines...) Expand all Loading... | |
| 39 #include "components/display_compositor/gl_helper.h" | 39 #include "components/display_compositor/gl_helper.h" |
| 40 #include "content/browser/accessibility/browser_accessibility_manager_android.h" | 40 #include "content/browser/accessibility/browser_accessibility_manager_android.h" |
| 41 #include "content/browser/android/composited_touch_handle_drawable.h" | 41 #include "content/browser/android/composited_touch_handle_drawable.h" |
| 42 #include "content/browser/android/content_view_core_impl.h" | 42 #include "content/browser/android/content_view_core_impl.h" |
| 43 #include "content/browser/android/overscroll_controller_android.h" | 43 #include "content/browser/android/overscroll_controller_android.h" |
| 44 #include "content/browser/android/synchronous_compositor_host.h" | 44 #include "content/browser/android/synchronous_compositor_host.h" |
| 45 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 45 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| 46 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 46 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 47 #include "content/browser/gpu/compositor_util.h" | 47 #include "content/browser/gpu/compositor_util.h" |
| 48 #include "content/browser/gpu/gpu_data_manager_impl.h" | 48 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 49 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 49 #include "content/browser/gpu/gpu_process_host.h" |
| 50 #include "content/browser/media/android/media_web_contents_observer_android.h" | 50 #include "content/browser/media/android/media_web_contents_observer_android.h" |
| 51 #include "content/browser/renderer_host/compositor_impl_android.h" | 51 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 52 #include "content/browser/renderer_host/dip_util.h" | 52 #include "content/browser/renderer_host/dip_util.h" |
| 53 #include "content/browser/renderer_host/frame_metadata_util.h" | 53 #include "content/browser/renderer_host/frame_metadata_util.h" |
| 54 #include "content/browser/renderer_host/input/input_router_impl.h" | 54 #include "content/browser/renderer_host/input/input_router_impl.h" |
| 55 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h " | 55 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h " |
| 56 #include "content/browser/renderer_host/input/web_input_event_builders_android.h " | 56 #include "content/browser/renderer_host/input/web_input_event_builders_android.h " |
| 57 #include "content/browser/renderer_host/render_process_host_impl.h" | 57 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 58 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 58 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
| 59 #include "content/browser/renderer_host/render_view_host_impl.h" | 59 #include "content/browser/renderer_host/render_view_host_impl.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 base::Bind(&CopyFromCompositingSurfaceFinished, callback, | 396 base::Bind(&CopyFromCompositingSurfaceFinished, callback, |
| 397 base::Passed(&release_callback), base::Passed(&bitmap), | 397 base::Passed(&release_callback), base::Passed(&bitmap), |
| 398 start_time, base::Passed(&bitmap_pixels_lock), readback_lock), | 398 start_time, base::Passed(&bitmap_pixels_lock), readback_lock), |
| 399 display_compositor::GLHelper::SCALER_QUALITY_GOOD); | 399 display_compositor::GLHelper::SCALER_QUALITY_GOOD); |
| 400 } | 400 } |
| 401 | 401 |
| 402 bool FloatEquals(float a, float b) { | 402 bool FloatEquals(float a, float b) { |
| 403 return std::abs(a - b) < FLT_EPSILON; | 403 return std::abs(a - b) < FLT_EPSILON; |
| 404 } | 404 } |
| 405 | 405 |
| 406 void WakeUpGpu(GpuProcessHost* host) { | |
| 407 DCHECK(host); | |
| 408 GpuDataManagerImpl* gpu_data = GpuDataManagerImpl::GetInstance(); | |
| 409 if (gpu_data && | |
| 410 gpu_data->IsDriverBugWorkaroundActive(gpu::WAKE_UP_GPU_BEFORE_DRAWING)) | |
| 411 host->gpu_service()->WakeUpGpu(); | |
| 412 } | |
| 413 | |
| 406 } // namespace | 414 } // namespace |
| 407 | 415 |
| 408 void RenderWidgetHostViewAndroid::OnContextLost() { | 416 void RenderWidgetHostViewAndroid::OnContextLost() { |
| 409 std::unique_ptr<RenderWidgetHostIterator> widgets( | 417 std::unique_ptr<RenderWidgetHostIterator> widgets( |
| 410 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); | 418 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); |
| 411 while (RenderWidgetHost* widget = widgets->GetNextHost()) { | 419 while (RenderWidgetHost* widget = widgets->GetNextHost()) { |
| 412 if (widget->GetView()) { | 420 if (widget->GetView()) { |
| 413 static_cast<RenderWidgetHostViewAndroid*>(widget->GetView()) | 421 static_cast<RenderWidgetHostViewAndroid*>(widget->GetView()) |
| 414 ->OnLostResources(); | 422 ->OnLostResources(); |
| 415 } | 423 } |
| (...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1545 } | 1553 } |
| 1546 | 1554 |
| 1547 if (content_view_core_ && content_view_core_->FilterInputEvent(input_event)) | 1555 if (content_view_core_ && content_view_core_->FilterInputEvent(input_event)) |
| 1548 return INPUT_EVENT_ACK_STATE_CONSUMED; | 1556 return INPUT_EVENT_ACK_STATE_CONSUMED; |
| 1549 | 1557 |
| 1550 if (!host_) | 1558 if (!host_) |
| 1551 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 1559 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
| 1552 | 1560 |
| 1553 if (input_event.type() == blink::WebInputEvent::GestureTapDown || | 1561 if (input_event.type() == blink::WebInputEvent::GestureTapDown || |
| 1554 input_event.type() == blink::WebInputEvent::TouchStart) { | 1562 input_event.type() == blink::WebInputEvent::TouchStart) { |
| 1555 GpuDataManagerImpl* gpu_data = GpuDataManagerImpl::GetInstance(); | 1563 GpuProcessHost::CallOnIO(GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED, |
| 1556 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); | 1564 false /* force_create */, base::Bind(&WakeUpGpu)); |
| 1557 if (shim && gpu_data && | |
| 1558 gpu_data->IsDriverBugWorkaroundActive(gpu::WAKE_UP_GPU_BEFORE_DRAWING)) | |
| 1559 shim->Send(new GpuMsg_WakeUpGpu); | |
|
sadrul
2017/03/01 17:53:36
GpuProcessHostUIShim::Send() hops onto the IO thre
| |
| 1560 } | 1565 } |
| 1561 | 1566 |
| 1562 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 1567 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
| 1563 } | 1568 } |
| 1564 | 1569 |
| 1565 void RenderWidgetHostViewAndroid::OnSetNeedsFlushInput() { | 1570 void RenderWidgetHostViewAndroid::OnSetNeedsFlushInput() { |
| 1566 TRACE_EVENT0("input", "RenderWidgetHostViewAndroid::OnSetNeedsFlushInput"); | 1571 TRACE_EVENT0("input", "RenderWidgetHostViewAndroid::OnSetNeedsFlushInput"); |
| 1567 AddBeginFrameRequest(FLUSH_INPUT); | 1572 AddBeginFrameRequest(FLUSH_INPUT); |
| 1568 } | 1573 } |
| 1569 | 1574 |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1986 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 1991 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
| 1987 if (!compositor) | 1992 if (!compositor) |
| 1988 return; | 1993 return; |
| 1989 | 1994 |
| 1990 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 1995 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 1991 overscroll_refresh_handler, compositor, | 1996 overscroll_refresh_handler, compositor, |
| 1992 ui::GetScaleFactorForNativeView(GetNativeView())); | 1997 ui::GetScaleFactorForNativeView(GetNativeView())); |
| 1993 } | 1998 } |
| 1994 | 1999 |
| 1995 } // namespace content | 2000 } // namespace content |
| OLD | NEW |