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 "content/common/gpu/gpu_channel.h" | 5 #include "content/common/gpu/gpu_channel.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
8 #include <windows.h> | 10 #include <windows.h> |
9 #endif | 11 #endif |
10 | 12 |
11 #include <algorithm> | 13 #include <algorithm> |
12 #include <deque> | 14 #include <deque> |
13 #include <set> | 15 #include <set> |
14 #include <vector> | 16 #include <vector> |
15 | 17 |
16 #include "base/atomicops.h" | 18 #include "base/atomicops.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 DCHECK_EQ((uint32_t)GpuCommandBufferMsg_InsertSyncPoint::ID, message.type()); | 122 DCHECK_EQ((uint32_t)GpuCommandBufferMsg_InsertSyncPoint::ID, message.type()); |
121 DCHECK(sync_point); | 123 DCHECK(sync_point); |
122 base::AutoLock auto_lock(channel_messages_lock_); | 124 base::AutoLock auto_lock(channel_messages_lock_); |
123 if (enabled_) { | 125 if (enabled_) { |
124 *sync_point = sync_point_manager_->GenerateSyncPoint(); | 126 *sync_point = sync_point_manager_->GenerateSyncPoint(); |
125 | 127 |
126 scoped_ptr<GpuChannelMessage> msg(new GpuChannelMessage(message)); | 128 scoped_ptr<GpuChannelMessage> msg(new GpuChannelMessage(message)); |
127 msg->retire_sync_point = retire_sync_point; | 129 msg->retire_sync_point = retire_sync_point; |
128 msg->sync_point = *sync_point; | 130 msg->sync_point = *sync_point; |
129 | 131 |
130 PushMessageHelper(msg.Pass()); | 132 PushMessageHelper(std::move(msg)); |
131 return true; | 133 return true; |
132 } | 134 } |
133 return false; | 135 return false; |
134 } | 136 } |
135 | 137 |
136 bool GpuChannelMessageQueue::HasQueuedMessages() const { | 138 bool GpuChannelMessageQueue::HasQueuedMessages() const { |
137 base::AutoLock auto_lock(channel_messages_lock_); | 139 base::AutoLock auto_lock(channel_messages_lock_); |
138 return !channel_messages_.empty(); | 140 return !channel_messages_.empty(); |
139 } | 141 } |
140 | 142 |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 } | 740 } |
739 | 741 |
740 if (stream_it != streams_.end()) { | 742 if (stream_it != streams_.end()) { |
741 stream_it->second.AddRoute(route_id); | 743 stream_it->second.AddRoute(route_id); |
742 } else { | 744 } else { |
743 StreamState stream(stream_id, stream_priority); | 745 StreamState stream(stream_id, stream_priority); |
744 stream.AddRoute(route_id); | 746 stream.AddRoute(route_id); |
745 streams_.insert(std::make_pair(stream_id, stream)); | 747 streams_.insert(std::make_pair(stream_id, stream)); |
746 } | 748 } |
747 | 749 |
748 stubs_.set(route_id, stub.Pass()); | 750 stubs_.set(route_id, std::move(stub)); |
749 return CREATE_COMMAND_BUFFER_SUCCEEDED; | 751 return CREATE_COMMAND_BUFFER_SUCCEEDED; |
750 } | 752 } |
751 | 753 |
752 GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32_t route_id) { | 754 GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32_t route_id) { |
753 return stubs_.get(route_id); | 755 return stubs_.get(route_id); |
754 } | 756 } |
755 | 757 |
756 void GpuChannel::LoseAllContexts() { | 758 void GpuChannel::LoseAllContexts() { |
757 gpu_channel_manager_->LoseAllContexts(); | 759 gpu_channel_manager_->LoseAllContexts(); |
758 } | 760 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 } | 959 } |
958 | 960 |
959 if (stream_it != streams_.end()) { | 961 if (stream_it != streams_.end()) { |
960 stream_it->second.AddRoute(route_id); | 962 stream_it->second.AddRoute(route_id); |
961 } else { | 963 } else { |
962 StreamState stream(stream_id, stream_priority); | 964 StreamState stream(stream_id, stream_priority); |
963 stream.AddRoute(route_id); | 965 stream.AddRoute(route_id); |
964 streams_.insert(std::make_pair(stream_id, stream)); | 966 streams_.insert(std::make_pair(stream_id, stream)); |
965 } | 967 } |
966 | 968 |
967 stubs_.set(route_id, stub.Pass()); | 969 stubs_.set(route_id, std::move(stub)); |
968 *succeeded = true; | 970 *succeeded = true; |
969 } | 971 } |
970 | 972 |
971 void GpuChannel::OnDestroyCommandBuffer(int32_t route_id) { | 973 void GpuChannel::OnDestroyCommandBuffer(int32_t route_id) { |
972 TRACE_EVENT1("gpu", "GpuChannel::OnDestroyCommandBuffer", | 974 TRACE_EVENT1("gpu", "GpuChannel::OnDestroyCommandBuffer", |
973 "route_id", route_id); | 975 "route_id", route_id); |
974 | 976 |
975 scoped_ptr<GpuCommandBufferStub> stub = stubs_.take_and_erase(route_id); | 977 scoped_ptr<GpuCommandBufferStub> stub = stubs_.take_and_erase(route_id); |
976 | 978 |
977 if (!stub) | 979 if (!stub) |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 } | 1071 } |
1070 } | 1072 } |
1071 } | 1073 } |
1072 | 1074 |
1073 void GpuChannel::HandleUpdateValueState( | 1075 void GpuChannel::HandleUpdateValueState( |
1074 unsigned int target, const gpu::ValueState& state) { | 1076 unsigned int target, const gpu::ValueState& state) { |
1075 pending_valuebuffer_state_->UpdateState(target, state); | 1077 pending_valuebuffer_state_->UpdateState(target, state); |
1076 } | 1078 } |
1077 | 1079 |
1078 } // namespace content | 1080 } // namespace content |
OLD | NEW |