sync with the freebsd transport dib code

This commit is contained in:
robert 2011-03-21 11:27:45 +00:00
parent dc3f15e2bd
commit 597f0ebce5
3 changed files with 36 additions and 25 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.34 2011/03/20 07:51:00 robert Exp $
# $OpenBSD: Makefile,v 1.35 2011/03/21 11:27:45 robert Exp $
ONLY_FOR_ARCHS= i386 amd64
@ -7,7 +7,7 @@ COMMENT= Chromium browser
V= 10.0.648.151
DISTNAME= chromium-${V}
REVISION= 0
REVISION= 1
CATEGORIES= www

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-app_surface_transport_dib_openbsd_cc,v 1.2 2011/03/15 11:38:05 robert Exp $
--- app/surface/transport_dib_openbsd.cc.orig Mon Mar 14 10:55:37 2011
+++ app/surface/transport_dib_openbsd.cc Mon Mar 14 12:00:24 2011
@@ -0,0 +1,106 @@
$OpenBSD: patch-app_surface_transport_dib_openbsd_cc,v 1.3 2011/03/21 11:27:46 robert Exp $
--- app/surface/transport_dib_openbsd.cc.orig Fri Mar 18 09:12:57 2011
+++ app/surface/transport_dib_openbsd.cc Mon Mar 21 09:25:51 2011
@@ -0,0 +1,96 @@
+// Copyright (c) 2009 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.
@ -13,6 +13,7 @@ $OpenBSD: patch-app_surface_transport_dib_openbsd_cc,v 1.2 2011/03/15 11:38:05 r
+
+#include "base/eintr_wrapper.h"
+#include "base/shared_memory.h"
+#include "base/scoped_ptr.h"
+#include "skia/ext/platform_canvas.h"
+
+TransportDIB::TransportDIB()
@ -40,22 +41,11 @@ $OpenBSD: patch-app_surface_transport_dib_openbsd_cc,v 1.2 2011/03/15 11:38:05 r
+}
+
+// static
+TransportDIB* TransportDIB::Map(TransportDIB::Handle handle) {
+ if (!is_valid(handle))
+TransportDIB* TransportDIB::Map(Handle handle) {
+ scoped_ptr<TransportDIB> dib(CreateWithHandle(handle));
+ if (!dib->Map())
+ return NULL;
+
+ TransportDIB* dib = new TransportDIB(handle);
+ struct stat st;
+ if ((fstat(handle.fd, &st) != 0) ||
+ (!dib->shared_memory_.Map(st.st_size))) {
+ delete dib;
+ HANDLE_EINTR(close(handle.fd));
+ return NULL;
+ }
+
+ dib->size_ = st.st_size;
+
+ return dib;
+ return dib.release();
+}
+
+// static
@ -63,10 +53,6 @@ $OpenBSD: patch-app_surface_transport_dib_openbsd_cc,v 1.2 2011/03/15 11:38:05 r
+ return new TransportDIB(handle);
+}
+
+bool TransportDIB::is_valid(Handle dib) {
+ return dib.fd >= 0;
+}
+
+bool TransportDIB::Map() {
+ if (!is_valid(handle()))
+ return false;
@ -83,6 +69,10 @@ $OpenBSD: patch-app_surface_transport_dib_openbsd_cc,v 1.2 2011/03/15 11:38:05 r
+ return true;
+}
+
+bool TransportDIB::is_valid(Handle dib) {
+ return dib.fd >= 0;
+}
+
+skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) {
+ return new skia::PlatformCanvas(w, h, true,
+ reinterpret_cast<uint8_t*>(memory()));

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-gfx_scoped_image_h,v 1.1 2011/03/21 11:27:46 robert Exp $
--- gfx/scoped_image.h.orig Mon Mar 21 12:18:09 2011
+++ gfx/scoped_image.h Mon Mar 21 12:18:33 2011
@@ -11,7 +11,7 @@
#include "gfx/native_widget_types.h"
#include "third_party/skia/include/core/SkBitmap.h"
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
#include <glib-object.h>
#elif defined(OS_MACOSX)
#include "base/mac/mac_util.h"
@@ -116,7 +116,7 @@ class ScopedImage<NSImage> : public gfx::internal::Sco
#endif // defined(OS_MACOSX)
// Specialization for the GdkPixbuf type on Linux.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
template <>
class ScopedImage<GdkPixbuf> : public gfx::internal::ScopedImage<GdkPixbuf> {
public: