Chromium Code Reviews| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 429 if (!buffer) | 429 if (!buffer) |
| 430 return -1; | 430 return -1; |
| 431 | 431 |
| 432 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); | 432 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); |
| 433 } | 433 } |
| 434 | 434 |
| 435 int CommandBufferProxyImpl::GetRouteID() const { | 435 int CommandBufferProxyImpl::GetRouteID() const { |
| 436 return route_id_; | 436 return route_id_; |
| 437 } | 437 } |
| 438 | 438 |
| 439 uint32 CommandBufferProxyImpl::CreateStreamTexture(uint32 texture_id) { | 439 uint32 CommandBufferProxyImpl::CreateStreamTexture(uint32 texture_id) { |
|
no sievers
2015/07/20 23:33:08
Do we need to keep around the old version or can i
| |
| 440 CheckLock(); | 440 CheckLock(); |
| 441 if (last_state_.error != gpu::error::kNoError) | 441 if (last_state_.error != gpu::error::kNoError) |
| 442 return 0; | 442 return 0; |
| 443 | 443 |
| 444 int32 stream_id = channel_->GenerateRouteID(); | 444 int32 stream_id = channel_->GenerateRouteID(); |
| 445 bool succeeded = false; | 445 bool succeeded = false; |
| 446 Send(new GpuCommandBufferMsg_CreateStreamTexture( | 446 Send(new GpuCommandBufferMsg_CreateStreamTexture( |
| 447 route_id_, texture_id, stream_id, &succeeded)); | 447 route_id_, texture_id, stream_id, &succeeded)); |
| 448 if (!succeeded) { | 448 if (!succeeded) { |
| 449 DLOG(ERROR) << "GpuCommandBufferMsg_CreateStreamTexture returned failure"; | 449 DLOG(ERROR) << "GpuCommandBufferMsg_CreateStreamTexture returned failure"; |
| 450 return 0; | 450 return 0; |
| 451 } | 451 } |
| 452 return stream_id; | 452 return stream_id; |
| 453 } | 453 } |
| 454 | 454 |
| 455 uint32 CommandBufferProxyImpl::CreateStreamTextureImage(int32 image_id) { | |
|
no sievers
2015/07/20 23:33:08
It would be nice if we could return the image_id h
| |
| 456 CheckLock(); | |
| 457 if (last_state_.error != gpu::error::kNoError) | |
| 458 return 0; | |
| 459 | |
| 460 int32 stream_id = channel_->GenerateRouteID(); | |
| 461 bool succeeded = false; | |
| 462 Send(new GpuCommandBufferMsg_CreateStreamTextureImage(route_id_, image_id, | |
| 463 stream_id, &succeeded)); | |
| 464 if (!succeeded) { | |
| 465 DLOG(ERROR) | |
| 466 << "GpuCommandBufferMsg_CreateStreamTextureImage returned failure"; | |
| 467 return 0; | |
| 468 } | |
| 469 return stream_id; | |
| 470 } | |
| 471 | |
| 455 void CommandBufferProxyImpl::SetLock(base::Lock* lock) { | 472 void CommandBufferProxyImpl::SetLock(base::Lock* lock) { |
| 456 lock_ = lock; | 473 lock_ = lock; |
| 457 } | 474 } |
| 458 | 475 |
| 459 bool CommandBufferProxyImpl::IsGpuChannelLost() { | 476 bool CommandBufferProxyImpl::IsGpuChannelLost() { |
| 460 return !channel_ || channel_->IsLost(); | 477 return !channel_ || channel_->IsLost(); |
| 461 } | 478 } |
| 462 | 479 |
| 463 uint32 CommandBufferProxyImpl::InsertSyncPoint() { | 480 uint32 CommandBufferProxyImpl::InsertSyncPoint() { |
| 464 CheckLock(); | 481 CheckLock(); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 625 } | 642 } |
| 626 } | 643 } |
| 627 | 644 |
| 628 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, | 645 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, |
| 629 base::TimeDelta interval) { | 646 base::TimeDelta interval) { |
| 630 if (!update_vsync_parameters_completion_callback_.is_null()) | 647 if (!update_vsync_parameters_completion_callback_.is_null()) |
| 631 update_vsync_parameters_completion_callback_.Run(timebase, interval); | 648 update_vsync_parameters_completion_callback_.Run(timebase, interval); |
| 632 } | 649 } |
| 633 | 650 |
| 634 } // namespace content | 651 } // namespace content |
| OLD | NEW |