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 #include "components/exo/shared_memory.h" | 5 #include "components/exo/shared_memory.h" |
6 | 6 |
7 #include <GLES2/gl2extchromium.h> | 7 #include <GLES2/gl2extchromium.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 if (!gpu_memory_buffer) { | 77 if (!gpu_memory_buffer) { |
78 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle"; | 78 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle"; |
79 return nullptr; | 79 return nullptr; |
80 } | 80 } |
81 | 81 |
82 // Zero-copy doesn't provide a benefit in the case of shared memory as an | 82 // Zero-copy doesn't provide a benefit in the case of shared memory as an |
83 // implicit copy is required when trying to use these buffers as zero-copy | 83 // implicit copy is required when trying to use these buffers as zero-copy |
84 // buffers. Making the copy explicit allows the buffer to be reused earlier. | 84 // buffers. Making the copy explicit allows the buffer to be reused earlier. |
85 bool use_zero_copy = false; | 85 bool use_zero_copy = false; |
86 | 86 |
87 return base::WrapUnique( | 87 return base::MakeUnique<Buffer>( |
88 new Buffer(std::move(gpu_memory_buffer), GL_TEXTURE_2D, | 88 std::move(gpu_memory_buffer), GL_TEXTURE_2D, |
89 // COMMANDS_ISSUED queries are sufficient for shared memory | 89 // COMMANDS_ISSUED queries are sufficient for shared memory |
90 // buffers as binding to texture is implemented using a call to | 90 // buffers as binding to texture is implemented using a call to |
91 // glTexImage2D and the buffer can be reused as soon as that | 91 // glTexImage2D and the buffer can be reused as soon as that |
92 // command has been issued. | 92 // command has been issued. |
93 GL_COMMANDS_ISSUED_CHROMIUM, use_zero_copy, | 93 GL_COMMANDS_ISSUED_CHROMIUM, use_zero_copy, |
94 false /* is_overlay_candidate */)); | 94 false /* is_overlay_candidate */); |
95 } | 95 } |
96 | 96 |
97 } // namespace exo | 97 } // namespace exo |
OLD | NEW |