OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "content/browser/aura/image_transport_factory.h" | 6 #include "content/browser/aura/image_transport_factory.h" |
7 #include "gpu/command_buffer/common/mailbox.h" | 7 #include "gpu/command_buffer/common/mailbox.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
11 class GLHelper; | 11 class GLHelper; |
12 | 12 |
13 // This class holds a texture id and gpu::Mailbox, and deletes the texture | 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 | 14 // id when the object itself is destroyed. Should only be created if a GLHelper |
15 // exists on the ImageTransportFactory. | 15 // exists on the ImageTransportFactory. |
16 class OwnedMailbox : public base::RefCounted<OwnedMailbox>, | 16 class OwnedMailbox : public base::RefCounted<OwnedMailbox>, |
17 public ImageTransportFactoryObserver { | 17 public ImageTransportFactoryObserver { |
18 public: | 18 public: |
19 explicit OwnedMailbox(GLHelper* gl_helper); | 19 explicit OwnedMailbox(GLHelper* gl_helper); |
20 | 20 |
| 21 const gpu::Mailbox& mailbox() const { return mailbox_holder_.mailbox; } |
21 uint32 texture_id() const { return texture_id_; } | 22 uint32 texture_id() const { return texture_id_; } |
22 uint32 sync_point() const { return sync_point_; } | 23 uint32 target() const { return mailbox_holder_.texture_target; } |
23 const gpu::Mailbox& mailbox() const { return mailbox_; } | 24 uint32 sync_point() const { return mailbox_holder_.sync_point; } |
24 | 25 void set_sync_point(uint32 sync_point); |
25 void UpdateSyncPoint(uint32 sync_point); | |
26 | 26 |
27 protected: | 27 protected: |
28 virtual ~OwnedMailbox(); | 28 virtual ~OwnedMailbox(); |
29 | 29 |
30 virtual void OnLostResources() OVERRIDE; | 30 virtual void OnLostResources() OVERRIDE; |
31 | 31 |
32 private: | 32 private: |
33 friend class base::RefCounted<OwnedMailbox>; | 33 friend class base::RefCounted<OwnedMailbox>; |
34 | 34 |
35 uint32 texture_id_; | 35 uint32 texture_id_; |
36 gpu::Mailbox mailbox_; | 36 gpu::MailboxHolder mailbox_holder_; |
37 uint32 sync_point_; | |
38 GLHelper* gl_helper_; | 37 GLHelper* gl_helper_; |
39 }; | 38 }; |
40 | 39 |
41 } // namespace content | 40 } // namespace content |
OLD | NEW |