| 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 "components/mus/gles2/command_buffer_type_conversions.h" | 11 #include "components/mus/gles2/command_buffer_type_conversions.h" |
| 11 #include "components/mus/gles2/gpu_memory_tracker.h" | 12 #include "components/mus/gles2/gpu_memory_tracker.h" |
| 12 #include "components/mus/gles2/gpu_state.h" | 13 #include "components/mus/gles2/gpu_state.h" |
| 13 #include "components/mus/gles2/mojo_buffer_backing.h" | 14 #include "components/mus/gles2/mojo_buffer_backing.h" |
| 14 #include "gpu/command_buffer/common/constants.h" | 15 #include "gpu/command_buffer/common/constants.h" |
| 15 #include "gpu/command_buffer/common/value_state.h" | 16 #include "gpu/command_buffer/common/value_state.h" |
| 16 #include "gpu/command_buffer/service/command_buffer_service.h" | 17 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 17 #include "gpu/command_buffer/service/context_group.h" | 18 #include "gpu/command_buffer/service/context_group.h" |
| 18 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 19 #include "gpu/command_buffer/service/gpu_scheduler.h" | 20 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 237 |
| 237 MojoPlatformHandle platform_handle; | 238 MojoPlatformHandle platform_handle; |
| 238 MojoResult extract_result = MojoExtractPlatformHandle( | 239 MojoResult extract_result = MojoExtractPlatformHandle( |
| 239 memory_handle.release().value(), &platform_handle); | 240 memory_handle.release().value(), &platform_handle); |
| 240 if (extract_result != MOJO_RESULT_OK) { | 241 if (extract_result != MOJO_RESULT_OK) { |
| 241 NOTREACHED(); | 242 NOTREACHED(); |
| 242 return; | 243 return; |
| 243 } | 244 } |
| 244 | 245 |
| 245 #if defined(OS_WIN) | 246 #if defined(OS_WIN) |
| 246 gfx_handle.handle = platform_handle; | 247 gfx_handle.handle = |
| 248 base::SharedMemoryHandle(platform_handle, base::GetCurrentProcId()); |
| 247 #else | 249 #else |
| 248 gfx_handle.handle = base::FileDescriptor(platform_handle, false); | 250 gfx_handle.handle = base::FileDescriptor(platform_handle, false); |
| 249 #endif | 251 #endif |
| 250 | 252 |
| 251 scoped_refptr<gfx::GLImageSharedMemory> image = | 253 scoped_refptr<gfx::GLImageSharedMemory> image = |
| 252 new gfx::GLImageSharedMemory(gfx_size, internal_format); | 254 new gfx::GLImageSharedMemory(gfx_size, internal_format); |
| 253 // TODO(jam): also need a mojo enum for this enum | 255 // TODO(jam): also need a mojo enum for this enum |
| 254 if (!image->Initialize(gfx_handle, gpu_format)) { | 256 if (!image->Initialize(gfx_handle, gpu_format)) { |
| 255 NOTREACHED(); | 257 NOTREACHED(); |
| 256 return; | 258 return; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 304 |
| 303 void CommandBufferDriver::DestroyDecoder() { | 305 void CommandBufferDriver::DestroyDecoder() { |
| 304 if (decoder_) { | 306 if (decoder_) { |
| 305 bool have_context = decoder_->MakeCurrent(); | 307 bool have_context = decoder_->MakeCurrent(); |
| 306 decoder_->Destroy(have_context); | 308 decoder_->Destroy(have_context); |
| 307 decoder_.reset(); | 309 decoder_.reset(); |
| 308 } | 310 } |
| 309 } | 311 } |
| 310 | 312 |
| 311 } // namespace mus | 313 } // namespace mus |
| OLD | NEW |