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

Side by Side Diff: content/common/gpu/client/command_buffer_proxy_impl.cc

Issue 255713008: Change glimage to accept a type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
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 "content/common/gpu/client/command_buffer_proxy_impl.h" 5 #include "content/common/gpu/client/command_buffer_proxy_impl.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 304 }
305 305
306 gpu::Capabilities CommandBufferProxyImpl::GetCapabilities() { 306 gpu::Capabilities CommandBufferProxyImpl::GetCapabilities() {
307 return capabilities_; 307 return capabilities_;
308 } 308 }
309 309
310 gfx::GpuMemoryBuffer* CommandBufferProxyImpl::CreateGpuMemoryBuffer( 310 gfx::GpuMemoryBuffer* CommandBufferProxyImpl::CreateGpuMemoryBuffer(
311 size_t width, 311 size_t width,
312 size_t height, 312 size_t height,
313 unsigned internalformat, 313 unsigned internalformat,
314 unsigned usage,
314 int32* id) { 315 int32* id) {
315 *id = -1; 316 *id = -1;
316 317
317 if (last_state_.error != gpu::error::kNoError) 318 if (last_state_.error != gpu::error::kNoError)
318 return NULL; 319 return NULL;
319 320
320 int32 new_id = channel_->ReserveGpuMemoryBufferId(); 321 int32 new_id = channel_->ReserveGpuMemoryBufferId();
321 DCHECK(gpu_memory_buffers_.find(new_id) == gpu_memory_buffers_.end()); 322 DCHECK(gpu_memory_buffers_.find(new_id) == gpu_memory_buffers_.end());
322 323
323 scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer( 324 scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer(
324 channel_->factory()->AllocateGpuMemoryBuffer(width, 325 channel_->factory()->AllocateGpuMemoryBuffer(
325 height, 326 width, height, internalformat, usage));
326 internalformat));
327 if (!gpu_memory_buffer) 327 if (!gpu_memory_buffer)
328 return NULL; 328 return NULL;
329 329
330 DCHECK(GpuChannelHost::IsValidGpuMemoryBuffer( 330 DCHECK(GpuChannelHost::IsValidGpuMemoryBuffer(
331 gpu_memory_buffer->GetHandle())); 331 gpu_memory_buffer->GetHandle()));
332 332
333 // This handle is owned by the GPU process and must be passed to it or it 333 // This handle is owned by the GPU process and must be passed to it or it
334 // will leak. In otherwords, do not early out on error between here and the 334 // will leak. In otherwords, do not early out on error between here and the
335 // sending of the RegisterGpuMemoryBuffer IPC below. 335 // sending of the RegisterGpuMemoryBuffer IPC below.
336 gfx::GpuMemoryBufferHandle handle = 336 gfx::GpuMemoryBufferHandle handle =
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 if (last_state_.error == gpu::error::kNoError) 524 if (last_state_.error == gpu::error::kNoError)
525 shared_state()->Read(&last_state_); 525 shared_state()->Read(&last_state_);
526 } 526 }
527 527
528 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const { 528 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const {
529 return reinterpret_cast<gpu::CommandBufferSharedState*>( 529 return reinterpret_cast<gpu::CommandBufferSharedState*>(
530 shared_state_shm_->memory()); 530 shared_state_shm_->memory());
531 } 531 }
532 532
533 } // namespace content 533 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698