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/run_loop.h" | 7 #include "base/run_loop.h" |
7 #include "build/build_config.h" | 8 #include "build/build_config.h" |
8 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 9 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
9 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 10 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
10 #include "content/common/gpu/client/context_provider_command_buffer.h" | 11 #include "content/common/gpu/client/context_provider_command_buffer.h" |
11 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 12 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
12 #include "content/common/gpu_process_launch_causes.h" | 13 #include "content/common/gpu_process_launch_causes.h" |
13 #include "content/public/browser/gpu_data_manager.h" | 14 #include "content/public/browser/gpu_data_manager.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 "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 17 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" |
17 #include "third_party/skia/include/core/SkCanvas.h" | 18 #include "third_party/skia/include/core/SkCanvas.h" |
18 #include "third_party/skia/include/core/SkPaint.h" | 19 #include "third_party/skia/include/core/SkPaint.h" |
19 #include "third_party/skia/include/core/SkSurface.h" | 20 #include "third_party/skia/include/core/SkSurface.h" |
20 #include "third_party/skia/include/gpu/GrContext.h" | 21 #include "third_party/skia/include/gpu/GrContext.h" |
21 #include "ui/gl/gl_switches.h" | 22 #include "ui/gl/gl_switches.h" |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 using content::WebGraphicsContext3DCommandBufferImpl; | 26 using content::WebGraphicsContext3DCommandBufferImpl; |
26 | 27 |
27 const content::CauseForGpuLaunch kInitCause = | 28 const content::CauseForGpuLaunch kInitCause = |
28 content:: | 29 content:: |
29 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; | 30 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; |
30 | 31 |
31 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext( | 32 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext( |
32 gpu::GpuChannelHost* gpu_channel_host) { | 33 gpu::GpuChannelHost* gpu_channel_host) { |
33 // This is for an offscreen context, so the default framebuffer doesn't need | 34 // This is for an offscreen context, so the default framebuffer doesn't need |
34 // any alpha, depth, stencil, antialiasing. | 35 // any alpha, depth, stencil, antialiasing. |
35 gpu::gles2::ContextCreationAttribHelper attributes; | 36 gpu::gles2::ContextCreationAttribHelper attributes; |
36 attributes.alpha_size = -1; | 37 attributes.alpha_size = -1; |
37 attributes.depth_size = 0; | 38 attributes.depth_size = 0; |
38 attributes.stencil_size = 0; | 39 attributes.stencil_size = 0; |
39 attributes.samples = 0; | 40 attributes.samples = 0; |
40 attributes.sample_buffers = 0; | 41 attributes.sample_buffers = 0; |
41 attributes.bind_generates_resource = false; | 42 attributes.bind_generates_resource = false; |
42 bool share_resources = false; | 43 bool share_resources = false; |
43 bool automatic_flushes = false; | 44 bool automatic_flushes = false; |
44 return make_scoped_ptr( | 45 return base::WrapUnique( |
45 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 46 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
46 gpu_channel_host, attributes, gfx::PreferIntegratedGpu, | 47 gpu_channel_host, attributes, gfx::PreferIntegratedGpu, |
47 share_resources, automatic_flushes, GURL(), | 48 share_resources, automatic_flushes, GURL(), |
48 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), | 49 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), |
49 nullptr)); | 50 nullptr)); |
50 } | 51 } |
51 | 52 |
52 class ContextTestBase : public content::ContentBrowserTest { | 53 class ContextTestBase : public content::ContentBrowserTest { |
53 public: | 54 public: |
54 void SetUpOnMainThread() override { | 55 void SetUpOnMainThread() override { |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 shim->SimulateCrash(); | 292 shim->SimulateCrash(); |
292 run_loop.Run(); | 293 run_loop.Run(); |
293 | 294 |
294 EXPECT_EQ(1, counter); | 295 EXPECT_EQ(1, counter); |
295 EXPECT_FALSE(IsChannelEstablished()); | 296 EXPECT_FALSE(IsChannelEstablished()); |
296 EstablishAndWait(); | 297 EstablishAndWait(); |
297 EXPECT_TRUE(IsChannelEstablished()); | 298 EXPECT_TRUE(IsChannelEstablished()); |
298 } | 299 } |
299 | 300 |
300 } // namespace content | 301 } // namespace content |
OLD | NEW |