Index: gpu/command_buffer/client/cmd_buffer_helper.h |
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.h b/gpu/command_buffer/client/cmd_buffer_helper.h |
index a50dc7bfe4e4e73e4bc4ce392bc1cb85e32182be..0100c6ce3b5d6f0b9d0bdaaa260f9d377e8c3f4b 100644 |
--- a/gpu/command_buffer/client/cmd_buffer_helper.h |
+++ b/gpu/command_buffer/client/cmd_buffer_helper.h |
@@ -83,6 +83,15 @@ class GPU_EXPORT CommandBufferHelper { |
// shutdown. |
int32 InsertToken(); |
+ // Returns true if the token has already passed. |
+ // Parameters: |
+ // the value of the token to check whether it has passed |
+ bool HasTokenPassed(int32 token) const { |
+ if (token > token_) |
+ return true; // we wrapped |
+ return last_token_read() >= token; |
+ } |
+ |
// Waits until the token of a particular value has passed through the command |
// stream (i.e. commands inserted before that token have been executed). |
// NOTE: This will call Flush if it needs to block. |
@@ -90,6 +99,11 @@ class GPU_EXPORT CommandBufferHelper { |
// the value of the token to wait for. |
void WaitForToken(int32 token); |
+ // Get the serial number last read by the command buffer. |
+ uint32 last_serial_read() const { |
+ return command_buffer_->GetLastState().serial; |
+ } |
+ |
// Called prior to each command being issued. Waits for a certain amount of |
// space to be available. Returns address of space. |
CommandBufferEntry* GetSpace(uint32 entries); |