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

Unified Diff: ui/wayland/wayland_shm_buffer.cc

Issue 10009024: Remove WAYLAND port (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/wayland/wayland_shm_buffer.h ('k') | ui/wayland/wayland_widget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wayland/wayland_shm_buffer.cc
diff --git a/ui/wayland/wayland_shm_buffer.cc b/ui/wayland/wayland_shm_buffer.cc
deleted file mode 100644
index 74068479306e9df63a770b3bc2d46d9bccca108c..0000000000000000000000000000000000000000
--- a/ui/wayland/wayland_shm_buffer.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/wayland/wayland_shm_buffer.h"
-
-#include <cairo.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <wayland-client.h>
-
-#include "base/logging.h"
-#include "ui/wayland/wayland_display.h"
-
-namespace ui {
-
-WaylandShmBuffer::WaylandShmBuffer(WaylandDisplay* display,
- uint32_t width,
- uint32_t height)
- : data_surface_(NULL) {
- int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width);
- int allocation = stride * height;
-
- char filename[] = "/tmp/wayland-shm-XXXXXX";
- int fd = mkstemp(filename);
- if (fd < 0) {
- PLOG(ERROR) << "Failed to open";
- return;
- }
- if (ftruncate(fd, allocation) < 0) {
- PLOG(ERROR) << "Failed to ftruncate";
- close(fd);
- return;
- }
-
- unsigned char* data = static_cast<unsigned char*>(
- mmap(NULL, allocation, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
- unlink(filename);
-
- if (data == MAP_FAILED) {
- PLOG(ERROR) << "Failed to mmap /dev/zero";
- close(fd);
- return;
- }
- data_surface_ = cairo_image_surface_create_for_data(
- data, CAIRO_FORMAT_ARGB32, width, height, stride);
- buffer_ = wl_shm_create_buffer(display->shm(), fd,
- width, height, stride,
- WL_SHM_FORMAT_PREMULTIPLIED_ARGB32);
- close(fd);
-}
-
-WaylandShmBuffer::~WaylandShmBuffer() {
- if (buffer_) {
- wl_buffer_destroy(buffer_);
- buffer_ = NULL;
- }
- if (data_surface_) {
- cairo_surface_destroy(data_surface_);
- data_surface_ = NULL;
- }
-}
-
-} // namespace ui
« no previous file with comments | « ui/wayland/wayland_shm_buffer.h ('k') | ui/wayland/wayland_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698