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

Unified Diff: ui/surface/transport_dib_posix.cc

Issue 13582008: Simplify the transport dib situation across our various platforms, as a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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/surface/transport_dib_mac.cc ('k') | ui/surface/transport_dib_sysvipc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/surface/transport_dib_posix.cc
===================================================================
--- ui/surface/transport_dib_posix.cc (revision 192091)
+++ ui/surface/transport_dib_posix.cc (working copy)
@@ -4,6 +4,10 @@
#include "ui/surface/transport_dib.h"
+// Desktop GTK Linux builds use the old-style SYSV SHM based DIBs.
+// Linux Aura and Chrome OS do too. This will change very soon.
+#if !defined(TOOLKIT_GTK) && !(defined(OS_LINUX) && defined(USE_AURA))
+
#include <sys/stat.h>
#include <unistd.h>
@@ -57,7 +61,11 @@
// static
bool TransportDIB::is_valid_id(Id id) {
+#if defined(OS_ANDROID)
+ return is_valid_handle(id);
+#else
return id != 0;
+#endif
}
skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) {
@@ -71,6 +79,11 @@
bool TransportDIB::Map() {
if (!is_valid_handle(handle()))
return false;
+#if defined(OS_ANDROID)
+ if (!shared_memory_.Map(0))
+ return false;
+ size_ = shared_memory_.mapped_size();
+#else
if (memory())
return true;
@@ -81,6 +94,7 @@
}
size_ = st.st_size;
+#endif
return true;
}
@@ -89,9 +103,16 @@
}
TransportDIB::Id TransportDIB::id() const {
+#if defined(OS_ANDROID)
+ return handle();
+#else
return shared_memory_.id();
+#endif
}
TransportDIB::Handle TransportDIB::handle() const {
return shared_memory_.handle();
}
+
+#endif // !defined(TOOLKIT_GTK) && !(defined(OS_LINUX) && defined(USE_AURA))
+
« no previous file with comments | « ui/surface/transport_dib_mac.cc ('k') | ui/surface/transport_dib_sysvipc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698