| 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 "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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 DCHECK(gpu_memory_buffer); | 364 DCHECK(gpu_memory_buffer); |
| 365 | 365 |
| 366 // This handle is owned by the GPU process and must be passed to it or it | 366 // This handle is owned by the GPU process and must be passed to it or it |
| 367 // will leak. In otherwords, do not early out on error between here and the | 367 // will leak. In otherwords, do not early out on error between here and the |
| 368 // sending of the CreateImage IPC below. | 368 // sending of the CreateImage IPC below. |
| 369 bool requires_sync_point = false; | 369 bool requires_sync_point = false; |
| 370 gfx::GpuMemoryBufferHandle handle = | 370 gfx::GpuMemoryBufferHandle handle = |
| 371 channel_->ShareGpuMemoryBufferToGpuProcess(gpu_memory_buffer->GetHandle(), | 371 channel_->ShareGpuMemoryBufferToGpuProcess(gpu_memory_buffer->GetHandle(), |
| 372 &requires_sync_point); | 372 &requires_sync_point); |
| 373 | 373 |
| 374 DCHECK(gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat( |
| 375 gfx::Size(width, height), gpu_memory_buffer->GetFormat())); |
| 374 DCHECK(gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( | 376 DCHECK(gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
| 375 internalformat, gpu_memory_buffer->GetFormat())); | 377 internalformat, gpu_memory_buffer->GetFormat())); |
| 376 if (!Send(new GpuCommandBufferMsg_CreateImage(route_id_, | 378 if (!Send(new GpuCommandBufferMsg_CreateImage(route_id_, |
| 377 new_id, | 379 new_id, |
| 378 handle, | 380 handle, |
| 379 gfx::Size(width, height), | 381 gfx::Size(width, height), |
| 380 gpu_memory_buffer->GetFormat(), | 382 gpu_memory_buffer->GetFormat(), |
| 381 internalformat))) { | 383 internalformat))) { |
| 382 return -1; | 384 return -1; |
| 383 } | 385 } |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 } | 604 } |
| 603 } | 605 } |
| 604 | 606 |
| 605 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, | 607 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, |
| 606 base::TimeDelta interval) { | 608 base::TimeDelta interval) { |
| 607 if (!update_vsync_parameters_completion_callback_.is_null()) | 609 if (!update_vsync_parameters_completion_callback_.is_null()) |
| 608 update_vsync_parameters_completion_callback_.Run(timebase, interval); | 610 update_vsync_parameters_completion_callback_.Run(timebase, interval); |
| 609 } | 611 } |
| 610 | 612 |
| 611 } // namespace content | 613 } // namespace content |
| OLD | NEW |