Implement future sync points in gpu service

This adds a |retire| parameter to InsertSyncPoint and adds a
RetireSyncPoint call so future sync points (which do not implicitly
retire on insertion) can work.

R=piman@chromium.org

Review URL: https://codereview.chromium.org/745043002
diff --git a/mojo/services/gles2/command_buffer_impl.cc b/mojo/services/gles2/command_buffer_impl.cc
index 78d52dd..141d04b 100644
--- a/mojo/services/gles2/command_buffer_impl.cc
+++ b/mojo/services/gles2/command_buffer_impl.cc
@@ -18,11 +18,6 @@
 void RunCallback(const Callback<void()>& callback) {
   callback.Run();
 }
-
-void RetireSyncPoint(scoped_refptr<gpu::SyncPointManager> sync_point_manager,
-                     uint32_t sync_point) {
-  sync_point_manager->RetireSyncPoint(sync_point);
-}
 }
 
 CommandBufferImpl::CommandBufferImpl(
@@ -96,11 +91,20 @@
                             base::Unretained(driver_.get()), id));
 }
 
-void CommandBufferImpl::InsertSyncPoint() {
+void CommandBufferImpl::InsertSyncPoint(bool retire) {
   uint32_t sync_point = sync_point_manager_->GenerateSyncPoint();
   sync_point_client_->DidInsertSyncPoint(sync_point);
+  if (retire) {
+    driver_task_runner_->PostTask(
+        FROM_HERE, base::Bind(&gpu::SyncPointManager::RetireSyncPoint,
+                              sync_point_manager_, sync_point));
+  }
+}
+
+void CommandBufferImpl::RetireSyncPoint(uint32_t sync_point) {
   driver_task_runner_->PostTask(
-      FROM_HERE, base::Bind(&RetireSyncPoint, sync_point_manager_, sync_point));
+      FROM_HERE, base::Bind(&gpu::SyncPointManager::RetireSyncPoint,
+                            sync_point_manager_, sync_point));
 }
 
 void CommandBufferImpl::Echo(const Callback<void()>& callback) {