Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: components/mus/gles2/command_buffer_driver.cc

Issue 1390143002: Revert of Re-land: ui: Add GLImage unit test framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/BUILD.gn ('k') | components/mus/mus_app.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 internal_format, gpu_format)) { 223 internal_format, gpu_format)) {
224 LOG(ERROR) << "Incompatible image format."; 224 LOG(ERROR) << "Incompatible image format.";
225 return; 225 return;
226 } 226 }
227 227
228 if (type != gfx::SHARED_MEMORY_BUFFER) { 228 if (type != gfx::SHARED_MEMORY_BUFFER) {
229 NOTIMPLEMENTED(); 229 NOTIMPLEMENTED();
230 return; 230 return;
231 } 231 }
232 232
233 gfx::GpuMemoryBufferHandle gfx_handle;
234 // TODO(jam): create mojo enum for this and converter
235 gfx_handle.type = static_cast<gfx::GpuMemoryBufferType>(type);
236 gfx_handle.id = gfx::GpuMemoryBufferId(id);
237
233 MojoPlatformHandle platform_handle; 238 MojoPlatformHandle platform_handle;
234 MojoResult extract_result = MojoExtractPlatformHandle( 239 MojoResult extract_result = MojoExtractPlatformHandle(
235 memory_handle.release().value(), &platform_handle); 240 memory_handle.release().value(), &platform_handle);
236 if (extract_result != MOJO_RESULT_OK) { 241 if (extract_result != MOJO_RESULT_OK) {
237 NOTREACHED(); 242 NOTREACHED();
238 return; 243 return;
239 } 244 }
240 245
241 base::SharedMemoryHandle handle;
242 #if defined(OS_WIN) 246 #if defined(OS_WIN)
243 handle = base::SharedMemoryHandle(platform_handle, base::GetCurrentProcId()); 247 gfx_handle.handle =
248 base::SharedMemoryHandle(platform_handle, base::GetCurrentProcId());
244 #else 249 #else
245 handle = base::FileDescriptor(platform_handle, false); 250 gfx_handle.handle = base::FileDescriptor(platform_handle, false);
246 #endif 251 #endif
247 252
248 scoped_refptr<gfx::GLImageSharedMemory> image = 253 scoped_refptr<gfx::GLImageSharedMemory> image =
249 new gfx::GLImageSharedMemory(gfx_size, internal_format); 254 new gfx::GLImageSharedMemory(gfx_size, internal_format);
250 // TODO(jam): also need a mojo enum for this enum 255 // TODO(jam): also need a mojo enum for this enum
251 if (!image->Initialize(handle, gfx::GpuMemoryBufferId(id), gpu_format)) { 256 if (!image->Initialize(gfx_handle, gpu_format)) {
252 NOTREACHED(); 257 NOTREACHED();
253 return; 258 return;
254 } 259 }
255 260
256 image_manager->AddImage(image.get(), id); 261 image_manager->AddImage(image.get(), id);
257 } 262 }
258 263
259 void CommandBufferDriver::DestroyImage(int32_t id) { 264 void CommandBufferDriver::DestroyImage(int32_t id) {
260 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); 265 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
261 if (!image_manager->LookupImage(id)) { 266 if (!image_manager->LookupImage(id)) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 304
300 void CommandBufferDriver::DestroyDecoder() { 305 void CommandBufferDriver::DestroyDecoder() {
301 if (decoder_) { 306 if (decoder_) {
302 bool have_context = decoder_->MakeCurrent(); 307 bool have_context = decoder_->MakeCurrent();
303 decoder_->Destroy(have_context); 308 decoder_->Destroy(have_context);
304 decoder_.reset(); 309 decoder_.reset();
305 } 310 }
306 } 311 }
307 312
308 } // namespace mus 313 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/BUILD.gn ('k') | components/mus/mus_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698