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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoEncoder, | 228 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoEncoder, |
229 OnCreateVideoEncoder) | 229 OnCreateVideoEncoder) |
230 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, | 230 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, |
231 OnSetSurfaceVisible) | 231 OnSetSurfaceVisible) |
232 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint, | 232 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint, |
233 OnRetireSyncPoint) | 233 OnRetireSyncPoint) |
234 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint, | 234 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint, |
235 OnSignalSyncPoint) | 235 OnSignalSyncPoint) |
236 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalQuery, | 236 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalQuery, |
237 OnSignalQuery) | 237 OnSignalQuery) |
238 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SendClientManagedMemoryStats, | |
239 OnReceivedClientManagedMemoryStats) | |
240 IPC_MESSAGE_HANDLER( | 238 IPC_MESSAGE_HANDLER( |
241 GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback, | 239 GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback, |
242 OnSetClientHasMemoryAllocationChangedCallback) | 240 OnSetClientHasMemoryAllocationChangedCallback) |
243 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterGpuMemoryBuffer, | 241 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterGpuMemoryBuffer, |
244 OnRegisterGpuMemoryBuffer); | 242 OnRegisterGpuMemoryBuffer); |
245 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyGpuMemoryBuffer, | 243 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyGpuMemoryBuffer, |
246 OnDestroyGpuMemoryBuffer); | 244 OnDestroyGpuMemoryBuffer); |
247 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateStreamTexture, | 245 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateStreamTexture, |
248 OnCreateStreamTexture) | 246 OnCreateStreamTexture) |
249 IPC_MESSAGE_UNHANDLED(handled = false) | 247 IPC_MESSAGE_UNHANDLED(handled = false) |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 id)); | 893 id)); |
896 return; | 894 return; |
897 } | 895 } |
898 } | 896 } |
899 } | 897 } |
900 // Something went wrong, run callback immediately. | 898 // Something went wrong, run callback immediately. |
901 OnSignalSyncPointAck(id); | 899 OnSignalSyncPointAck(id); |
902 } | 900 } |
903 | 901 |
904 | 902 |
905 void GpuCommandBufferStub::OnReceivedClientManagedMemoryStats( | |
906 const gpu::ManagedMemoryStats& stats) { | |
907 TRACE_EVENT0( | |
908 "gpu", | |
909 "GpuCommandBufferStub::OnReceivedClientManagedMemoryStats"); | |
910 if (memory_manager_client_state_) | |
911 memory_manager_client_state_->SetManagedMemoryStats(stats); | |
912 } | |
913 | |
914 void GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback( | 903 void GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback( |
915 bool has_callback) { | 904 bool has_callback) { |
916 TRACE_EVENT0( | 905 TRACE_EVENT0( |
917 "gpu", | 906 "gpu", |
918 "GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback"); | 907 "GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback"); |
919 if (has_callback) { | 908 if (has_callback) { |
920 if (!memory_manager_client_state_) { | 909 if (!memory_manager_client_state_) { |
921 memory_manager_client_state_.reset(GetMemoryManager()->CreateClientState( | 910 memory_manager_client_state_.reset(GetMemoryManager()->CreateClientState( |
922 this, surface_id_ != 0, true)); | 911 this, surface_id_ != 0, true)); |
923 } | 912 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 if (decoder_) | 1035 if (decoder_) |
1047 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); | 1036 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); |
1048 command_buffer_->SetParseError(gpu::error::kLostContext); | 1037 command_buffer_->SetParseError(gpu::error::kLostContext); |
1049 } | 1038 } |
1050 | 1039 |
1051 uint64 GpuCommandBufferStub::GetMemoryUsage() const { | 1040 uint64 GpuCommandBufferStub::GetMemoryUsage() const { |
1052 return GetMemoryManager()->GetClientMemoryUsage(this); | 1041 return GetMemoryManager()->GetClientMemoryUsage(this); |
1053 } | 1042 } |
1054 | 1043 |
1055 } // namespace content | 1044 } // namespace content |
OLD | NEW |