OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/mus/gles2/command_buffer_driver.h" | 5 #include "components/mus/gles2/command_buffer_driver.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 return; | 242 return; |
243 } | 243 } |
244 | 244 |
245 base::SharedMemoryHandle handle; | 245 base::SharedMemoryHandle handle; |
246 #if defined(OS_WIN) | 246 #if defined(OS_WIN) |
247 handle = base::SharedMemoryHandle(platform_handle, base::GetCurrentProcId()); | 247 handle = base::SharedMemoryHandle(platform_handle, base::GetCurrentProcId()); |
248 #else | 248 #else |
249 handle = base::FileDescriptor(platform_handle, false); | 249 handle = base::FileDescriptor(platform_handle, false); |
250 #endif | 250 #endif |
251 | 251 |
252 scoped_refptr<gfx::GLImageSharedMemory> image = | 252 scoped_refptr<gl::GLImageSharedMemory> image = |
253 new gfx::GLImageSharedMemory(gfx_size, internal_format); | 253 new gl::GLImageSharedMemory(gfx_size, internal_format); |
254 // TODO(jam): also need a mojo enum for this enum | 254 // TODO(jam): also need a mojo enum for this enum |
255 if (!image->Initialize(handle, gfx::GpuMemoryBufferId(id), gpu_format, 0)) { | 255 if (!image->Initialize(handle, gfx::GpuMemoryBufferId(id), gpu_format, 0)) { |
256 NOTREACHED(); | 256 NOTREACHED(); |
257 return; | 257 return; |
258 } | 258 } |
259 | 259 |
260 image_manager->AddImage(image.get(), id); | 260 image_manager->AddImage(image.get(), id); |
261 } | 261 } |
262 | 262 |
263 void CommandBufferDriver::DestroyImage(int32_t id) { | 263 void CommandBufferDriver::DestroyImage(int32_t id) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 342 |
343 void CommandBufferDriver::DestroyDecoder() { | 343 void CommandBufferDriver::DestroyDecoder() { |
344 if (decoder_) { | 344 if (decoder_) { |
345 bool have_context = decoder_->MakeCurrent(); | 345 bool have_context = decoder_->MakeCurrent(); |
346 decoder_->Destroy(have_context); | 346 decoder_->Destroy(have_context); |
347 decoder_.reset(); | 347 decoder_.reset(); |
348 } | 348 } |
349 } | 349 } |
350 | 350 |
351 } // namespace mus | 351 } // namespace mus |
OLD | NEW |