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 "gpu/command_buffer/client/gl_in_process_context.h" | 5 #include "gpu/command_buffer/client/gl_in_process_context.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <set> | 11 #include <set> |
11 #include <utility> | 12 #include <utility> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include <GLES2/gl2.h> | 15 #include <GLES2/gl2.h> |
15 #ifndef GL_GLEXT_PROTOTYPES | 16 #ifndef GL_GLEXT_PROTOTYPES |
16 #define GL_GLEXT_PROTOTYPES 1 | 17 #define GL_GLEXT_PROTOTYPES 1 |
17 #endif | 18 #endif |
18 #include <GLES2/gl2ext.h> | 19 #include <GLES2/gl2ext.h> |
19 #include <GLES2/gl2extchromium.h> | 20 #include <GLES2/gl2extchromium.h> |
20 | 21 |
21 #include "base/bind.h" | 22 #include "base/bind.h" |
22 #include "base/bind_helpers.h" | 23 #include "base/bind_helpers.h" |
23 #include "base/lazy_instance.h" | 24 #include "base/lazy_instance.h" |
24 #include "base/logging.h" | 25 #include "base/logging.h" |
25 #include "base/macros.h" | 26 #include "base/macros.h" |
26 #include "base/memory/scoped_ptr.h" | |
27 #include "base/memory/weak_ptr.h" | 27 #include "base/memory/weak_ptr.h" |
28 #include "base/message_loop/message_loop.h" | 28 #include "base/message_loop/message_loop.h" |
29 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 29 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
30 #include "gpu/command_buffer/client/gles2_implementation.h" | 30 #include "gpu/command_buffer/client/gles2_implementation.h" |
31 #include "gpu/command_buffer/client/transfer_buffer.h" | 31 #include "gpu/command_buffer/client/transfer_buffer.h" |
32 #include "gpu/command_buffer/common/command_buffer.h" | 32 #include "gpu/command_buffer/common/command_buffer.h" |
33 #include "gpu/command_buffer/common/constants.h" | 33 #include "gpu/command_buffer/common/constants.h" |
34 #include "ui/gfx/geometry/size.h" | 34 #include "ui/gfx/geometry/size.h" |
35 #include "ui/gl/gl_image.h" | 35 #include "ui/gl/gl_image.h" |
36 | 36 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 #if defined(OS_ANDROID) | 74 #if defined(OS_ANDROID) |
75 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( | 75 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( |
76 uint32_t stream_id) override; | 76 uint32_t stream_id) override; |
77 uint32_t CreateStreamTexture(uint32_t texture_id) override; | 77 uint32_t CreateStreamTexture(uint32_t texture_id) override; |
78 #endif | 78 #endif |
79 | 79 |
80 private: | 80 private: |
81 void Destroy(); | 81 void Destroy(); |
82 void OnSignalSyncPoint(const base::Closure& callback); | 82 void OnSignalSyncPoint(const base::Closure& callback); |
83 | 83 |
84 scoped_ptr<gles2::GLES2CmdHelper> gles2_helper_; | 84 std::unique_ptr<gles2::GLES2CmdHelper> gles2_helper_; |
85 scoped_ptr<TransferBuffer> transfer_buffer_; | 85 std::unique_ptr<TransferBuffer> transfer_buffer_; |
86 scoped_ptr<gles2::GLES2Implementation> gles2_implementation_; | 86 std::unique_ptr<gles2::GLES2Implementation> gles2_implementation_; |
87 scoped_ptr<InProcessCommandBuffer> command_buffer_; | 87 std::unique_ptr<InProcessCommandBuffer> command_buffer_; |
88 | 88 |
89 const GLInProcessContextSharedMemoryLimits mem_limits_; | 89 const GLInProcessContextSharedMemoryLimits mem_limits_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl); | 91 DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl); |
92 }; | 92 }; |
93 | 93 |
94 GLInProcessContextImpl::GLInProcessContextImpl( | 94 GLInProcessContextImpl::GLInProcessContextImpl( |
95 const GLInProcessContextSharedMemoryLimits& mem_limits) | 95 const GLInProcessContextSharedMemoryLimits& mem_limits) |
96 : mem_limits_(mem_limits) {} | 96 : mem_limits_(mem_limits) {} |
97 | 97 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 gfx::GpuPreference gpu_preference, | 240 gfx::GpuPreference gpu_preference, |
241 const GLInProcessContextSharedMemoryLimits& memory_limits, | 241 const GLInProcessContextSharedMemoryLimits& memory_limits, |
242 GpuMemoryBufferManager* gpu_memory_buffer_manager, | 242 GpuMemoryBufferManager* gpu_memory_buffer_manager, |
243 ImageFactory* image_factory) { | 243 ImageFactory* image_factory) { |
244 if (surface.get()) { | 244 if (surface.get()) { |
245 DCHECK_EQ(surface->IsOffscreen(), is_offscreen); | 245 DCHECK_EQ(surface->IsOffscreen(), is_offscreen); |
246 DCHECK(surface->GetSize() == size); | 246 DCHECK(surface->GetSize() == size); |
247 DCHECK_EQ(gfx::kNullAcceleratedWidget, window); | 247 DCHECK_EQ(gfx::kNullAcceleratedWidget, window); |
248 } | 248 } |
249 | 249 |
250 scoped_ptr<GLInProcessContextImpl> context( | 250 std::unique_ptr<GLInProcessContextImpl> context( |
251 new GLInProcessContextImpl(memory_limits)); | 251 new GLInProcessContextImpl(memory_limits)); |
252 if (!context->Initialize(surface, | 252 if (!context->Initialize(surface, |
253 is_offscreen, | 253 is_offscreen, |
254 share_context, | 254 share_context, |
255 window, | 255 window, |
256 size, | 256 size, |
257 attribs, | 257 attribs, |
258 gpu_preference, | 258 gpu_preference, |
259 service, | 259 service, |
260 gpu_memory_buffer_manager, | 260 gpu_memory_buffer_manager, |
261 image_factory)) | 261 image_factory)) |
262 return NULL; | 262 return NULL; |
263 | 263 |
264 return context.release(); | 264 return context.release(); |
265 } | 265 } |
266 | 266 |
267 } // namespace gpu | 267 } // namespace gpu |
OLD | NEW |