OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CONTENT_BROWSER_COMPOSITOR_OWNED_MAILBOX_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_OWNED_MAILBOX_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_OWNED_MAILBOX_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_OWNED_MAILBOX_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "content/browser/compositor/image_transport_factory.h" | 9 #include "content/browser/compositor/image_transport_factory.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "gpu/command_buffer/common/mailbox_holder.h" | 11 #include "gpu/command_buffer/common/mailbox_holder.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 class GLHelper; | 15 class GLHelper; |
16 | 16 |
17 // This class holds a texture id and gpu::Mailbox, and deletes the texture | 17 // This class holds a texture id and gpu::Mailbox, and deletes the texture |
18 // id when the object itself is destroyed. Should only be created if a GLHelper | 18 // id when the object itself is destroyed. Should only be created if a GLHelper |
19 // exists on the ImageTransportFactory. | 19 // exists on the ImageTransportFactory. |
20 class CONTENT_EXPORT OwnedMailbox : public base::RefCounted<OwnedMailbox>, | 20 class CONTENT_EXPORT OwnedMailbox : public base::RefCounted<OwnedMailbox>, |
21 public ImageTransportFactoryObserver { | 21 public ImageTransportFactoryObserver { |
22 public: | 22 public: |
23 explicit OwnedMailbox(GLHelper* gl_helper); | 23 explicit OwnedMailbox(GLHelper* gl_helper); |
24 | 24 |
25 const gpu::MailboxHolder& holder() const { return mailbox_holder_; } | 25 const gpu::MailboxHolder& holder() const { return mailbox_holder_; } |
26 const gpu::Mailbox& mailbox() const { return mailbox_holder_.mailbox; } | 26 const gpu::Mailbox& mailbox() const { return mailbox_holder_.mailbox; } |
| 27 const gpu::SyncToken& sync_token() const { |
| 28 return mailbox_holder_.sync_token; |
| 29 } |
27 uint32 texture_id() const { return texture_id_; } | 30 uint32 texture_id() const { return texture_id_; } |
28 uint32 target() const { return mailbox_holder_.texture_target; } | 31 uint32 target() const { return mailbox_holder_.texture_target; } |
29 uint32 sync_point() const { return mailbox_holder_.sync_point; } | 32 void UpdateSyncToken(const gpu::SyncToken& sync_token); |
30 void UpdateSyncPoint(uint32 sync_point); | |
31 void Destroy(); | 33 void Destroy(); |
32 | 34 |
33 protected: | 35 protected: |
34 ~OwnedMailbox() override; | 36 ~OwnedMailbox() override; |
35 | 37 |
36 // ImageTransportFactoryObserver implementation. | 38 // ImageTransportFactoryObserver implementation. |
37 void OnLostResources() override; | 39 void OnLostResources() override; |
38 | 40 |
39 private: | 41 private: |
40 friend class base::RefCounted<OwnedMailbox>; | 42 friend class base::RefCounted<OwnedMailbox>; |
41 | 43 |
42 uint32 texture_id_; | 44 uint32 texture_id_; |
43 gpu::MailboxHolder mailbox_holder_; | 45 gpu::MailboxHolder mailbox_holder_; |
44 GLHelper* gl_helper_; | 46 GLHelper* gl_helper_; |
45 }; | 47 }; |
46 | 48 |
47 } // namespace content | 49 } // namespace content |
48 | 50 |
49 #endif // CONTENT_BROWSER_COMPOSITOR_OWNED_MAILBOX_H_ | 51 #endif // CONTENT_BROWSER_COMPOSITOR_OWNED_MAILBOX_H_ |
OLD | NEW |