| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/memory/shared_memory.h" | 6 #include "base/memory/shared_memory.h" |
| 7 #include "base/numerics/safe_math.h" | 7 #include "base/numerics/safe_math.h" |
| 8 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 8 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
| 9 #include "content/common/gpu/media/gpu_video_accelerator_util.h" | 9 #include "content/common/gpu/media/gpu_video_accelerator_util.h" |
| 10 #include "content/common/pepper_file_util.h" | 10 #include "content/common/pepper_file_util.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 | 506 |
| 507 std::vector<int32> attribs(1, PP_GRAPHICS3DATTRIB_NONE); | 507 std::vector<int32> attribs(1, PP_GRAPHICS3DATTRIB_NONE); |
| 508 command_buffer_ = channel_->CreateOffscreenCommandBuffer( | 508 command_buffer_ = channel_->CreateOffscreenCommandBuffer( |
| 509 gfx::Size(), nullptr, attribs, GURL::EmptyGURL(), | 509 gfx::Size(), nullptr, attribs, GURL::EmptyGURL(), |
| 510 gfx::PreferIntegratedGpu); | 510 gfx::PreferIntegratedGpu); |
| 511 if (!command_buffer_) { | 511 if (!command_buffer_) { |
| 512 Close(); | 512 Close(); |
| 513 return false; | 513 return false; |
| 514 } | 514 } |
| 515 | 515 |
| 516 command_buffer_->SetChannelErrorCallback(media::BindToCurrentLoop( | 516 command_buffer_->SetContextLostCallback(media::BindToCurrentLoop( |
| 517 base::Bind(&PepperVideoEncoderHost::NotifyPepperError, | 517 base::Bind(&PepperVideoEncoderHost::NotifyPepperError, |
| 518 weak_ptr_factory_.GetWeakPtr(), PP_ERROR_RESOURCE_FAILED))); | 518 weak_ptr_factory_.GetWeakPtr(), PP_ERROR_RESOURCE_FAILED))); |
| 519 if (!command_buffer_->Initialize()) { | 519 if (!command_buffer_->Initialize()) { |
| 520 Close(); | 520 Close(); |
| 521 return false; | 521 return false; |
| 522 } | 522 } |
| 523 | 523 |
| 524 return true; | 524 return true; |
| 525 } | 525 } |
| 526 | 526 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 } | 665 } |
| 666 | 666 |
| 667 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32 buffer_id) { | 667 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32 buffer_id) { |
| 668 DCHECK(RenderThreadImpl::current()); | 668 DCHECK(RenderThreadImpl::current()); |
| 669 DCHECK_GE(buffer_id, 0); | 669 DCHECK_GE(buffer_id, 0); |
| 670 DCHECK_LT(buffer_id, static_cast<int32>(shm_buffers_.size())); | 670 DCHECK_LT(buffer_id, static_cast<int32>(shm_buffers_.size())); |
| 671 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); | 671 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); |
| 672 } | 672 } |
| 673 | 673 |
| 674 } // namespace content | 674 } // namespace content |
| OLD | NEW |