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 <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 const gfx::Size& size, | 59 const gfx::Size& size, |
60 const gpu::gles2::ContextCreationAttribHelper& attribs, | 60 const gpu::gles2::ContextCreationAttribHelper& attribs, |
61 gfx::GpuPreference gpu_preference, | 61 gfx::GpuPreference gpu_preference, |
62 const scoped_refptr<InProcessCommandBuffer::Service>& service, | 62 const scoped_refptr<InProcessCommandBuffer::Service>& service, |
63 GpuMemoryBufferManager* gpu_memory_buffer_manager, | 63 GpuMemoryBufferManager* gpu_memory_buffer_manager, |
64 ImageFactory* image_factory); | 64 ImageFactory* image_factory); |
65 | 65 |
66 // GLInProcessContext implementation: | 66 // GLInProcessContext implementation: |
67 void SetContextLostCallback(const base::Closure& callback) override; | 67 void SetContextLostCallback(const base::Closure& callback) override; |
68 gles2::GLES2Implementation* GetImplementation() override; | 68 gles2::GLES2Implementation* GetImplementation() override; |
69 size_t GetMappedMemoryLimit() override; | |
70 void SetLock(base::Lock* lock) override; | 69 void SetLock(base::Lock* lock) override; |
71 | 70 |
72 #if defined(OS_ANDROID) | 71 #if defined(OS_ANDROID) |
73 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( | 72 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( |
74 uint32 stream_id) override; | 73 uint32 stream_id) override; |
75 #endif | 74 #endif |
76 | 75 |
77 private: | 76 private: |
78 void Destroy(); | 77 void Destroy(); |
79 void OnContextLost(); | 78 void OnContextLost(); |
(...skipping 27 matching lines...) Expand all Loading... |
107 base::AutoLock lock(g_all_shared_contexts_lock.Get()); | 106 base::AutoLock lock(g_all_shared_contexts_lock.Get()); |
108 g_all_shared_contexts.Get().erase(this); | 107 g_all_shared_contexts.Get().erase(this); |
109 } | 108 } |
110 Destroy(); | 109 Destroy(); |
111 } | 110 } |
112 | 111 |
113 gles2::GLES2Implementation* GLInProcessContextImpl::GetImplementation() { | 112 gles2::GLES2Implementation* GLInProcessContextImpl::GetImplementation() { |
114 return gles2_implementation_.get(); | 113 return gles2_implementation_.get(); |
115 } | 114 } |
116 | 115 |
117 size_t GLInProcessContextImpl::GetMappedMemoryLimit() { | |
118 return mem_limits_.mapped_memory_reclaim_limit; | |
119 } | |
120 | |
121 void GLInProcessContextImpl::SetLock(base::Lock* lock) { | 116 void GLInProcessContextImpl::SetLock(base::Lock* lock) { |
122 command_buffer_->SetLock(lock); | 117 command_buffer_->SetLock(lock); |
123 lock_ = lock; | 118 lock_ = lock; |
124 } | 119 } |
125 | 120 |
126 void GLInProcessContextImpl::SetContextLostCallback( | 121 void GLInProcessContextImpl::SetContextLostCallback( |
127 const base::Closure& callback) { | 122 const base::Closure& callback) { |
128 context_lost_callback_ = callback; | 123 context_lost_callback_ = callback; |
129 } | 124 } |
130 | 125 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 gpu_preference, | 306 gpu_preference, |
312 service, | 307 service, |
313 gpu_memory_buffer_manager, | 308 gpu_memory_buffer_manager, |
314 image_factory)) | 309 image_factory)) |
315 return NULL; | 310 return NULL; |
316 | 311 |
317 return context.release(); | 312 return context.release(); |
318 } | 313 } |
319 | 314 |
320 } // namespace gpu | 315 } // namespace gpu |
OLD | NEW |