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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 gfx::AcceleratedWidget window, | 57 gfx::AcceleratedWidget 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 gles2::GLES2Implementation* GetImplementation() override; | 66 gles2::GLES2Implementation* GetImplementation() override; |
| 67 void SetSwapBuffersCompletionCallback( |
| 68 const gpu::InProcessCommandBuffer::SwapBuffersCompletionCallback& |
| 69 callback) override; |
| 70 void SetUpdateVSyncParametersCallback( |
| 71 const gpu::InProcessCommandBuffer::UpdateVSyncParametersCallback& |
| 72 callback) override; |
67 void SetLock(base::Lock* lock) override; | 73 void SetLock(base::Lock* lock) override; |
68 | 74 |
69 private: | 75 private: |
70 void Destroy(); | 76 void Destroy(); |
71 void OnSignalSyncPoint(const base::Closure& callback); | 77 void OnSignalSyncPoint(const base::Closure& callback); |
72 | 78 |
73 std::unique_ptr<gles2::GLES2CmdHelper> gles2_helper_; | 79 std::unique_ptr<gles2::GLES2CmdHelper> gles2_helper_; |
74 std::unique_ptr<TransferBuffer> transfer_buffer_; | 80 std::unique_ptr<TransferBuffer> transfer_buffer_; |
75 std::unique_ptr<gles2::GLES2Implementation> gles2_implementation_; | 81 std::unique_ptr<gles2::GLES2Implementation> gles2_implementation_; |
76 std::unique_ptr<InProcessCommandBuffer> command_buffer_; | 82 std::unique_ptr<InProcessCommandBuffer> command_buffer_; |
77 | 83 |
78 DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl); | 84 DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl); |
79 }; | 85 }; |
80 | 86 |
81 GLInProcessContextImpl::GLInProcessContextImpl() = default; | 87 GLInProcessContextImpl::GLInProcessContextImpl() = default; |
82 | 88 |
83 GLInProcessContextImpl::~GLInProcessContextImpl() { | 89 GLInProcessContextImpl::~GLInProcessContextImpl() { |
84 Destroy(); | 90 Destroy(); |
85 } | 91 } |
86 | 92 |
87 gles2::GLES2Implementation* GLInProcessContextImpl::GetImplementation() { | 93 gles2::GLES2Implementation* GLInProcessContextImpl::GetImplementation() { |
88 return gles2_implementation_.get(); | 94 return gles2_implementation_.get(); |
89 } | 95 } |
90 | 96 |
| 97 void GLInProcessContextImpl::SetSwapBuffersCompletionCallback( |
| 98 const gpu::InProcessCommandBuffer::SwapBuffersCompletionCallback& |
| 99 callback) { |
| 100 command_buffer_->SetSwapBuffersCompletionCallback(callback); |
| 101 } |
| 102 |
| 103 void GLInProcessContextImpl::SetUpdateVSyncParametersCallback( |
| 104 const gpu::InProcessCommandBuffer::UpdateVSyncParametersCallback& |
| 105 callback) { |
| 106 command_buffer_->SetUpdateVSyncParametersCallback(callback); |
| 107 } |
| 108 |
91 void GLInProcessContextImpl::SetLock(base::Lock* lock) { | 109 void GLInProcessContextImpl::SetLock(base::Lock* lock) { |
92 NOTREACHED(); | 110 NOTREACHED(); |
93 } | 111 } |
94 | 112 |
95 bool GLInProcessContextImpl::Initialize( | 113 bool GLInProcessContextImpl::Initialize( |
96 scoped_refptr<gl::GLSurface> surface, | 114 scoped_refptr<gl::GLSurface> surface, |
97 bool is_offscreen, | 115 bool is_offscreen, |
98 GLInProcessContext* share_context, | 116 GLInProcessContext* share_context, |
99 gfx::AcceleratedWidget window, | 117 gfx::AcceleratedWidget window, |
100 const gles2::ContextCreationAttribHelper& attribs, | 118 const gles2::ContextCreationAttribHelper& attribs, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 if (!context->Initialize(surface, is_offscreen, share_context, window, | 221 if (!context->Initialize(surface, is_offscreen, share_context, window, |
204 attribs, service, memory_limits, | 222 attribs, service, memory_limits, |
205 gpu_memory_buffer_manager, image_factory, | 223 gpu_memory_buffer_manager, image_factory, |
206 std::move(task_runner))) | 224 std::move(task_runner))) |
207 return NULL; | 225 return NULL; |
208 | 226 |
209 return context.release(); | 227 return context.release(); |
210 } | 228 } |
211 | 229 |
212 } // namespace gpu | 230 } // namespace gpu |
OLD | NEW |