Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(934)

Unified Diff: ppapi/proxy/ppapi_command_buffer_proxy.cc

Issue 10387182: Browser Plugin: PpapiCommandBufferProxy should see a lost context if the embedder has deleted the P… (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/ppapi_command_buffer_proxy.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ppapi/proxy/ppapi_command_buffer_proxy.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698