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_ozone_native_pixmap.h " | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h " |
6 | 6 |
7 #include "ui/ozone/public/client_native_pixmap_factory.h" | 7 #include "ui/ozone/public/client_native_pixmap_factory.h" |
8 #include "ui/ozone/public/surface_factory_ozone.h" | 8 #include "ui/ozone/public/surface_factory_ozone.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 18 matching lines...) Expand all Loading... | |
29 const DestructionCallback& callback) { | 29 const DestructionCallback& callback) { |
30 scoped_ptr<ui::ClientNativePixmap> native_pixmap = | 30 scoped_ptr<ui::ClientNativePixmap> native_pixmap = |
31 ui::ClientNativePixmapFactory::GetInstance()->ImportFromHandle( | 31 ui::ClientNativePixmapFactory::GetInstance()->ImportFromHandle( |
32 handle.native_pixmap_handle, size, format, usage); | 32 handle.native_pixmap_handle, size, format, usage); |
33 return make_scoped_ptr<GpuMemoryBufferImpl>( | 33 return make_scoped_ptr<GpuMemoryBufferImpl>( |
34 new GpuMemoryBufferImplOzoneNativePixmap(handle.id, size, format, | 34 new GpuMemoryBufferImplOzoneNativePixmap(handle.id, size, format, |
35 callback, native_pixmap.Pass())); | 35 callback, native_pixmap.Pass())); |
36 } | 36 } |
37 | 37 |
38 bool GpuMemoryBufferImplOzoneNativePixmap::Map(void** data) { | 38 bool GpuMemoryBufferImplOzoneNativePixmap::Map(void** data) { |
39 return pixmap_->Map(data); | 39 DCHECK(!mapped_); |
reveman
2015/08/07 17:59:44
Looks like you already have this dcheck in the pix
dshwang
2015/08/11 17:44:56
All GpuMemoryBufferImplXXX::Map/Unmap has same dch
reveman
2015/08/11 18:53:52
Other implementations have DCHECKs as we're not in
dshwang
2015/08/11 19:36:06
Done. Thank you for patient explanation.
| |
40 bool result = pixmap_->Map(data); | |
41 if (result) | |
42 mapped_ = true; | |
43 return result; | |
40 } | 44 } |
41 | 45 |
42 void GpuMemoryBufferImplOzoneNativePixmap::Unmap() { | 46 void GpuMemoryBufferImplOzoneNativePixmap::Unmap() { |
47 DCHECK(mapped_); | |
43 pixmap_->Unmap(); | 48 pixmap_->Unmap(); |
49 mapped_ = false; | |
44 } | 50 } |
45 | 51 |
46 void GpuMemoryBufferImplOzoneNativePixmap::GetStride(int* stride) const { | 52 void GpuMemoryBufferImplOzoneNativePixmap::GetStride(int* stride) const { |
47 pixmap_->GetStride(stride); | 53 pixmap_->GetStride(stride); |
48 } | 54 } |
49 | 55 |
50 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzoneNativePixmap::GetHandle() | 56 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzoneNativePixmap::GetHandle() |
51 const { | 57 const { |
52 gfx::GpuMemoryBufferHandle handle; | 58 gfx::GpuMemoryBufferHandle handle; |
53 handle.type = gfx::OZONE_NATIVE_PIXMAP; | 59 handle.type = gfx::OZONE_NATIVE_PIXMAP; |
54 handle.id = id_; | 60 handle.id = id_; |
55 return handle; | 61 return handle; |
56 } | 62 } |
57 | 63 |
58 } // namespace content | 64 } // namespace content |
OLD | NEW |