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 "gpu/ipc/service/gpu_command_buffer_stub.h" | 5 #include "gpu/ipc/service/gpu_command_buffer_stub.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 if (channel_->watchdog()) { | 822 if (channel_->watchdog()) { |
823 executor_->SetCommandProcessedCallback(base::Bind( | 823 executor_->SetCommandProcessedCallback(base::Bind( |
824 &GpuCommandBufferStub::OnCommandProcessed, base::Unretained(this))); | 824 &GpuCommandBufferStub::OnCommandProcessed, base::Unretained(this))); |
825 } | 825 } |
826 | 826 |
827 const size_t kSharedStateSize = sizeof(CommandBufferSharedState); | 827 const size_t kSharedStateSize = sizeof(CommandBufferSharedState); |
828 if (!shared_state_shm->Map(kSharedStateSize)) { | 828 if (!shared_state_shm->Map(kSharedStateSize)) { |
829 DLOG(ERROR) << "Failed to map shared state buffer."; | 829 DLOG(ERROR) << "Failed to map shared state buffer."; |
830 return false; | 830 return false; |
831 } | 831 } |
| 832 const int kImportance = 2; |
| 833 shared_state_shm->set_importance(kImportance); |
832 command_buffer_->SetSharedStateBuffer(MakeBackingFromSharedMemory( | 834 command_buffer_->SetSharedStateBuffer(MakeBackingFromSharedMemory( |
833 std::move(shared_state_shm), kSharedStateSize)); | 835 std::move(shared_state_shm), kSharedStateSize)); |
834 | 836 |
835 if (offscreen && !active_url_.is_empty()) | 837 if (offscreen && !active_url_.is_empty()) |
836 manager->delegate()->DidCreateOffscreenContext(active_url_); | 838 manager->delegate()->DidCreateOffscreenContext(active_url_); |
837 | 839 |
838 if (use_virtualized_gl_context_) { | 840 if (use_virtualized_gl_context_) { |
839 // If virtualized GL contexts are in use, then real GL context state | 841 // If virtualized GL contexts are in use, then real GL context state |
840 // is in an indeterminate state, since the GLStateRestorer was not | 842 // is in an indeterminate state, since the GLStateRestorer was not |
841 // initialized at the time the GLContextVirtual was made current. In | 843 // initialized at the time the GLContextVirtual was made current. In |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnRegisterTransferBuffer"); | 1008 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnRegisterTransferBuffer"); |
1007 | 1009 |
1008 // Take ownership of the memory and map it into this process. | 1010 // Take ownership of the memory and map it into this process. |
1009 // This validates the size. | 1011 // This validates the size. |
1010 std::unique_ptr<base::SharedMemory> shared_memory( | 1012 std::unique_ptr<base::SharedMemory> shared_memory( |
1011 new base::SharedMemory(transfer_buffer, false)); | 1013 new base::SharedMemory(transfer_buffer, false)); |
1012 if (!shared_memory->Map(size)) { | 1014 if (!shared_memory->Map(size)) { |
1013 DVLOG(0) << "Failed to map shared memory."; | 1015 DVLOG(0) << "Failed to map shared memory."; |
1014 return; | 1016 return; |
1015 } | 1017 } |
1016 | 1018 const int kImportance = 2; |
| 1019 shared_memory->set_importance(kImportance); |
1017 if (command_buffer_) { | 1020 if (command_buffer_) { |
1018 command_buffer_->RegisterTransferBuffer( | 1021 command_buffer_->RegisterTransferBuffer( |
1019 id, MakeBackingFromSharedMemory(std::move(shared_memory), size)); | 1022 id, MakeBackingFromSharedMemory(std::move(shared_memory), size)); |
1020 } | 1023 } |
1021 } | 1024 } |
1022 | 1025 |
1023 void GpuCommandBufferStub::OnDestroyTransferBuffer(int32_t id) { | 1026 void GpuCommandBufferStub::OnDestroyTransferBuffer(int32_t id) { |
1024 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyTransferBuffer"); | 1027 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyTransferBuffer"); |
1025 | 1028 |
1026 if (command_buffer_) | 1029 if (command_buffer_) |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 command_buffer_->GetLastState().error == error::kLostContext) | 1262 command_buffer_->GetLastState().error == error::kLostContext) |
1260 return; | 1263 return; |
1261 | 1264 |
1262 command_buffer_->SetContextLostReason(error::kUnknown); | 1265 command_buffer_->SetContextLostReason(error::kUnknown); |
1263 if (decoder_) | 1266 if (decoder_) |
1264 decoder_->MarkContextLost(error::kUnknown); | 1267 decoder_->MarkContextLost(error::kUnknown); |
1265 command_buffer_->SetParseError(error::kLostContext); | 1268 command_buffer_->SetParseError(error::kLostContext); |
1266 } | 1269 } |
1267 | 1270 |
1268 } // namespace gpu | 1271 } // namespace gpu |
OLD | NEW |