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