OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "content/browser/compositor/image_transport_factory.h" | 9 #include "content/browser/compositor/image_transport_factory.h" |
10 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 10 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
11 #include "content/browser/gpu/gpu_process_host.h" | 11 #include "content/browser/gpu/gpu_process_host.h" |
| 12 #include "content/common/gpu_stream_constants.h" |
12 #include "content/public/browser/gpu_data_manager.h" | 13 #include "content/public/browser/gpu_data_manager.h" |
13 #include "content/public/browser/gpu_utils.h" | 14 #include "content/public/browser/gpu_utils.h" |
14 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
15 #include "content/public/test/content_browser_test.h" | 16 #include "content/public/test/content_browser_test.h" |
16 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" | 17 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" |
17 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 18 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
18 #include "third_party/skia/include/core/SkCanvas.h" | 19 #include "third_party/skia/include/core/SkCanvas.h" |
19 #include "third_party/skia/include/core/SkPaint.h" | 20 #include "third_party/skia/include/core/SkPaint.h" |
20 #include "third_party/skia/include/core/SkSurface.h" | 21 #include "third_party/skia/include/core/SkSurface.h" |
21 #include "third_party/skia/include/gpu/GrContext.h" | 22 #include "third_party/skia/include/gpu/GrContext.h" |
22 #include "ui/gl/gl_switches.h" | 23 #include "ui/gl/gl_switches.h" |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 scoped_refptr<ui::ContextProviderCommandBuffer> CreateContext( | 27 scoped_refptr<ui::ContextProviderCommandBuffer> CreateContext( |
27 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) { | 28 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) { |
28 // This is for an offscreen context, so the default framebuffer doesn't need | 29 // This is for an offscreen context, so the default framebuffer doesn't need |
29 // any alpha, depth, stencil, antialiasing. | 30 // any alpha, depth, stencil, antialiasing. |
30 gpu::gles2::ContextCreationAttribHelper attributes; | 31 gpu::gles2::ContextCreationAttribHelper attributes; |
31 attributes.alpha_size = -1; | 32 attributes.alpha_size = -1; |
32 attributes.depth_size = 0; | 33 attributes.depth_size = 0; |
33 attributes.stencil_size = 0; | 34 attributes.stencil_size = 0; |
34 attributes.samples = 0; | 35 attributes.samples = 0; |
35 attributes.sample_buffers = 0; | 36 attributes.sample_buffers = 0; |
36 attributes.bind_generates_resource = false; | 37 attributes.bind_generates_resource = false; |
37 constexpr bool automatic_flushes = false; | 38 constexpr bool automatic_flushes = false; |
38 constexpr bool support_locking = false; | 39 constexpr bool support_locking = false; |
39 return make_scoped_refptr(new ui::ContextProviderCommandBuffer( | 40 return make_scoped_refptr(new ui::ContextProviderCommandBuffer( |
40 std::move(gpu_channel_host), gpu::GPU_STREAM_DEFAULT, | 41 std::move(gpu_channel_host), content::kGpuStreamIdDefault, |
41 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle, GURL(), | 42 content::kGpuStreamPriorityDefault, gpu::kNullSurfaceHandle, GURL(), |
42 automatic_flushes, support_locking, gpu::SharedMemoryLimits(), attributes, | 43 automatic_flushes, support_locking, gpu::SharedMemoryLimits(), attributes, |
43 nullptr, ui::command_buffer_metrics::OFFSCREEN_CONTEXT_FOR_TESTING)); | 44 nullptr, ui::command_buffer_metrics::OFFSCREEN_CONTEXT_FOR_TESTING)); |
44 } | 45 } |
45 | 46 |
46 void OnEstablishedGpuChannel( | 47 void OnEstablishedGpuChannel( |
47 const base::Closure& quit_closure, | 48 const base::Closure& quit_closure, |
48 scoped_refptr<gpu::GpuChannelHost>* retvalue, | 49 scoped_refptr<gpu::GpuChannelHost>* retvalue, |
49 scoped_refptr<gpu::GpuChannelHost> established_host) { | 50 scoped_refptr<gpu::GpuChannelHost> established_host) { |
50 if (retvalue) | 51 if (retvalue) |
51 *retvalue = std::move(established_host); | 52 *retvalue = std::move(established_host); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 304 |
304 IN_PROC_BROWSER_TEST_F(GpuProcessHostBrowserTest, Shutdown) { | 305 IN_PROC_BROWSER_TEST_F(GpuProcessHostBrowserTest, Shutdown) { |
305 DCHECK(!IsChannelEstablished()); | 306 DCHECK(!IsChannelEstablished()); |
306 EstablishAndWait(); | 307 EstablishAndWait(); |
307 base::RunLoop run_loop; | 308 base::RunLoop run_loop; |
308 StopGpuProcess(run_loop.QuitClosure()); | 309 StopGpuProcess(run_loop.QuitClosure()); |
309 run_loop.Run(); | 310 run_loop.Run(); |
310 } | 311 } |
311 | 312 |
312 } // namespace content | 313 } // namespace content |
OLD | NEW |