| 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/ipc/gl_in_process_context.h" | 5 #include "gpu/ipc/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 <memory> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 GLInProcessContext* share_context, | 56 GLInProcessContext* share_context, |
| 57 SurfaceHandle window, | 57 SurfaceHandle window, |
| 58 const gpu::gles2::ContextCreationAttribHelper& attribs, | 58 const gpu::gles2::ContextCreationAttribHelper& attribs, |
| 59 const scoped_refptr<InProcessCommandBuffer::Service>& service, | 59 const scoped_refptr<InProcessCommandBuffer::Service>& service, |
| 60 const SharedMemoryLimits& mem_limits, | 60 const SharedMemoryLimits& mem_limits, |
| 61 GpuMemoryBufferManager* gpu_memory_buffer_manager, | 61 GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 62 ImageFactory* image_factory, | 62 ImageFactory* image_factory, |
| 63 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 63 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 64 | 64 |
| 65 // GLInProcessContext implementation: | 65 // GLInProcessContext implementation: |
| 66 gpu::Capabilities GetCapabilities() override; |
| 66 gles2::GLES2Implementation* GetImplementation() override; | 67 gles2::GLES2Implementation* GetImplementation() override; |
| 67 void SetSwapBuffersCompletionCallback( | 68 void SetSwapBuffersCompletionCallback( |
| 68 const gpu::InProcessCommandBuffer::SwapBuffersCompletionCallback& | 69 const gpu::InProcessCommandBuffer::SwapBuffersCompletionCallback& |
| 69 callback) override; | 70 callback) override; |
| 70 void SetUpdateVSyncParametersCallback( | 71 void SetUpdateVSyncParametersCallback( |
| 71 const gpu::InProcessCommandBuffer::UpdateVSyncParametersCallback& | 72 const gpu::InProcessCommandBuffer::UpdateVSyncParametersCallback& |
| 72 callback) override; | 73 callback) override; |
| 73 void SetLock(base::Lock* lock) override; | 74 void SetLock(base::Lock* lock) override; |
| 74 | 75 |
| 75 private: | 76 private: |
| 76 void Destroy(); | 77 void Destroy(); |
| 77 void OnSignalSyncPoint(const base::Closure& callback); | 78 void OnSignalSyncPoint(const base::Closure& callback); |
| 78 | 79 |
| 79 std::unique_ptr<gles2::GLES2CmdHelper> gles2_helper_; | 80 std::unique_ptr<gles2::GLES2CmdHelper> gles2_helper_; |
| 80 std::unique_ptr<TransferBuffer> transfer_buffer_; | 81 std::unique_ptr<TransferBuffer> transfer_buffer_; |
| 81 std::unique_ptr<gles2::GLES2Implementation> gles2_implementation_; | 82 std::unique_ptr<gles2::GLES2Implementation> gles2_implementation_; |
| 82 std::unique_ptr<InProcessCommandBuffer> command_buffer_; | 83 std::unique_ptr<InProcessCommandBuffer> command_buffer_; |
| 83 | 84 |
| 84 DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl); | 85 DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl); |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 GLInProcessContextImpl::GLInProcessContextImpl() = default; | 88 GLInProcessContextImpl::GLInProcessContextImpl() = default; |
| 88 | 89 |
| 89 GLInProcessContextImpl::~GLInProcessContextImpl() { | 90 GLInProcessContextImpl::~GLInProcessContextImpl() { |
| 90 Destroy(); | 91 Destroy(); |
| 91 } | 92 } |
| 92 | 93 |
| 94 Capabilities GLInProcessContextImpl::GetCapabilities() { |
| 95 return command_buffer_->GetCapabilities(); |
| 96 } |
| 97 |
| 93 gles2::GLES2Implementation* GLInProcessContextImpl::GetImplementation() { | 98 gles2::GLES2Implementation* GLInProcessContextImpl::GetImplementation() { |
| 94 return gles2_implementation_.get(); | 99 return gles2_implementation_.get(); |
| 95 } | 100 } |
| 96 | 101 |
| 97 void GLInProcessContextImpl::SetSwapBuffersCompletionCallback( | 102 void GLInProcessContextImpl::SetSwapBuffersCompletionCallback( |
| 98 const gpu::InProcessCommandBuffer::SwapBuffersCompletionCallback& | 103 const gpu::InProcessCommandBuffer::SwapBuffersCompletionCallback& |
| 99 callback) { | 104 callback) { |
| 100 command_buffer_->SetSwapBuffersCompletionCallback(callback); | 105 command_buffer_->SetSwapBuffersCompletionCallback(callback); |
| 101 } | 106 } |
| 102 | 107 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 if (!context->Initialize(surface, is_offscreen, share_context, window, | 226 if (!context->Initialize(surface, is_offscreen, share_context, window, |
| 222 attribs, service, memory_limits, | 227 attribs, service, memory_limits, |
| 223 gpu_memory_buffer_manager, image_factory, | 228 gpu_memory_buffer_manager, image_factory, |
| 224 std::move(task_runner))) | 229 std::move(task_runner))) |
| 225 return NULL; | 230 return NULL; |
| 226 | 231 |
| 227 return context.release(); | 232 return context.release(); |
| 228 } | 233 } |
| 229 | 234 |
| 230 } // namespace gpu | 235 } // namespace gpu |
| OLD | NEW |