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 "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 is_showing_(!widget_host->is_hidden()), | 319 is_showing_(!widget_host->is_hidden()), |
320 content_view_core_(nullptr), | 320 content_view_core_(nullptr), |
321 content_view_core_window_android_(nullptr), | 321 content_view_core_window_android_(nullptr), |
322 ime_adapter_android_(this), | 322 ime_adapter_android_(this), |
323 cached_background_color_(SK_ColorWHITE), | 323 cached_background_color_(SK_ColorWHITE), |
324 last_output_surface_id_(kUndefinedOutputSurfaceId), | 324 last_output_surface_id_(kUndefinedOutputSurfaceId), |
325 gesture_provider_(ui::GetGestureProviderConfig( | 325 gesture_provider_(ui::GetGestureProviderConfig( |
326 ui::GestureProviderConfigType::CURRENT_PLATFORM), | 326 ui::GestureProviderConfigType::CURRENT_PLATFORM), |
327 this), | 327 this), |
328 stylus_text_selector_(this), | 328 stylus_text_selector_(this), |
329 accelerated_surface_route_id_(0), | |
330 using_browser_compositor_(CompositorImpl::IsInitialized()), | 329 using_browser_compositor_(CompositorImpl::IsInitialized()), |
331 frame_evictor_(new DelegatedFrameEvictor(this)), | 330 frame_evictor_(new DelegatedFrameEvictor(this)), |
332 locks_on_frame_count_(0), | 331 locks_on_frame_count_(0), |
333 observing_root_window_(false), | 332 observing_root_window_(false), |
334 weak_ptr_factory_(this) { | 333 weak_ptr_factory_(this) { |
335 if (CompositorImpl::GetSurfaceManager()) | 334 if (CompositorImpl::GetSurfaceManager()) |
336 id_allocator_ = CompositorImpl::CreateSurfaceIdAllocator(); | 335 id_allocator_ = CompositorImpl::CreateSurfaceIdAllocator(); |
337 host_->SetView(this); | 336 host_->SetView(this); |
338 SetContentViewCore(content_view_core); | 337 SetContentViewCore(content_view_core); |
339 } | 338 } |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 1339 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
1341 RenderViewHost::From(host_)); | 1340 RenderViewHost::From(host_)); |
1342 WebContentsImpl* web_contents_impl = | 1341 WebContentsImpl* web_contents_impl = |
1343 static_cast<WebContentsImpl*>(WebContents::FromRenderViewHost(rvhi)); | 1342 static_cast<WebContentsImpl*>(WebContents::FromRenderViewHost(rvhi)); |
1344 if (web_contents_impl) | 1343 if (web_contents_impl) |
1345 web_contents_impl->media_web_contents_observer()->OnFrameInfoUpdated(); | 1344 web_contents_impl->media_web_contents_observer()->OnFrameInfoUpdated(); |
1346 } | 1345 } |
1347 #endif // defined(VIDEO_HOLE) | 1346 #endif // defined(VIDEO_HOLE) |
1348 } | 1347 } |
1349 | 1348 |
1350 void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int route_id) { | |
1351 // TODO: remove need for the surface id here | |
1352 accelerated_surface_route_id_ = route_id; | |
1353 } | |
1354 | |
1355 void RenderWidgetHostViewAndroid::ShowInternal() { | 1349 void RenderWidgetHostViewAndroid::ShowInternal() { |
1356 DCHECK(is_showing_); | 1350 DCHECK(is_showing_); |
1357 if (!host_ || !host_->is_hidden()) | 1351 if (!host_ || !host_->is_hidden()) |
1358 return; | 1352 return; |
1359 | 1353 |
1360 if (layer_.get()) | 1354 if (layer_.get()) |
1361 layer_->SetHideLayerAndSubtree(false); | 1355 layer_->SetHideLayerAndSubtree(false); |
1362 | 1356 |
1363 frame_evictor_->SetVisible(true); | 1357 frame_evictor_->SetVisible(true); |
1364 | 1358 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 if (content_view_core_ && content_view_core_->FilterInputEvent(input_event)) | 1596 if (content_view_core_ && content_view_core_->FilterInputEvent(input_event)) |
1603 return INPUT_EVENT_ACK_STATE_CONSUMED; | 1597 return INPUT_EVENT_ACK_STATE_CONSUMED; |
1604 | 1598 |
1605 if (!host_) | 1599 if (!host_) |
1606 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 1600 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
1607 | 1601 |
1608 if (input_event.type == blink::WebInputEvent::GestureTapDown || | 1602 if (input_event.type == blink::WebInputEvent::GestureTapDown || |
1609 input_event.type == blink::WebInputEvent::TouchStart) { | 1603 input_event.type == blink::WebInputEvent::TouchStart) { |
1610 GpuDataManagerImpl* gpu_data = GpuDataManagerImpl::GetInstance(); | 1604 GpuDataManagerImpl* gpu_data = GpuDataManagerImpl::GetInstance(); |
1611 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); | 1605 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); |
1612 if (shim && gpu_data && accelerated_surface_route_id_ && | 1606 if (shim && gpu_data && |
1613 gpu_data->IsDriverBugWorkaroundActive(gpu::WAKE_UP_GPU_BEFORE_DRAWING)) | 1607 gpu_data->IsDriverBugWorkaroundActive(gpu::WAKE_UP_GPU_BEFORE_DRAWING)) |
1614 shim->Send( | 1608 shim->Send(new GpuMsg_WakeUpGpu); |
1615 new AcceleratedSurfaceMsg_WakeUpGpu(accelerated_surface_route_id_)); | |
1616 } | 1609 } |
1617 | 1610 |
1618 SynchronousCompositorImpl* compositor = | 1611 SynchronousCompositorImpl* compositor = |
1619 SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(), | 1612 SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(), |
1620 host_->GetRoutingID()); | 1613 host_->GetRoutingID()); |
1621 if (compositor) | 1614 if (compositor) |
1622 return compositor->HandleInputEvent(input_event); | 1615 return compositor->HandleInputEvent(input_event); |
1623 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 1616 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
1624 } | 1617 } |
1625 | 1618 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2018 results->orientationAngle = display.RotationAsDegree(); | 2011 results->orientationAngle = display.RotationAsDegree(); |
2019 results->orientationType = | 2012 results->orientationType = |
2020 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2013 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
2021 gfx::DeviceDisplayInfo info; | 2014 gfx::DeviceDisplayInfo info; |
2022 results->depth = info.GetBitsPerPixel(); | 2015 results->depth = info.GetBitsPerPixel(); |
2023 results->depthPerComponent = info.GetBitsPerComponent(); | 2016 results->depthPerComponent = info.GetBitsPerComponent(); |
2024 results->isMonochrome = (results->depthPerComponent == 0); | 2017 results->isMonochrome = (results->depthPerComponent == 0); |
2025 } | 2018 } |
2026 | 2019 |
2027 } // namespace content | 2020 } // namespace content |
OLD | NEW |