OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/compositor/test/in_process_context_provider.h" | 5 #include "ui/compositor/test/in_process_context_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" | 22 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
23 | 23 |
24 namespace ui { | 24 namespace ui { |
25 | 25 |
26 // static | 26 // static |
27 scoped_refptr<InProcessContextProvider> InProcessContextProvider::Create( | 27 scoped_refptr<InProcessContextProvider> InProcessContextProvider::Create( |
28 const gpu::gles2::ContextCreationAttribHelper& attribs, | 28 const gpu::gles2::ContextCreationAttribHelper& attribs, |
29 InProcessContextProvider* shared_context, | 29 InProcessContextProvider* shared_context, |
30 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 30 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
31 gpu::ImageFactory* image_factory, | 31 gpu::ImageFactory* image_factory, |
32 gfx::AcceleratedWidget window, | 32 gpu::SurfaceHandle window, |
33 const std::string& debug_name) { | 33 const std::string& debug_name) { |
34 return new InProcessContextProvider(attribs, shared_context, | 34 return new InProcessContextProvider(attribs, shared_context, |
35 gpu_memory_buffer_manager, image_factory, | 35 gpu_memory_buffer_manager, image_factory, |
36 window, debug_name); | 36 window, debug_name); |
37 } | 37 } |
38 | 38 |
39 // static | 39 // static |
40 scoped_refptr<InProcessContextProvider> | 40 scoped_refptr<InProcessContextProvider> |
41 InProcessContextProvider::CreateOffscreen( | 41 InProcessContextProvider::CreateOffscreen( |
42 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 42 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
43 gpu::ImageFactory* image_factory, | 43 gpu::ImageFactory* image_factory, |
44 InProcessContextProvider* shared_context) { | 44 InProcessContextProvider* shared_context) { |
45 gpu::gles2::ContextCreationAttribHelper attribs; | 45 gpu::gles2::ContextCreationAttribHelper attribs; |
46 attribs.alpha_size = 8; | 46 attribs.alpha_size = 8; |
47 attribs.blue_size = 8; | 47 attribs.blue_size = 8; |
48 attribs.green_size = 8; | 48 attribs.green_size = 8; |
49 attribs.red_size = 8; | 49 attribs.red_size = 8; |
50 attribs.depth_size = 0; | 50 attribs.depth_size = 0; |
51 attribs.stencil_size = 8; | 51 attribs.stencil_size = 8; |
52 attribs.samples = 0; | 52 attribs.samples = 0; |
53 attribs.sample_buffers = 0; | 53 attribs.sample_buffers = 0; |
54 attribs.fail_if_major_perf_caveat = false; | 54 attribs.fail_if_major_perf_caveat = false; |
55 attribs.bind_generates_resource = false; | 55 attribs.bind_generates_resource = false; |
56 return new InProcessContextProvider(attribs, shared_context, | 56 return new InProcessContextProvider(attribs, shared_context, |
57 gpu_memory_buffer_manager, image_factory, | 57 gpu_memory_buffer_manager, image_factory, |
58 gfx::kNullAcceleratedWidget, "Offscreen"); | 58 gpu::kNullSurfaceHandle, "Offscreen"); |
59 } | 59 } |
60 | 60 |
61 InProcessContextProvider::InProcessContextProvider( | 61 InProcessContextProvider::InProcessContextProvider( |
62 const gpu::gles2::ContextCreationAttribHelper& attribs, | 62 const gpu::gles2::ContextCreationAttribHelper& attribs, |
63 InProcessContextProvider* shared_context, | 63 InProcessContextProvider* shared_context, |
64 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 64 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
65 gpu::ImageFactory* image_factory, | 65 gpu::ImageFactory* image_factory, |
66 gfx::AcceleratedWidget window, | 66 gpu::SurfaceHandle window, |
67 const std::string& debug_name) | 67 const std::string& debug_name) |
68 : attribs_(attribs), | 68 : attribs_(attribs), |
69 shared_context_(shared_context), | 69 shared_context_(shared_context), |
70 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | 70 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
71 image_factory_(image_factory), | 71 image_factory_(image_factory), |
72 window_(window), | 72 window_(window), |
73 debug_name_(debug_name) { | 73 debug_name_(debug_name) { |
74 DCHECK(main_thread_checker_.CalledOnValidThread()); | 74 DCHECK(main_thread_checker_.CalledOnValidThread()); |
75 context_thread_checker_.DetachFromThread(); | 75 context_thread_checker_.DetachFromThread(); |
76 } | 76 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 uint32_t InProcessContextProvider::GetCopyTextureInternalFormat() { | 165 uint32_t InProcessContextProvider::GetCopyTextureInternalFormat() { |
166 if (attribs_.alpha_size > 0) | 166 if (attribs_.alpha_size > 0) |
167 return GL_RGBA; | 167 return GL_RGBA; |
168 DCHECK_NE(attribs_.red_size, 0); | 168 DCHECK_NE(attribs_.red_size, 0); |
169 DCHECK_NE(attribs_.green_size, 0); | 169 DCHECK_NE(attribs_.green_size, 0); |
170 DCHECK_NE(attribs_.blue_size, 0); | 170 DCHECK_NE(attribs_.blue_size, 0); |
171 return GL_RGB; | 171 return GL_RGB; |
172 } | 172 } |
173 | 173 |
174 } // namespace ui | 174 } // namespace ui |
OLD | NEW |