| 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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 if (!memory_manager_client_state_) { | 934 if (!memory_manager_client_state_) { |
| 935 memory_manager_client_state_.reset(GetMemoryManager()->CreateClientState( | 935 memory_manager_client_state_.reset(GetMemoryManager()->CreateClientState( |
| 936 this, surface_id_ != 0, true)); | 936 this, surface_id_ != 0, true)); |
| 937 } | 937 } |
| 938 } else { | 938 } else { |
| 939 memory_manager_client_state_.reset(); | 939 memory_manager_client_state_.reset(); |
| 940 } | 940 } |
| 941 } | 941 } |
| 942 | 942 |
| 943 void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer( | 943 void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer( |
| 944 int32 id, | 944 GpuCommandBufferMsg_RegisterGpuMemoryBuffer_Params params) { |
| 945 gfx::GpuMemoryBufferHandle gpu_memory_buffer, | |
| 946 uint32 width, | |
| 947 uint32 height, | |
| 948 uint32 internalformat) { | |
| 949 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnRegisterGpuMemoryBuffer"); | 945 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnRegisterGpuMemoryBuffer"); |
| 950 #if defined(OS_ANDROID) | 946 #if defined(OS_ANDROID) |
| 951 // Verify that renderer is not trying to use a surface texture it doesn't own. | 947 // Verify that renderer is not trying to use a surface texture it doesn't own. |
| 952 if (gpu_memory_buffer.type == gfx::SURFACE_TEXTURE_BUFFER && | 948 if (params.gpu_memory_buffer.type == gfx::SURFACE_TEXTURE_BUFFER && |
| 953 gpu_memory_buffer.surface_texture_id.secondary_id != | 949 params.gpu_memory_buffer.surface_texture_id.secondary_id != |
| 954 channel()->client_id()) { | 950 channel()->client_id()) { |
| 955 LOG(ERROR) << "Illegal surface texture ID for renderer."; | 951 LOG(ERROR) << "Illegal surface texture ID for renderer."; |
| 956 return; | 952 return; |
| 957 } | 953 } |
| 958 #endif | 954 #endif |
| 959 if (gpu_control_) { | 955 if (gpu_control_) { |
| 960 gpu_control_->RegisterGpuMemoryBuffer(id, | 956 gpu_control_->RegisterGpuMemoryBuffer(params.id, |
| 961 gpu_memory_buffer, | 957 params.gpu_memory_buffer, |
| 962 width, | 958 params.width, |
| 963 height, | 959 params.height, |
| 964 internalformat); | 960 params.internalformat, |
| 961 params.usage); |
| 965 } | 962 } |
| 966 } | 963 } |
| 967 | 964 |
| 968 void GpuCommandBufferStub::OnDestroyGpuMemoryBuffer(int32 id) { | 965 void GpuCommandBufferStub::OnDestroyGpuMemoryBuffer(int32 id) { |
| 969 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyGpuMemoryBuffer"); | 966 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyGpuMemoryBuffer"); |
| 970 if (gpu_control_) | 967 if (gpu_control_) |
| 971 gpu_control_->DestroyGpuMemoryBuffer(id); | 968 gpu_control_->DestroyGpuMemoryBuffer(id); |
| 972 } | 969 } |
| 973 | 970 |
| 974 void GpuCommandBufferStub::SendConsoleMessage( | 971 void GpuCommandBufferStub::SendConsoleMessage( |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 if (decoder_) | 1060 if (decoder_) |
| 1064 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); | 1061 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); |
| 1065 command_buffer_->SetParseError(gpu::error::kLostContext); | 1062 command_buffer_->SetParseError(gpu::error::kLostContext); |
| 1066 } | 1063 } |
| 1067 | 1064 |
| 1068 uint64 GpuCommandBufferStub::GetMemoryUsage() const { | 1065 uint64 GpuCommandBufferStub::GetMemoryUsage() const { |
| 1069 return GetMemoryManager()->GetClientMemoryUsage(this); | 1066 return GetMemoryManager()->GetClientMemoryUsage(this); |
| 1070 } | 1067 } |
| 1071 | 1068 |
| 1072 } // namespace content | 1069 } // namespace content |
| OLD | NEW |