| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 // GLInProcessContext implementation: | 69 // GLInProcessContext implementation: |
| 70 gles2::GLES2Implementation* GetImplementation() override; | 70 gles2::GLES2Implementation* GetImplementation() override; |
| 71 size_t GetMappedMemoryLimit() override; | 71 size_t GetMappedMemoryLimit() override; |
| 72 void SetLock(base::Lock* lock) override; | 72 void SetLock(base::Lock* lock) override; |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 void Destroy(); | 75 void Destroy(); |
| 76 void OnSignalSyncPoint(const base::Closure& callback); | 76 void OnSignalSyncPoint(const base::Closure& callback); |
| 77 | 77 |
| 78 scoped_ptr<gles2::GLES2CmdHelper> gles2_helper_; | 78 std::unique_ptr<gles2::GLES2CmdHelper> gles2_helper_; |
| 79 scoped_ptr<TransferBuffer> transfer_buffer_; | 79 std::unique_ptr<TransferBuffer> transfer_buffer_; |
| 80 scoped_ptr<gles2::GLES2Implementation> gles2_implementation_; | 80 std::unique_ptr<gles2::GLES2Implementation> gles2_implementation_; |
| 81 scoped_ptr<InProcessCommandBuffer> command_buffer_; | 81 std::unique_ptr<InProcessCommandBuffer> command_buffer_; |
| 82 | 82 |
| 83 const GLInProcessContextSharedMemoryLimits mem_limits_; | 83 const GLInProcessContextSharedMemoryLimits mem_limits_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl); | 85 DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 GLInProcessContextImpl::GLInProcessContextImpl( | 88 GLInProcessContextImpl::GLInProcessContextImpl( |
| 89 const GLInProcessContextSharedMemoryLimits& mem_limits) | 89 const GLInProcessContextSharedMemoryLimits& mem_limits) |
| 90 : mem_limits_(mem_limits) {} | 90 : mem_limits_(mem_limits) {} |
| 91 | 91 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 gfx::GpuPreference gpu_preference, | 223 gfx::GpuPreference gpu_preference, |
| 224 const GLInProcessContextSharedMemoryLimits& memory_limits, | 224 const GLInProcessContextSharedMemoryLimits& memory_limits, |
| 225 GpuMemoryBufferManager* gpu_memory_buffer_manager, | 225 GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 226 ImageFactory* image_factory) { | 226 ImageFactory* image_factory) { |
| 227 if (surface.get()) { | 227 if (surface.get()) { |
| 228 DCHECK_EQ(surface->IsOffscreen(), is_offscreen); | 228 DCHECK_EQ(surface->IsOffscreen(), is_offscreen); |
| 229 DCHECK(surface->GetSize() == size); | 229 DCHECK(surface->GetSize() == size); |
| 230 DCHECK_EQ(gfx::kNullAcceleratedWidget, window); | 230 DCHECK_EQ(gfx::kNullAcceleratedWidget, window); |
| 231 } | 231 } |
| 232 | 232 |
| 233 scoped_ptr<GLInProcessContextImpl> context( | 233 std::unique_ptr<GLInProcessContextImpl> context( |
| 234 new GLInProcessContextImpl(memory_limits)); | 234 new GLInProcessContextImpl(memory_limits)); |
| 235 if (!context->Initialize(surface, | 235 if (!context->Initialize(surface, |
| 236 is_offscreen, | 236 is_offscreen, |
| 237 share_context, | 237 share_context, |
| 238 window, | 238 window, |
| 239 size, | 239 size, |
| 240 attribs, | 240 attribs, |
| 241 gpu_preference, | 241 gpu_preference, |
| 242 service, | 242 service, |
| 243 gpu_memory_buffer_manager, | 243 gpu_memory_buffer_manager, |
| 244 image_factory)) | 244 image_factory)) |
| 245 return NULL; | 245 return NULL; |
| 246 | 246 |
| 247 return context.release(); | 247 return context.release(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace gpu | 250 } // namespace gpu |
| OLD | NEW |