Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: ui/ozone/platform/wayland/wayland_surface_factory.cc

Issue 2843113002: make base::SharedMemoryHandle a class on POSIX. (Closed)
Patch Set: Fix test error. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/ozone/platform/wayland/wayland_surface_factory.h" 5 #include "ui/ozone/platform/wayland/wayland_surface_factory.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <sys/mman.h> 8 #include <sys/mman.h>
9 #include <wayland-client.h> 9 #include <wayland-client.h>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 sk_sp<SkSurface> WaylandCanvasSurface::GetSurface() { 61 sk_sp<SkSurface> WaylandCanvasSurface::GetSurface() {
62 if (sk_surface_) 62 if (sk_surface_)
63 return sk_surface_; 63 return sk_surface_;
64 64
65 size_t length = size_.width() * size_.height() * 4; 65 size_t length = size_.width() * size_.height() * 4;
66 auto shared_memory = base::WrapUnique(new base::SharedMemory); 66 auto shared_memory = base::WrapUnique(new base::SharedMemory);
67 if (!shared_memory->CreateAndMapAnonymous(length)) 67 if (!shared_memory->CreateAndMapAnonymous(length))
68 return nullptr; 68 return nullptr;
69 69
70 wl::Object<wl_shm_pool> pool(wl_shm_create_pool( 70 wl::Object<wl_shm_pool> pool(wl_shm_create_pool(
71 connection_->shm(), shared_memory->handle().fd, length)); 71 connection_->shm(), shared_memory->handle().GetHandle(), length));
72 if (!pool) 72 if (!pool)
73 return nullptr; 73 return nullptr;
74 wl::Object<wl_buffer> buffer( 74 wl::Object<wl_buffer> buffer(
75 wl_shm_pool_create_buffer(pool.get(), 0, size_.width(), size_.height(), 75 wl_shm_pool_create_buffer(pool.get(), 0, size_.width(), size_.height(),
76 size_.width() * 4, WL_SHM_FORMAT_ARGB8888)); 76 size_.width() * 4, WL_SHM_FORMAT_ARGB8888));
77 if (!buffer) 77 if (!buffer)
78 return nullptr; 78 return nullptr;
79 79
80 sk_surface_ = SkSurface::MakeRasterDirectReleaseProc( 80 sk_surface_ = SkSurface::MakeRasterDirectReleaseProc(
81 SkImageInfo::MakeN32Premul(size_.width(), size_.height()), 81 SkImageInfo::MakeN32Premul(size_.width(), size_.height()),
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 WaylandSurfaceFactory::CreateNativePixmapFromHandle( 235 WaylandSurfaceFactory::CreateNativePixmapFromHandle(
236 gfx::AcceleratedWidget widget, 236 gfx::AcceleratedWidget widget,
237 gfx::Size size, 237 gfx::Size size,
238 gfx::BufferFormat format, 238 gfx::BufferFormat format,
239 const gfx::NativePixmapHandle& handle) { 239 const gfx::NativePixmapHandle& handle) {
240 NOTIMPLEMENTED(); 240 NOTIMPLEMENTED();
241 return nullptr; 241 return nullptr;
242 } 242 }
243 243
244 } // namespace ui 244 } // namespace ui
OLDNEW
« base/memory/shared_memory_handle_posix.cc ('K') | « ui/gfx/mojo/buffer_types_struct_traits.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698