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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/hash.h" | 9 #include "base/hash.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 863 } | 863 } |
| 864 } | 864 } |
| 865 | 865 |
| 866 void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer( | 866 void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer( |
| 867 int32 id, | 867 int32 id, |
| 868 gfx::GpuMemoryBufferHandle gpu_memory_buffer, | 868 gfx::GpuMemoryBufferHandle gpu_memory_buffer, |
| 869 uint32 width, | 869 uint32 width, |
| 870 uint32 height, | 870 uint32 height, |
| 871 uint32 internalformat) { | 871 uint32 internalformat) { |
| 872 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnRegisterGpuMemoryBuffer"); | 872 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnRegisterGpuMemoryBuffer"); |
| 873 #if defined(OS_ANDROID) | |
| 874 // Verify that renderer is not trying to use a surface texture it doesn't own. | |
| 875 if (gpu_memory_buffer.type == gfx::SURFACE_TEXTURE_BUFFER && | |
| 876 gpu_memory_buffer.surface_texture_id.secondary_id != | |
| 877 channel()->renderer_pid()) { | |
|
piman
2014/03/27 01:07:25
nit: rather than the PID, use the channel's client
reveman
2014/03/27 14:48:11
Oh, I didn't know that we shared this id the GPU s
| |
| 878 LOG(ERROR) << "Illegal surface texture ID for renderer."; | |
| 879 return; | |
| 880 } | |
| 881 #endif | |
| 873 if (gpu_control_) { | 882 if (gpu_control_) { |
| 874 gpu_control_->RegisterGpuMemoryBuffer(id, | 883 gpu_control_->RegisterGpuMemoryBuffer(id, |
| 875 gpu_memory_buffer, | 884 gpu_memory_buffer, |
| 876 width, | 885 width, |
| 877 height, | 886 height, |
| 878 internalformat); | 887 internalformat); |
| 879 } | 888 } |
| 880 } | 889 } |
| 881 | 890 |
| 882 void GpuCommandBufferStub::OnDestroyGpuMemoryBuffer(int32 id) { | 891 void GpuCommandBufferStub::OnDestroyGpuMemoryBuffer(int32 id) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 976 if (decoder_) | 985 if (decoder_) |
| 977 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); | 986 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); |
| 978 command_buffer_->SetParseError(gpu::error::kLostContext); | 987 command_buffer_->SetParseError(gpu::error::kLostContext); |
| 979 } | 988 } |
| 980 | 989 |
| 981 uint64 GpuCommandBufferStub::GetMemoryUsage() const { | 990 uint64 GpuCommandBufferStub::GetMemoryUsage() const { |
| 982 return GetMemoryManager()->GetClientMemoryUsage(this); | 991 return GetMemoryManager()->GetClientMemoryUsage(this); |
| 983 } | 992 } |
| 984 | 993 |
| 985 } // namespace content | 994 } // namespace content |
| OLD | NEW |