| 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_channel.h" | 5 #include "gpu/ipc/service/gpu_channel.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 base::AutoLock auto_lock(channel_lock_); | 187 base::AutoLock auto_lock(channel_lock_); |
| 188 if (enabled_) { | 188 if (enabled_) { |
| 189 if (message.type() == GpuCommandBufferMsg_WaitForTokenInRange::ID || | 189 if (message.type() == GpuCommandBufferMsg_WaitForTokenInRange::ID || |
| 190 message.type() == GpuCommandBufferMsg_WaitForGetOffsetInRange::ID) { | 190 message.type() == GpuCommandBufferMsg_WaitForGetOffsetInRange::ID) { |
| 191 channel_->PostHandleOutOfOrderMessage(message); | 191 channel_->PostHandleOutOfOrderMessage(message); |
| 192 return true; | 192 return true; |
| 193 } | 193 } |
| 194 | 194 |
| 195 uint32_t order_num = sync_point_order_data_->GenerateUnprocessedOrderNumber( | 195 uint32_t order_num = sync_point_order_data_->GenerateUnprocessedOrderNumber( |
| 196 sync_point_manager_); | 196 sync_point_manager_); |
| 197 scoped_ptr<GpuChannelMessage> msg( | 197 std::unique_ptr<GpuChannelMessage> msg( |
| 198 new GpuChannelMessage(message, order_num, base::TimeTicks::Now())); | 198 new GpuChannelMessage(message, order_num, base::TimeTicks::Now())); |
| 199 | 199 |
| 200 if (channel_messages_.empty()) { | 200 if (channel_messages_.empty()) { |
| 201 DCHECK(scheduled_); | 201 DCHECK(scheduled_); |
| 202 channel_->PostHandleMessage(this); | 202 channel_->PostHandleMessage(this); |
| 203 } | 203 } |
| 204 | 204 |
| 205 channel_messages_.push_back(std::move(msg)); | 205 channel_messages_.push_back(std::move(msg)); |
| 206 | 206 |
| 207 if (preempting_flag_) | 207 if (preempting_flag_) |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 "not initialized"; | 951 "not initialized"; |
| 952 return; | 952 return; |
| 953 } | 953 } |
| 954 | 954 |
| 955 if (share_group && share_group->decoder()->WasContextLost()) { | 955 if (share_group && share_group->decoder()->WasContextLost()) { |
| 956 DLOG(ERROR) << "GpuChannel::OnCreateCommandBuffer(): shared context was " | 956 DLOG(ERROR) << "GpuChannel::OnCreateCommandBuffer(): shared context was " |
| 957 "already lost"; | 957 "already lost"; |
| 958 return; | 958 return; |
| 959 } | 959 } |
| 960 | 960 |
| 961 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( | 961 std::unique_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( |
| 962 this, sync_point_manager_, task_runner_.get(), share_group, | 962 this, sync_point_manager_, task_runner_.get(), share_group, |
| 963 surface_handle, mailbox_manager_.get(), preempted_flag_.get(), | 963 surface_handle, mailbox_manager_.get(), preempted_flag_.get(), |
| 964 subscription_ref_set_.get(), pending_valuebuffer_state_.get(), size, | 964 subscription_ref_set_.get(), pending_valuebuffer_state_.get(), size, |
| 965 disallowed_features_, init_params.attribs, init_params.gpu_preference, | 965 disallowed_features_, init_params.attribs, init_params.gpu_preference, |
| 966 init_params.stream_id, route_id, watchdog_, init_params.active_url)); | 966 init_params.stream_id, route_id, watchdog_, init_params.active_url)); |
| 967 | 967 |
| 968 scoped_refptr<GpuChannelMessageQueue> queue = LookupStream(stream_id); | 968 scoped_refptr<GpuChannelMessageQueue> queue = LookupStream(stream_id); |
| 969 if (!queue) | 969 if (!queue) |
| 970 queue = CreateStream(stream_id, stream_priority); | 970 queue = CreateStream(stream_id, stream_priority); |
| 971 | 971 |
| 972 if (!AddRoute(route_id, stream_id, stub.get())) { | 972 if (!AddRoute(route_id, stream_id, stub.get())) { |
| 973 DestroyStreamIfNecessary(queue); | 973 DestroyStreamIfNecessary(queue); |
| 974 DLOG(ERROR) << "GpuChannel::OnCreateCommandBuffer(): failed to add route"; | 974 DLOG(ERROR) << "GpuChannel::OnCreateCommandBuffer(): failed to add route"; |
| 975 return; | 975 return; |
| 976 } | 976 } |
| 977 | 977 |
| 978 stubs_.set(route_id, std::move(stub)); | 978 stubs_.set(route_id, std::move(stub)); |
| 979 *succeeded = true; | 979 *succeeded = true; |
| 980 } | 980 } |
| 981 | 981 |
| 982 void GpuChannel::OnDestroyCommandBuffer(int32_t route_id) { | 982 void GpuChannel::OnDestroyCommandBuffer(int32_t route_id) { |
| 983 TRACE_EVENT1("gpu", "GpuChannel::OnDestroyCommandBuffer", | 983 TRACE_EVENT1("gpu", "GpuChannel::OnDestroyCommandBuffer", |
| 984 "route_id", route_id); | 984 "route_id", route_id); |
| 985 | 985 |
| 986 scoped_ptr<GpuCommandBufferStub> stub = stubs_.take_and_erase(route_id); | 986 std::unique_ptr<GpuCommandBufferStub> stub = stubs_.take_and_erase(route_id); |
| 987 // In case the renderer is currently blocked waiting for a sync reply from the | 987 // In case the renderer is currently blocked waiting for a sync reply from the |
| 988 // stub, we need to make sure to reschedule the correct stream here. | 988 // stub, we need to make sure to reschedule the correct stream here. |
| 989 if (stub && !stub->IsScheduled()) { | 989 if (stub && !stub->IsScheduled()) { |
| 990 // This stub won't get a chance to reschedule the stream so do that now. | 990 // This stub won't get a chance to reschedule the stream so do that now. |
| 991 OnStreamRescheduled(stub->stream_id(), true); | 991 OnStreamRescheduled(stub->stream_id(), true); |
| 992 } | 992 } |
| 993 | 993 |
| 994 RemoveRoute(route_id); | 994 RemoveRoute(route_id); |
| 995 } | 995 } |
| 996 | 996 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 } | 1070 } |
| 1071 } | 1071 } |
| 1072 } | 1072 } |
| 1073 | 1073 |
| 1074 void GpuChannel::HandleUpdateValueState( | 1074 void GpuChannel::HandleUpdateValueState( |
| 1075 unsigned int target, const ValueState& state) { | 1075 unsigned int target, const ValueState& state) { |
| 1076 pending_valuebuffer_state_->UpdateState(target, state); | 1076 pending_valuebuffer_state_->UpdateState(target, state); |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 } // namespace gpu | 1079 } // namespace gpu |
| OLD | NEW |