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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "content/browser/renderer_host/dip_util.h" | 53 #include "content/browser/renderer_host/dip_util.h" |
54 #include "content/browser/renderer_host/frame_metadata_util.h" | 54 #include "content/browser/renderer_host/frame_metadata_util.h" |
55 #include "content/browser/renderer_host/input/input_router_impl.h" | 55 #include "content/browser/renderer_host/input/input_router_impl.h" |
56 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" | 56 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" |
57 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" | 57 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
58 #include "content/browser/renderer_host/render_process_host_impl.h" | 58 #include "content/browser/renderer_host/render_process_host_impl.h" |
59 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 59 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
60 #include "content/browser/renderer_host/render_view_host_impl.h" | 60 #include "content/browser/renderer_host/render_view_host_impl.h" |
61 #include "content/browser/renderer_host/render_widget_host_impl.h" | 61 #include "content/browser/renderer_host/render_widget_host_impl.h" |
62 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 62 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
63 #include "content/common/gpu_stream_constants.h" | |
64 #include "content/common/input_messages.h" | 63 #include "content/common/input_messages.h" |
65 #include "content/common/site_isolation_policy.h" | 64 #include "content/common/site_isolation_policy.h" |
66 #include "content/common/view_messages.h" | 65 #include "content/common/view_messages.h" |
67 #include "content/public/browser/android/compositor.h" | 66 #include "content/public/browser/android/compositor.h" |
68 #include "content/public/browser/android/synchronous_compositor_client.h" | 67 #include "content/public/browser/android/synchronous_compositor_client.h" |
69 #include "content/public/browser/browser_thread.h" | 68 #include "content/public/browser/browser_thread.h" |
70 #include "content/public/browser/devtools_agent_host.h" | 69 #include "content/public/browser/devtools_agent_host.h" |
71 #include "content/public/browser/render_view_host.h" | 70 #include "content/public/browser/render_view_host.h" |
72 #include "content/public/browser/render_widget_host_iterator.h" | 71 #include "content/public/browser/render_widget_host_iterator.h" |
73 #include "content/public/common/content_switches.h" | 72 #include "content/public/common/content_switches.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 168 |
170 void GLHelperHolder::Initialize() { | 169 void GLHelperHolder::Initialize() { |
171 auto* factory = BrowserGpuChannelHostFactory::instance(); | 170 auto* factory = BrowserGpuChannelHostFactory::instance(); |
172 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); | 171 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); |
173 | 172 |
174 // The Browser Compositor is in charge of reestablishing the channel if its | 173 // The Browser Compositor is in charge of reestablishing the channel if its |
175 // missing. | 174 // missing. |
176 if (!gpu_channel_host) | 175 if (!gpu_channel_host) |
177 return; | 176 return; |
178 | 177 |
179 int32_t stream_id = kGpuStreamIdDefault; | |
180 gpu::SchedulingPriority stream_priority = kGpuStreamPriorityUI; | |
181 | |
182 // This is for an offscreen context, so we don't need the default framebuffer | 178 // This is for an offscreen context, so we don't need the default framebuffer |
183 // to have alpha, stencil, depth, antialiasing. | 179 // to have alpha, stencil, depth, antialiasing. |
184 gpu::gles2::ContextCreationAttribHelper attributes; | 180 gpu::gles2::ContextCreationAttribHelper attributes; |
185 attributes.alpha_size = -1; | 181 attributes.alpha_size = -1; |
186 attributes.stencil_size = 0; | 182 attributes.stencil_size = 0; |
187 attributes.depth_size = 0; | 183 attributes.depth_size = 0; |
188 attributes.samples = 0; | 184 attributes.samples = 0; |
189 attributes.sample_buffers = 0; | 185 attributes.sample_buffers = 0; |
190 attributes.bind_generates_resource = false; | 186 attributes.bind_generates_resource = false; |
191 | 187 |
192 gpu::SharedMemoryLimits limits; | 188 gpu::SharedMemoryLimits limits; |
193 // The GLHelper context doesn't do a lot of stuff, so we don't expect it to | 189 // The GLHelper context doesn't do a lot of stuff, so we don't expect it to |
194 // need a lot of space for commands. | 190 // need a lot of space for commands. |
195 limits.command_buffer_size = 1024; | 191 limits.command_buffer_size = 1024; |
196 // The transfer buffer is used for shaders among other things, so give some | 192 // The transfer buffer is used for shaders among other things, so give some |
197 // reasonable but small limit. | 193 // reasonable but small limit. |
198 limits.start_transfer_buffer_size = 4 * 1024; | 194 limits.start_transfer_buffer_size = 4 * 1024; |
199 limits.min_transfer_buffer_size = 4 * 1024; | 195 limits.min_transfer_buffer_size = 4 * 1024; |
200 limits.max_transfer_buffer_size = 128 * 1024; | 196 limits.max_transfer_buffer_size = 128 * 1024; |
201 // Very few allocations from mapped memory pool, so this can be really low. | 197 // Very few allocations from mapped memory pool, so this can be really low. |
202 limits.mapped_memory_reclaim_limit = 4 * 1024; | 198 limits.mapped_memory_reclaim_limit = 4 * 1024; |
203 | 199 |
204 constexpr bool automatic_flushes = false; | 200 constexpr bool automatic_flushes = false; |
205 constexpr bool support_locking = false; | 201 constexpr bool support_locking = false; |
206 const GURL url("chrome://gpu/RenderWidgetHostViewAndroid"); | 202 const GURL url("chrome://gpu/RenderWidgetHostViewAndroid"); |
207 | 203 |
208 provider_ = new ui::ContextProviderCommandBuffer( | 204 provider_ = new ui::ContextProviderCommandBuffer( |
209 std::move(gpu_channel_host), stream_id, stream_priority, | 205 std::move(gpu_channel_host), gpu::GPU_STREAM_DEFAULT, |
210 gpu::kNullSurfaceHandle, url, automatic_flushes, support_locking, limits, | 206 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle, url, |
211 attributes, nullptr, | 207 automatic_flushes, support_locking, limits, attributes, nullptr, |
212 ui::command_buffer_metrics::BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT); | 208 ui::command_buffer_metrics::BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT); |
213 if (!provider_->BindToCurrentThread()) | 209 if (!provider_->BindToCurrentThread()) |
214 return; | 210 return; |
215 provider_->ContextGL()->TraceBeginCHROMIUM( | 211 provider_->ContextGL()->TraceBeginCHROMIUM( |
216 "gpu_toplevel", | 212 "gpu_toplevel", |
217 base::StringPrintf("CmdBufferImageTransportFactory-%p", provider_.get()) | 213 base::StringPrintf("CmdBufferImageTransportFactory-%p", provider_.get()) |
218 .c_str()); | 214 .c_str()); |
219 provider_->SetLostContextCallback( | 215 provider_->SetLostContextCallback( |
220 base::Bind(&GLHelperHolder::OnContextLost, base::Unretained(this))); | 216 base::Bind(&GLHelperHolder::OnContextLost, base::Unretained(this))); |
221 gl_helper_.reset(new display_compositor::GLHelper( | 217 gl_helper_.reset(new display_compositor::GLHelper( |
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2195 | 2191 |
2196 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2192 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
2197 if (!compositor) | 2193 if (!compositor) |
2198 return; | 2194 return; |
2199 | 2195 |
2200 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2196 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
2201 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2197 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
2202 } | 2198 } |
2203 | 2199 |
2204 } // namespace content | 2200 } // namespace content |
OLD | NEW |