| 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 #include "components/display_compositor/buffer_queue.h" | 5 #include "components/display_compositor/buffer_queue.h" |
| 6 | 6 |
| 7 #include "base/containers/adapters.h" | 7 #include "base/containers/adapters.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "components/display_compositor/gl_helper.h" | 10 #include "components/display_compositor/gl_helper.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 size_.height(), internal_format_); | 232 size_.height(), internal_format_); |
| 233 if (!id) { | 233 if (!id) { |
| 234 LOG(ERROR) << "Failed to allocate backing image surface"; | 234 LOG(ERROR) << "Failed to allocate backing image surface"; |
| 235 gl_->DeleteTextures(1, &texture); | 235 gl_->DeleteTextures(1, &texture); |
| 236 return nullptr; | 236 return nullptr; |
| 237 } | 237 } |
| 238 | 238 |
| 239 allocated_count_++; | 239 allocated_count_++; |
| 240 gl_->BindTexture(texture_target_, texture); | 240 gl_->BindTexture(texture_target_, texture); |
| 241 gl_->BindTexImage2DCHROMIUM(texture_target_, id); | 241 gl_->BindTexImage2DCHROMIUM(texture_target_, id); |
| 242 return base::WrapUnique(new AllocatedSurface(this, std::move(buffer), texture, | 242 return base::MakeUnique<AllocatedSurface>(this, std::move(buffer), texture, |
| 243 id, gfx::Rect(size_))); | 243 id, gfx::Rect(size_)); |
| 244 } | 244 } |
| 245 | 245 |
| 246 BufferQueue::AllocatedSurface::AllocatedSurface( | 246 BufferQueue::AllocatedSurface::AllocatedSurface( |
| 247 BufferQueue* buffer_queue, | 247 BufferQueue* buffer_queue, |
| 248 std::unique_ptr<gfx::GpuMemoryBuffer> buffer, | 248 std::unique_ptr<gfx::GpuMemoryBuffer> buffer, |
| 249 uint32_t texture, | 249 uint32_t texture, |
| 250 uint32_t image, | 250 uint32_t image, |
| 251 const gfx::Rect& rect) | 251 const gfx::Rect& rect) |
| 252 : buffer_queue(buffer_queue), | 252 : buffer_queue(buffer_queue), |
| 253 buffer(buffer.release()), | 253 buffer(buffer.release()), |
| 254 texture(texture), | 254 texture(texture), |
| 255 image(image), | 255 image(image), |
| 256 damage(rect) {} | 256 damage(rect) {} |
| 257 | 257 |
| 258 BufferQueue::AllocatedSurface::~AllocatedSurface() { | 258 BufferQueue::AllocatedSurface::~AllocatedSurface() { |
| 259 buffer_queue->FreeSurfaceResources(this); | 259 buffer_queue->FreeSurfaceResources(this); |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace display_compositor | 262 } // namespace display_compositor |
| OLD | NEW |