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