OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_EXO_BUFFER_H_ | 5 #ifndef COMPONENTS_EXO_BUFFER_H_ |
6 #define COMPONENTS_EXO_BUFFER_H_ | 6 #define COMPONENTS_EXO_BUFFER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 // Query type that must be used when releasing buffer from a texture. | 98 // Query type that must be used when releasing buffer from a texture. |
99 const unsigned query_type_; | 99 const unsigned query_type_; |
100 | 100 |
101 // True if zero copy is used when producing a texture mailbox for buffer. | 101 // True if zero copy is used when producing a texture mailbox for buffer. |
102 const bool use_zero_copy_; | 102 const bool use_zero_copy_; |
103 | 103 |
104 // True if this buffer is an overlay candidate. | 104 // True if this buffer is an overlay candidate. |
105 const bool is_overlay_candidate_; | 105 const bool is_overlay_candidate_; |
106 | 106 |
107 // This is incremented when a texture mailbox is produced and decremented | 107 // This is incremented when a transferable resource is produced and |
108 // when a texture mailbox is released. It is used to determine when we should | 108 // decremented when a transferable resource is released. It is used to |
109 // notify the client that buffer has been released. | 109 // determine when we should notify the client that buffer has been released. |
110 unsigned use_count_ = 0; | 110 unsigned use_count_ = 0; |
111 | 111 |
112 // This keeps track of how many Surfaces the buffer is attached to. | 112 // This keeps track of how many Surfaces the buffer is attached to. |
113 unsigned attach_count_ = 0; | 113 unsigned attach_count_ = 0; |
114 | 114 |
115 // The last used texture. ProduceTextureMailbox() will use this | 115 // The last used texture. ProduceTransferableResource() will use this |
116 // instead of creating a new texture when possible. | 116 // instead of creating a new texture when possible. |
117 std::unique_ptr<Texture> texture_; | 117 std::unique_ptr<Texture> texture_; |
118 | 118 |
119 // The last used contents texture. ProduceTextureMailbox() will use this | 119 // The last used contents texture. ProduceTransferableResource() will use this |
120 // instead of creating a new texture when possible. | 120 // instead of creating a new texture when possible. |
121 std::unique_ptr<Texture> contents_texture_; | 121 std::unique_ptr<Texture> contents_texture_; |
122 | 122 |
123 // The client release callback. | 123 // The client release callback. |
124 base::Closure release_callback_; | 124 base::Closure release_callback_; |
125 | 125 |
126 // The CompositorFrameSinkHolder that has the ReleaseCallback of this buffer | 126 // CompositorFrameSinkHolder instance that needs to be kept alive to receive |
127 // produced in ProduceTextureMailbox(). | 127 // a release callback when the last produced transferable resource is no |
128 // Buffer holds a reference to the CompositorFrameSinkHolder to keep it alive. | 128 // longer in use. |
129 // The refptr is reset when the release callback is called. | |
130 scoped_refptr<CompositorFrameSinkHolder> compositor_frame_sink_holder_; | 129 scoped_refptr<CompositorFrameSinkHolder> compositor_frame_sink_holder_; |
131 | 130 |
132 DISALLOW_COPY_AND_ASSIGN(Buffer); | 131 DISALLOW_COPY_AND_ASSIGN(Buffer); |
133 }; | 132 }; |
134 | 133 |
135 } // namespace exo | 134 } // namespace exo |
136 | 135 |
137 #endif // COMPONENTS_EXO_BUFFER_H_ | 136 #endif // COMPONENTS_EXO_BUFFER_H_ |
OLD | NEW |