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/hash.h" | 8 #include "base/hash.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 } | 664 } |
665 | 665 |
666 decoder_->ProduceFrontBuffer(mailbox); | 666 decoder_->ProduceFrontBuffer(mailbox); |
667 } | 667 } |
668 | 668 |
669 void GpuCommandBufferStub::OnParseError() { | 669 void GpuCommandBufferStub::OnParseError() { |
670 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnParseError"); | 670 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnParseError"); |
671 DCHECK(command_buffer_.get()); | 671 DCHECK(command_buffer_.get()); |
672 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); | 672 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); |
673 IPC::Message* msg = new GpuCommandBufferMsg_Destroyed( | 673 IPC::Message* msg = new GpuCommandBufferMsg_Destroyed( |
674 route_id_, state.context_lost_reason); | 674 route_id_, state.context_lost_reason, state.error); |
675 msg->set_unblock(true); | 675 msg->set_unblock(true); |
676 Send(msg); | 676 Send(msg); |
677 | 677 |
678 // Tell the browser about this context loss as well, so it can | 678 // Tell the browser about this context loss as well, so it can |
679 // determine whether client APIs like WebGL need to be immediately | 679 // determine whether client APIs like WebGL need to be immediately |
680 // blocked from automatically running. | 680 // blocked from automatically running. |
681 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); | 681 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); |
682 gpu_channel_manager->Send(new GpuHostMsg_DidLoseContext( | 682 gpu_channel_manager->Send(new GpuHostMsg_DidLoseContext( |
683 handle_.is_null(), state.context_lost_reason, active_url_)); | 683 handle_.is_null(), state.context_lost_reason, active_url_)); |
684 | 684 |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 return was_lost; | 1082 return was_lost; |
1083 } | 1083 } |
1084 | 1084 |
1085 void GpuCommandBufferStub::MarkContextLost() { | 1085 void GpuCommandBufferStub::MarkContextLost() { |
1086 if (!command_buffer_ || | 1086 if (!command_buffer_ || |
1087 command_buffer_->GetLastState().error == gpu::error::kLostContext) | 1087 command_buffer_->GetLastState().error == gpu::error::kLostContext) |
1088 return; | 1088 return; |
1089 | 1089 |
1090 command_buffer_->SetContextLostReason(gpu::error::kUnknown); | 1090 command_buffer_->SetContextLostReason(gpu::error::kUnknown); |
1091 if (decoder_) | 1091 if (decoder_) |
1092 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); | 1092 decoder_->MarkContextLost(gpu::error::kUnknown); |
1093 command_buffer_->SetParseError(gpu::error::kLostContext); | 1093 command_buffer_->SetParseError(gpu::error::kLostContext); |
1094 } | 1094 } |
1095 | 1095 |
1096 uint64 GpuCommandBufferStub::GetMemoryUsage() const { | 1096 uint64 GpuCommandBufferStub::GetMemoryUsage() const { |
1097 return GetMemoryManager()->GetClientMemoryUsage(this); | 1097 return GetMemoryManager()->GetClientMemoryUsage(this); |
1098 } | 1098 } |
1099 | 1099 |
1100 void GpuCommandBufferStub::SendSwapBuffersCompleted( | 1100 void GpuCommandBufferStub::SendSwapBuffersCompleted( |
1101 const std::vector<ui::LatencyInfo>& latency_info) { | 1101 const std::vector<ui::LatencyInfo>& latency_info) { |
1102 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); | 1102 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); |
1103 } | 1103 } |
1104 | 1104 |
1105 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1105 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
1106 base::TimeDelta interval) { | 1106 base::TimeDelta interval) { |
1107 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1107 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
1108 interval)); | 1108 interval)); |
1109 } | 1109 } |
1110 | 1110 |
1111 } // namespace content | 1111 } // namespace content |
OLD | NEW |