summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-28 23:37:14 +0000
committerpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-28 23:37:14 +0000
commitef16c174a500a841cf6a120dc4ef9fca89fac9f9 (patch)
tree8491a815c314e161a462f42c41c374403ce6ec8c /webkit
parentd0a7409f5ad0c075d5208ea0eb93ff07868c6168 (diff)
downloadchromium_src-ef16c174a500a841cf6a120dc4ef9fca89fac9f9.zip
chromium_src-ef16c174a500a841cf6a120dc4ef9fca89fac9f9.tar.gz
chromium_src-ef16c174a500a841cf6a120dc4ef9fca89fac9f9.tar.bz2
Rework FlushSync to return early if commands have been processed since the last update
BUG=80480 TEST= Review URL: http://codereview.chromium.org/6883179 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83442 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/plugins/ppapi/ppb_context_3d_impl.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/webkit/plugins/ppapi/ppb_context_3d_impl.cc b/webkit/plugins/ppapi/ppb_context_3d_impl.cc
index 7d3b498..3c581c6 100644
--- a/webkit/plugins/ppapi/ppb_context_3d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_context_3d_impl.cc
@@ -46,7 +46,8 @@ PP_Context3DTrustedState PPStateFromGPUState(gpu::CommandBuffer::State s) {
s.get_offset,
s.put_offset,
s.token,
- static_cast<PPB_Context3DTrustedError>(s.error)
+ static_cast<PPB_Context3DTrustedError>(s.error),
+ s.generation
};
return state;
}
@@ -191,7 +192,9 @@ PP_Context3DTrustedState FlushSync(PP_Resource context_id, int32_t put_offset) {
return error_state;
}
- return PPStateFromGPUState(context->command_buffer()->FlushSync(put_offset));
+ gpu::CommandBuffer::State state = context->command_buffer()->GetState();
+ return PPStateFromGPUState(
+ context->command_buffer()->FlushSync(put_offset, state.get_offset));
}
int32_t CreateTransferBuffer(PP_Resource context_id, uint32_t size) {
@@ -225,6 +228,18 @@ PP_Bool GetTransferBuffer(PP_Resource context_id,
? PP_TRUE : PP_FALSE;
}
+PP_Context3DTrustedState FlushSyncFast(
+ PP_Resource context_id, int32_t put_offset, int32 last_known_get) {
+ scoped_refptr<PPB_Context3D_Impl> context(
+ Resource::GetAs<PPB_Context3D_Impl>(context_id));
+ if (!context.get() || !context->command_buffer()) {
+ PP_Context3DTrustedState error_state = { 0 };
+ return error_state;
+ }
+
+ return PPStateFromGPUState(
+ context->command_buffer()->FlushSync(put_offset, last_known_get));
+}
} // namespace
PPB_Context3D_Impl::PPB_Context3D_Impl(PluginInstance* instance)
@@ -254,7 +269,8 @@ const PPB_Context3DTrusted_Dev* PPB_Context3D_Impl::GetTrustedInterface() {
&FlushSync,
&CreateTransferBuffer,
&DestroyTransferBuffer,
- &GetTransferBuffer
+ &GetTransferBuffer,
+ &FlushSyncFast,
};
return &iface;
}