Optimize CommandBufferHelper::GetSpace().
Previously GetSpace() did various calls:
- usable() - Check if buffer is usable.
- AllocateRingBuffer() - Allocate buffer if not already allocated.
- WaitForAvailableEntries() - Yet more checks.
This change shortcuts most calls, reducing to checks on
immediate_entry_count_ and commands_issued_ only, maintaining the old
behavior in terms of internal flushing.
immediate_entry_count_ is 0 if the buffer is unusable or unallocated,
otherwise is limited to min(immediate free space, force flush limit).
commands_issued_ is counted on non-Android platforms, and checks for
force flush condition every kCommandsPerFlushCheck commands.
BUG=340362
Review URL: https://codereview.chromium.org/
141133010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250582 0039d316-1c4b-4281-b951-d872f2087c98