Index: ppapi/proxy/ppapi_command_buffer_proxy.cc |
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc |
index 5e0f45486aab667646784b8aa7fc6a80696da2fd..56ebf6533020dc11b74c311bedd9a67ca7f6caf4 100644 |
--- a/ppapi/proxy/ppapi_command_buffer_proxy.cc |
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc |
@@ -99,9 +99,10 @@ gpu::CommandBuffer::State PpapiCommandBufferProxy::GetState() { |
// Send will flag state with lost context if IPC fails. |
if (last_state_.error == gpu::error::kNoError) { |
gpu::CommandBuffer::State state; |
+ bool success = false; |
if (Send(new PpapiHostMsg_PPBGraphics3D_GetState( |
- ppapi::API_ID_PPB_GRAPHICS_3D, resource_, &state))) { |
- UpdateState(state); |
+ ppapi::API_ID_PPB_GRAPHICS_3D, resource_, &state, &success))) { |
+ UpdateState(state, success); |
} |
} |
@@ -132,10 +133,11 @@ gpu::CommandBuffer::State PpapiCommandBufferProxy::FlushSync(int32 put_offset, |
// Send will flag state with lost context if IPC fails. |
if (last_state_.error == gpu::error::kNoError) { |
gpu::CommandBuffer::State state; |
+ bool success = false; |
if (Send(new PpapiHostMsg_PPBGraphics3D_Flush( |
ppapi::API_ID_PPB_GRAPHICS_3D, resource_, put_offset, |
- last_known_get, &state))) { |
- UpdateState(state); |
+ last_known_get, &state, &success))) { |
+ UpdateState(state, success); |
} |
} |
} else { |
@@ -259,11 +261,17 @@ bool PpapiCommandBufferProxy::Send(IPC::Message* msg) { |
} |
void PpapiCommandBufferProxy::UpdateState( |
- const gpu::CommandBuffer::State& state) { |
+ const gpu::CommandBuffer::State& state, |
+ bool success) { |
// Handle wraparound. It works as long as we don't have more than 2B state |
// updates in flight across which reordering occurs. |
- if (state.generation - last_state_.generation < 0x80000000U) |
- last_state_ = state; |
+ if (success) { |
+ if (state.generation - last_state_.generation < 0x80000000U) { |
+ last_state_ = state; |
+ } else |
+ last_state_.error = gpu::error::kLostContext; |
+ ++last_state_.generation; |
+ } |
} |
} // namespace proxy |