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)) |
+ |