Add gpu::MailboxHolder to hold state for a gpu::Mailbox

gpu::Mailbox by itself can hold only a texture id, but in common usage it comes
with texture target and syncpoint information for cross-context sharing.  To
reduce repetition of this pattern, gpu::MailboxHolder holds:

* a gpu::Mailbox
* a GL texture target
* a syncpoint index

Refactor other classes to use a gpu::MailboxHolder instead of separate
gpu::Mailbox and associated state.

Syncpoints are created with uint32 indices; make sure all uses of syncpoints
use the appropriate type.

BUG=None
TEST=local build, unittests on CrOS snow, desktop Linux
[email protected], [email protected], [email protected], [email protected]

Review URL: https://codereview.chromium.org/132233041

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248612 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc
index 433d6521..49799543 100644
--- a/content/renderer/child_frame_compositing_helper.cc
+++ b/content/renderer/child_frame_compositing_helper.cc
@@ -204,7 +204,7 @@
 }
 
 void ChildFrameCompositingHelper::MailboxReleased(SwapBuffersInfo mailbox,
-                                                  unsigned sync_point,
+                                                  uint32 sync_point,
                                                   bool lost_resource) {
   if (mailbox.type == SOFTWARE_COMPOSITOR_FRAME) {
     delete mailbox.shared_memory;
@@ -288,7 +288,7 @@
 
 void ChildFrameCompositingHelper::OnBuffersSwappedPrivate(
     const SwapBuffersInfo& mailbox,
-    unsigned sync_point,
+    uint32 sync_point,
     float device_scale_factor) {
   DCHECK(!delegated_layer_.get());
   // If these mismatch, we are either just starting up, GPU process crashed or
@@ -351,10 +351,12 @@
             base::Bind(&ChildFrameCompositingHelper::MailboxReleased,
                        scoped_refptr<ChildFrameCompositingHelper>(this),
                        mailbox)).Pass();
-    if (is_software_frame)
+    if (is_software_frame) {
       texture_mailbox = cc::TextureMailbox(mailbox.shared_memory, mailbox.size);
-    else
-      texture_mailbox = cc::TextureMailbox(mailbox.name, sync_point);
+    } else {
+      texture_mailbox =
+          cc::TextureMailbox(mailbox.name, GL_TEXTURE_2D, sync_point);
+    }
   }
 
   texture_layer_->SetFlipped(!is_software_frame);