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 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 } | 873 } |
874 } | 874 } |
875 | 875 |
876 void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer( | 876 void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer( |
877 int32 id, | 877 int32 id, |
878 gfx::GpuMemoryBufferHandle gpu_memory_buffer, | 878 gfx::GpuMemoryBufferHandle gpu_memory_buffer, |
879 uint32 width, | 879 uint32 width, |
880 uint32 height, | 880 uint32 height, |
881 uint32 internalformat) { | 881 uint32 internalformat) { |
882 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnRegisterGpuMemoryBuffer"); | 882 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnRegisterGpuMemoryBuffer"); |
| 883 #if defined(OS_ANDROID) |
| 884 // Verify that renderer is not trying to use a surface texture it doesn't own. |
| 885 if (gpu_memory_buffer.type == gfx::SURFACE_TEXTURE_BUFFER && |
| 886 gpu_memory_buffer.surface_texture_id.secondary_id != |
| 887 channel()->client_id()) { |
| 888 LOG(ERROR) << "Illegal surface texture ID for renderer."; |
| 889 return; |
| 890 } |
| 891 #endif |
883 if (gpu_control_) { | 892 if (gpu_control_) { |
884 gpu_control_->RegisterGpuMemoryBuffer(id, | 893 gpu_control_->RegisterGpuMemoryBuffer(id, |
885 gpu_memory_buffer, | 894 gpu_memory_buffer, |
886 width, | 895 width, |
887 height, | 896 height, |
888 internalformat); | 897 internalformat); |
889 } | 898 } |
890 } | 899 } |
891 | 900 |
892 void GpuCommandBufferStub::OnDestroyGpuMemoryBuffer(int32 id) { | 901 void GpuCommandBufferStub::OnDestroyGpuMemoryBuffer(int32 id) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 if (decoder_) | 995 if (decoder_) |
987 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); | 996 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); |
988 command_buffer_->SetParseError(gpu::error::kLostContext); | 997 command_buffer_->SetParseError(gpu::error::kLostContext); |
989 } | 998 } |
990 | 999 |
991 uint64 GpuCommandBufferStub::GetMemoryUsage() const { | 1000 uint64 GpuCommandBufferStub::GetMemoryUsage() const { |
992 return GetMemoryManager()->GetClientMemoryUsage(this); | 1001 return GetMemoryManager()->GetClientMemoryUsage(this); |
993 } | 1002 } |
994 | 1003 |
995 } // namespace content | 1004 } // namespace content |
OLD | NEW |