| 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 "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/common/android/surface_texture_manager.h" | 10 #include "content/common/android/surface_texture_manager.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 | 180 |
| 181 void* GpuMemoryBufferImplSurfaceTexture::Map() { | 181 void* GpuMemoryBufferImplSurfaceTexture::Map() { |
| 182 TRACE_EVENT0("gpu", "GpuMemoryBufferImplSurfaceTexture::Map"); | 182 TRACE_EVENT0("gpu", "GpuMemoryBufferImplSurfaceTexture::Map"); |
| 183 | 183 |
| 184 DCHECK(!mapped_); | 184 DCHECK(!mapped_); |
| 185 DCHECK(native_window_); | 185 DCHECK(native_window_); |
| 186 ANativeWindow_Buffer buffer; | 186 ANativeWindow_Buffer buffer; |
| 187 int status = ANativeWindow_lock(native_window_, &buffer, NULL); | 187 int status = ANativeWindow_lock(native_window_, &buffer, NULL); |
| 188 if (status) { | 188 if (status) { |
| 189 VLOG(1) << "ANativeWindow_lock failed with error code: " << status; | 189 DVLOG(1) << "ANativeWindow_lock failed with error code: " << status; |
| 190 return NULL; | 190 return NULL; |
| 191 } | 191 } |
| 192 | 192 |
| 193 DCHECK_LE(size_.width(), buffer.stride); | 193 DCHECK_LE(size_.width(), buffer.stride); |
| 194 stride_ = buffer.stride * BytesPerPixel(format_); | 194 stride_ = buffer.stride * BytesPerPixel(format_); |
| 195 mapped_ = true; | 195 mapped_ = true; |
| 196 return buffer.bits; | 196 return buffer.bits; |
| 197 } | 197 } |
| 198 | 198 |
| 199 void GpuMemoryBufferImplSurfaceTexture::Unmap() { | 199 void GpuMemoryBufferImplSurfaceTexture::Unmap() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 210 | 210 |
| 211 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() | 211 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() |
| 212 const { | 212 const { |
| 213 gfx::GpuMemoryBufferHandle handle; | 213 gfx::GpuMemoryBufferHandle handle; |
| 214 handle.type = gfx::SURFACE_TEXTURE_BUFFER; | 214 handle.type = gfx::SURFACE_TEXTURE_BUFFER; |
| 215 handle.id = id_; | 215 handle.id = id_; |
| 216 return handle; | 216 return handle; |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace content | 219 } // namespace content |
| OLD | NEW |