1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/memory/ref_counted.h"
6 #include "content/browser/compositor/image_transport_factory.h"
7 #include "gpu/command_buffer/common/mailbox_holder.h"
13 // This class holds a texture id and gpu::Mailbox, and deletes the texture
14 // id when the object itself is destroyed. Should only be created if a GLHelper
15 // exists on the ImageTransportFactory.
16 class OwnedMailbox : public base::RefCounted<OwnedMailbox>,
17 public ImageTransportFactoryObserver {
19 explicit OwnedMailbox(GLHelper* gl_helper);
21 const gpu::Mailbox& mailbox() const { return mailbox_holder_.mailbox; }
22 uint32 texture_id() const { return texture_id_; }
23 uint32 target() const { return mailbox_holder_.texture_target; }
24 uint32 sync_point() const { return mailbox_holder_.sync_point; }
25 void UpdateSyncPoint(uint32 sync_point);
29 virtual ~OwnedMailbox();
31 // ImageTransportFactoryObserver implementation.
32 virtual void OnLostResources() OVERRIDE;
35 friend class base::RefCounted<OwnedMailbox>;
38 gpu::MailboxHolder mailbox_holder_;
42 } // namespace content