firefox6-09-ipc.diff revision 20829
20829N/Adiff --git a/dom/plugins/ipc/PluginMessageUtils.cpp b/dom/plugins/ipc/PluginMessageUtils.cpp
20829N/Aindex bd04aa9..6a3e7d3 100644
20829N/A--- a/dom/plugins/ipc/PluginMessageUtils.cpp
20829N/A+++ b/dom/plugins/ipc/PluginMessageUtils.cpp
20829N/A@@ -115,7 +115,7 @@
20829N/A string
20829N/A MungePluginDsoPath(const string& path)
20829N/A {
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // https://bugzilla.mozilla.org/show_bug.cgi?id=519601
20829N/A return ReplaceAll(path, "netscape", "netsc@pe");
20829N/A #else
20829N/A@@ -126,7 +126,7 @@
20829N/A string
20829N/A UnmungePluginDsoPath(const string& munged)
20829N/A {
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A return ReplaceAll(munged, "netsc@pe", "netscape");
20829N/A #else
20829N/A return munged;
20829N/Adiff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp
20829N/Aindex dec578b..ab1a998 100644
20829N/A--- a/dom/plugins/ipc/PluginModuleChild.cpp
20829N/A+++ b/dom/plugins/ipc/PluginModuleChild.cpp
20829N/A@@ -212,7 +212,7 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
20829N/A
20829N/A // TODO: use PluginPRLibrary here
20829N/A
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A mShutdownFunc =
20829N/A (NP_PLUGINSHUTDOWN) PR_FindFunctionSymbol(mLibrary, "NP_Shutdown");
20829N/A
20829N/A@@ -242,9 +242,11 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
20829N/A }
20829N/A
20829N/A #if defined(MOZ_WIDGET_GTK2)
20829N/A+extern "C" {
20829N/A typedef void (*GObjectDisposeFn)(GObject*);
20829N/A typedef gboolean (*GtkWidgetScrollEventFn)(GtkWidget*, GdkEventScroll*);
20829N/A typedef void (*GtkPlugEmbeddedFn)(GtkPlug*);
20829N/A+}
20829N/A
20829N/A static GObjectDisposeFn real_gtk_plug_dispose;
20829N/A static GtkPlugEmbeddedFn real_gtk_plug_embedded;
20829N/A@@ -1714,7 +1716,7 @@ PluginModuleChild::AnswerNP_GetEntryPoints(NPError* _retval)
20829N/A PLUGIN_LOG_DEBUG_METHOD;
20829N/A AssertPluginThread();
20829N/A
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A return true;
20829N/A #elif defined(OS_WIN) || defined(OS_MACOSX)
20829N/A *_retval = mGetEntryPointsFunc(&mFunctions);
20829N/A@@ -1747,7 +1749,7 @@ PluginModuleChild::AnswerNP_Initialize(NativeThreadId* tid, NPError* _retval)
20829N/A SendBackUpXResources(FileDescriptor(xSocketFd, false/*don't close*/));
20829N/A #endif
20829N/A
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A *_retval = mInitializeFunc(&sBrowserFuncs, &mFunctions);
20829N/A return true;
20829N/A #elif defined(OS_WIN) || defined(OS_MACOSX)
20829N/Adiff --git a/dom/plugins/ipc/PluginModuleChild.h b/dom/plugins/ipc/PluginModuleChild.h
20829N/Aindex ae3cc43..b1b7d8a 100644
20829N/A--- a/dom/plugins/ipc/PluginModuleChild.h
20829N/A+++ b/dom/plugins/ipc/PluginModuleChild.h
20829N/A@@ -288,7 +288,7 @@ private:
20829N/A
20829N/A // we get this from the plugin
20829N/A NP_PLUGINSHUTDOWN mShutdownFunc;
20829N/A-#ifdef OS_LINUX
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A NP_PLUGINUNIXINIT mInitializeFunc;
20829N/A #elif defined(OS_WIN) || defined(OS_MACOSX)
20829N/A NP_PLUGININIT mInitializeFunc;
20829N/Adiff --git a/dom/plugins/ipc/PluginModuleParent.h b/dom/plugins/ipc/PluginModuleParent.h
20829N/Aindex e4abf55..93de1c6 100644
20829N/A--- a/dom/plugins/ipc/PluginModuleParent.h
20829N/A+++ b/dom/plugins/ipc/PluginModuleParent.h
20829N/A@@ -193,7 +193,7 @@ private:
20829N/A
20829N/A // Implement the module-level functions from NPAPI; these are
20829N/A // normally resolved directly from the DSO.
20829N/A-#ifdef OS_LINUX
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A NPError NP_Initialize(const NPNetscapeFuncs* npnIface,
20829N/A NPPluginFuncs* nppIface);
20829N/A #else
20829N/Adiff --git a/dom/plugins/ipc/PluginProcessParent.cpp b/dom/plugins/ipc/PluginProcessParent.cpp
20829N/Aindex 3d86b81..7a7d76a 100644
20829N/A--- a/dom/plugins/ipc/PluginProcessParent.cpp
20829N/A+++ b/dom/plugins/ipc/PluginProcessParent.cpp
20829N/A@@ -101,6 +101,9 @@ PluginProcessParent::Launch(PRInt32 timeoutMs)
20829N/A else if (base::PROCESS_ARCH_ARM & pluginLibArchitectures & containerArchitectures) {
20829N/A selectedArchitecture = base::PROCESS_ARCH_ARM;
20829N/A }
20829N/A+ else if (base::PROCESS_ARCH_SPARC & pluginLibArchitectures & containerArchitectures) {
20829N/A+ selectedArchitecture = base::PROCESS_ARCH_SPARC;
20829N/A+ }
20829N/A else {
20829N/A return false;
20829N/A }
20829N/Adiff --git a/ipc/chromium/Makefile.in b/ipc/chromium/Makefile.in
20829N/Aindex 00b834f..1ff687a 100644
20829N/A--- a/ipc/chromium/Makefile.in
20829N/A+++ b/ipc/chromium/Makefile.in
20829N/A@@ -49,7 +49,9 @@ FORCE_STATIC_LIB = 1
20829N/A LIBXUL_LIBRARY = 1
20829N/A EXPORT_LIBRARY = 1
20829N/A
20829N/A+ifndef SOLARIS_SUNPRO_CC
20829N/A ACDEFINES =
20829N/A+endif
20829N/A
20829N/A ifndef MOZ_NATIVE_LIBEVENT # {
20829N/A vpath %.c \
20829N/A@@ -274,6 +276,37 @@ endif
20829N/A
20829N/A endif # } OS_LINUX
20829N/A
20829N/A+ifdef OS_SOLARIS # {
20829N/A+
20829N/A+CPPSRCS += \
20829N/A+ atomicops_internals_x86_gcc.cc \
20829N/A+ idle_timer.cc \
20829N/A+ data_pack.cc \
20829N/A+ file_version_info_linux.cc \
20829N/A+ process_util_linux.cc \
20829N/A+ base_paths_linux.cc \
20829N/A+ time_posix.cc \
20829N/A+ $(NULL)
20829N/A+
20829N/A+ifdef MOZ_ENABLE_GTK2
20829N/A+CPPSRCS += \
20829N/A+ message_pump_glib.cc \
20829N/A+ $(NULL)
20829N/A+endif
20829N/A+
20829N/A+ifdef MOZ_ENABLE_QT
20829N/A+MOCSRCS = \
20829N/A+ moc_message_pump_qt.cc \
20829N/A+ $(NULL)
20829N/A+
20829N/A+CPPSRCS += \
20829N/A+ $(MOCSRCS) \
20829N/A+ message_pump_qt.cc \
20829N/A+ $(NULL)
20829N/A+endif
20829N/A+
20829N/A+endif # } OS_SOLARIS
20829N/A+
20829N/A # libevent
20829N/A
20829N/A ifndef MOZ_NATIVE_LIBEVENT # {
20829N/A@@ -312,6 +345,14 @@ CSRCS += \
20829N/A $(NULL)
20829N/A endif # }
20829N/A
20829N/A+ifdef OS_SOLARIS # {
20829N/A+LOCAL_INCLUDES += -I$(srcdir)/src/third_party/libevent/solaris
20829N/A+CSRCS += \
20829N/A+ devpoll.c \
20829N/A+ evport.c \
20829N/A+ $(NULL)
20829N/A+endif # }
20829N/A+
20829N/A endif # }
20829N/A
20829N/A endif # }
20829N/Adiff --git a/ipc/chromium/chromium-config.mk b/ipc/chromium/chromium-config.mk
20829N/Aindex 8b09ed1..c243331 100644
20829N/A--- a/ipc/chromium/chromium-config.mk
20829N/A+++ b/ipc/chromium/chromium-config.mk
20829N/A@@ -92,6 +92,24 @@
20829N/A
20829N/A else # } {
20829N/A
20829N/A+ifeq ($(OS_ARCH),SunOS) # {
20829N/A+
20829N/A+OS_SOLARIS = 1
20829N/A+OS_POSIX = 1
20829N/A+
20829N/A+DEFINES += \
20829N/A+ -DOS_SOLARIS=1 \
20829N/A+ -DOS_POSIX=1 \
20829N/A+ $(NULL)
20829N/A+
20829N/A+# NB: to stop gcc warnings about exporting template instantiation
20829N/A+OS_CXXFLAGS := $(filter-out -pedantic,$(OS_CXXFLAGS))
20829N/A+
20829N/A+
20829N/A+
20829N/A+
20829N/A+else # } {
20829N/A+
20829N/A OS_LINUX = 1
20829N/A OS_POSIX = 1
20829N/A
20829N/A@@ -106,3 +124,4 @@
20829N/A endif # }
20829N/A endif # }
20829N/A
20829N/A+endif # }
20829N/Adiff --git a/ipc/chromium/src/base/atomicops.h b/ipc/chromium/src/base/atomicops.h
20829N/Aindex a31c082..eca4255 100644
20829N/A--- a/ipc/chromium/src/base/atomicops.h
20829N/A+++ b/ipc/chromium/src/base/atomicops.h
20829N/A@@ -132,6 +132,10 @@ Atomic64 Release_Load(volatile const Atomic64* ptr);
20829N/A #include "base/atomicops_internals_x86_gcc.h"
20829N/A #elif defined(COMPILER_GCC) && defined(ARCH_CPU_ARM_FAMILY)
20829N/A #include "base/atomicops_internals_arm_gcc.h"
20829N/A+#elif defined(COMPILER_SUNPRO) && defined(ARCH_CPU_X86_FAMILY)
20829N/A+#define __asm__ asm
20829N/A+#define __volatile__ volatile
20829N/A+#include "base/atomicops_internals_x86_gcc.h"
20829N/A #else
20829N/A #include "base/atomicops_internals_mutex.h"
20829N/A #endif
20829N/Adiff --git a/ipc/chromium/src/base/atomicops_internals_x86_gcc.cc b/ipc/chromium/src/base/atomicops_internals_x86_gcc.cc
20829N/Aindex 933ca51..b0b3eb1 100644
20829N/A--- a/ipc/chromium/src/base/atomicops_internals_x86_gcc.cc
20829N/A+++ b/ipc/chromium/src/base/atomicops_internals_x86_gcc.cc
20829N/A@@ -19,13 +19,13 @@
20829N/A // Inline cpuid instruction. In PIC compilations, %ebx contains the address
20829N/A // of the global offset table. To avoid breaking such executables, this code
20829N/A // must preserve that register's value across cpuid instructions.
20829N/A-#if defined(__i386__)
20829N/A+#if defined(__i386__) || defined (__i386)
20829N/A #define cpuid(a, b, c, d, inp) \
20829N/A asm ("mov %%ebx, %%edi\n" \
20829N/A "cpuid\n" \
20829N/A "xchg %%edi, %%ebx\n" \
20829N/A : "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (inp))
20829N/A-#elif defined (__x86_64__)
20829N/A+#elif defined (__x86_64__) || defined(__x86_64)
20829N/A #define cpuid(a, b, c, d, inp) \
20829N/A asm ("mov %%rbx, %%rdi\n" \
20829N/A "cpuid\n" \
20829N/Adiff --git a/ipc/chromium/src/base/atomicops_internals_x86_gcc.h b/ipc/chromium/src/base/atomicops_internals_x86_gcc.h
20829N/Aindex fda5029..364beee 100644
20829N/A--- a/ipc/chromium/src/base/atomicops_internals_x86_gcc.h
20829N/A+++ b/ipc/chromium/src/base/atomicops_internals_x86_gcc.h
20829N/A@@ -29,18 +29,18 @@ inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
20829N/A Atomic32 old_value,
20829N/A Atomic32 new_value) {
20829N/A Atomic32 prev;
20829N/A- __asm__ __volatile__("lock; cmpxchgl %1,%2"
20829N/A+ __asm__ __volatile__("lock; cmpxchgl %1,(%2)"
20829N/A : "=a" (prev)
20829N/A- : "q" (new_value), "m" (*ptr), "0" (old_value)
20829N/A+ : "q" (new_value), "r" (ptr), "0" (old_value)
20829N/A : "memory");
20829N/A return prev;
20829N/A }
20829N/A
20829N/A inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
20829N/A Atomic32 new_value) {
20829N/A- __asm__ __volatile__("xchgl %1,%0" // The lock prefix is implicit for xchg.
20829N/A+ __asm__ __volatile__("xchgl (%1),%0" // The lock prefix is implicit for xchg.
20829N/A : "=r" (new_value)
20829N/A- : "m" (*ptr), "0" (new_value)
20829N/A+ : "r" (ptr), "0" (new_value)
20829N/A : "memory");
20829N/A return new_value; // Now it's the previous value.
20829N/A }
20829N/A@@ -48,8 +48,8 @@ inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
20829N/A inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
20829N/A Atomic32 increment) {
20829N/A Atomic32 temp = increment;
20829N/A- __asm__ __volatile__("lock; xaddl %0,%1"
20829N/A- : "+r" (temp), "+m" (*ptr)
20829N/A+ __asm__ __volatile__("lock; xaddl %0,(%1)"
20829N/A+ : "+r" (temp), "+r" (ptr)
20829N/A : : "memory");
20829N/A // temp now holds the old value of *ptr
20829N/A return temp + increment;
20829N/A@@ -58,8 +58,8 @@ inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
20829N/A inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
20829N/A Atomic32 increment) {
20829N/A Atomic32 temp = increment;
20829N/A- __asm__ __volatile__("lock; xaddl %0,%1"
20829N/A- : "+r" (temp), "+m" (*ptr)
20829N/A+ __asm__ __volatile__("lock; xaddl %0,(%1)"
20829N/A+ : "+r" (temp), "+r" (ptr)
20829N/A : : "memory");
20829N/A // temp now holds the old value of *ptr
20829N/A if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) {
20829N/A@@ -153,18 +153,18 @@ inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
20829N/A Atomic64 old_value,
20829N/A Atomic64 new_value) {
20829N/A Atomic64 prev;
20829N/A- __asm__ __volatile__("lock; cmpxchgq %1,%2"
20829N/A+ __asm__ __volatile__("lock; cmpxchgq %1,(%2)"
20829N/A : "=a" (prev)
20829N/A- : "q" (new_value), "m" (*ptr), "0" (old_value)
20829N/A+ : "q" (new_value), "r" (ptr), "0" (old_value)
20829N/A : "memory");
20829N/A return prev;
20829N/A }
20829N/A
20829N/A inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
20829N/A Atomic64 new_value) {
20829N/A- __asm__ __volatile__("xchgq %1,%0" // The lock prefix is implicit for xchg.
20829N/A+ __asm__ __volatile__("xchgq (%1),%0" // The lock prefix is implicit for xchg.
20829N/A : "=r" (new_value)
20829N/A- : "m" (*ptr), "0" (new_value)
20829N/A+ : "r" (ptr), "0" (new_value)
20829N/A : "memory");
20829N/A return new_value; // Now it's the previous value.
20829N/A }
20829N/A@@ -172,8 +172,8 @@ inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
20829N/A inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
20829N/A Atomic64 increment) {
20829N/A Atomic64 temp = increment;
20829N/A- __asm__ __volatile__("lock; xaddq %0,%1"
20829N/A- : "+r" (temp), "+m" (*ptr)
20829N/A+ __asm__ __volatile__("lock; xaddq %0,(%1)"
20829N/A+ : "+r" (temp), "+r" (ptr)
20829N/A : : "memory");
20829N/A // temp now contains the previous value of *ptr
20829N/A return temp + increment;
20829N/A@@ -182,8 +182,8 @@ inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
20829N/A inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
20829N/A Atomic64 increment) {
20829N/A Atomic64 temp = increment;
20829N/A- __asm__ __volatile__("lock; xaddq %0,%1"
20829N/A- : "+r" (temp), "+m" (*ptr)
20829N/A+ __asm__ __volatile__("lock; xaddq %0,(%1)"
20829N/A+ : "+r" (temp), "+r" (ptr)
20829N/A : : "memory");
20829N/A // temp now contains the previous value of *ptr
20829N/A if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) {
20829N/Adiff --git a/ipc/chromium/src/base/base_paths.h b/ipc/chromium/src/base/base_paths.h
20829N/Aindex 5f08dc4..a85534e 100644
20829N/A--- a/ipc/chromium/src/base/base_paths.h
20829N/A+++ b/ipc/chromium/src/base/base_paths.h
20829N/A@@ -13,7 +13,7 @@
20829N/A #include "base/base_paths_win.h"
20829N/A #elif defined(OS_MACOSX)
20829N/A #include "base/base_paths_mac.h"
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #include "base/base_paths_linux.h"
20829N/A #endif
20829N/A #include "base/path_service.h"
20829N/Adiff --git a/ipc/chromium/src/base/base_paths_linux.cc b/ipc/chromium/src/base/base_paths_linux.cc
20829N/Aindex b235f6b..865c348 100644
20829N/A--- a/ipc/chromium/src/base/base_paths_linux.cc
20829N/A+++ b/ipc/chromium/src/base/base_paths_linux.cc
20829N/A@@ -21,11 +21,19 @@ bool PathProviderLinux(int key, FilePath* result) {
20829N/A case base::FILE_EXE:
20829N/A case base::FILE_MODULE: { // TODO(evanm): is this correct?
20829N/A char bin_dir[PATH_MAX + 1];
20829N/A+#ifdef OS_SOLARIS
20829N/A+ if (!(realpath(getexecname(), bin_dir) && bin_dir[0] != '[')) {
20829N/A+ NOTREACHED() << "Unable to get exec name.";
20829N/A+ return false;
20829N/A+ }
20829N/A+ int bin_dir_size = strlen(bin_dir);
20829N/A+#else
20829N/A int bin_dir_size = readlink("/proc/self/exe", bin_dir, PATH_MAX);
20829N/A if (bin_dir_size < 0 || bin_dir_size > PATH_MAX) {
20829N/A NOTREACHED() << "Unable to resolve /proc/self/exe.";
20829N/A return false;
20829N/A }
20829N/A+#endif
20829N/A bin_dir[bin_dir_size] = 0;
20829N/A *result = FilePath(bin_dir);
20829N/A return true;
20829N/Adiff --git a/ipc/chromium/src/base/basictypes.h b/ipc/chromium/src/base/basictypes.h
20829N/Aindex dd2595c..ea2ba0c 100644
20829N/A--- a/ipc/chromium/src/base/basictypes.h
20829N/A+++ b/ipc/chromium/src/base/basictypes.h
20829N/A@@ -109,9 +109,15 @@ const int64 kint64max = (( int64) GG_LONGLONG(0x7FFFFFFFFFFFFFFF));
20829N/A # if defined(OS_POSIX)
20829N/A # define __STDC_FORMAT_MACROS 1
20829N/A # include <inttypes.h> // for 64-bit integer format macros
20829N/A+# if defined(COMPILER_SUNPRO)
20829N/A+# define PRId64L L"I64d"
20829N/A+# define PRIu64L L"I64u"
20829N/A+# define PRIx64L L"I64x"
20829N/A+# else
20829N/A # define PRId64L "I64d"
20829N/A # define PRIu64L "I64u"
20829N/A # define PRIx64L "I64x"
20829N/A+# endif
20829N/A # elif defined(OS_WIN)
20829N/A # define PRId64 "I64d"
20829N/A # define PRIu64 "I64u"
20829N/A@@ -155,6 +161,7 @@ const int64 kint64max = (( int64) GG_LONGLONG(0x7FFFFFFFFFFFFFFF));
20829N/A // This template function declaration is used in defining arraysize.
20829N/A // Note that the function doesn't need an implementation, as we only
20829N/A // use its type.
20829N/A+#if !defined(COMPILER_SUNPRO) || __SUNPRO_CC >= 0x5100
20829N/A template <typename T, size_t N>
20829N/A char (&ArraySizeHelper(T (&array)[N]))[N];
20829N/A
20829N/A@@ -167,6 +174,7 @@ char (&ArraySizeHelper(const T (&array)[N]))[N];
20829N/A #endif
20829N/A
20829N/A #define arraysize(array) (sizeof(ArraySizeHelper(array)))
20829N/A+#endif
20829N/A
20829N/A // ARRAYSIZE_UNSAFE performs essentially the same calculation as arraysize,
20829N/A // but can be used on anonymous types or types defined inside
20829N/A@@ -209,6 +217,9 @@ char (&ArraySizeHelper(const T (&array)[N]))[N];
20829N/A ((sizeof(a) / sizeof(*(a))) / \
20829N/A static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
20829N/A
20829N/A+#if defined(COMPILER_SUNPRO) && __SUNPRO_CC < 0x5100
20829N/A+#define arraysize(array) (ARRAYSIZE_UNSAFE(array))
20829N/A+#endif
20829N/A
20829N/A // Use implicit_cast as a safe version of static_cast or const_cast
20829N/A // for upcasting in the type hierarchy (i.e. casting a pointer to Foo
20829N/Adiff --git a/ipc/chromium/src/base/clipboard.cc b/ipc/chromium/src/base/clipboard.cc
20829N/Aindex e41fd93..fc6b7f2 100644
20829N/A--- a/ipc/chromium/src/base/clipboard.cc
20829N/A+++ b/ipc/chromium/src/base/clipboard.cc
20829N/A@@ -50,13 +50,13 @@ void Clipboard::DispatchObject(ObjectType type, const ObjectMapParams& params) {
20829N/A WriteWebSmartPaste();
20829N/A break;
20829N/A
20829N/A-#if defined(OS_WIN) || defined(OS_LINUX)
20829N/A+#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A case CBF_BITMAP:
20829N/A if (!IsBitmapSafe(params))
20829N/A return;
20829N/A WriteBitmap(&(params[0].front()), &(params[1].front()));
20829N/A break;
20829N/A-#endif // defined(OS_WIN) || defined(OS_LINUX)
20829N/A+#endif // defined(OS_WIN) || defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A
20829N/A default:
20829N/A NOTREACHED();
20829N/Adiff --git a/ipc/chromium/src/base/clipboard.h b/ipc/chromium/src/base/clipboard.h
20829N/Aindex 98f3b31..c18e5d2 100644
20829N/A--- a/ipc/chromium/src/base/clipboard.h
20829N/A+++ b/ipc/chromium/src/base/clipboard.h
20829N/A@@ -17,7 +17,7 @@
20829N/A class Clipboard {
20829N/A public:
20829N/A typedef std::string FormatType;
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef struct _GtkClipboard GtkClipboard;
20829N/A typedef std::map<FormatType, std::pair<char*, size_t> > TargetMap;
20829N/A #endif
20829N/A@@ -179,7 +179,7 @@ class Clipboard {
20829N/A
20829N/A // True if we can create a window.
20829N/A bool create_window_;
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // Data is stored in the |clipboard_data_| map until it is saved to the system
20829N/A // clipboard. The Store* functions save data to the |clipboard_data_| map. The
20829N/A // SetGtkClipboard function replaces whatever is on the system clipboard with
20829N/Adiff --git a/ipc/chromium/src/base/crypto/signature_verifier.h b/ipc/chromium/src/base/crypto/signature_verifier.h
20829N/Aindex 18873e8..3dd9aac 100644
20829N/A--- a/ipc/chromium/src/base/crypto/signature_verifier.h
20829N/A+++ b/ipc/chromium/src/base/crypto/signature_verifier.h
20829N/A@@ -7,7 +7,7 @@
20829N/A
20829N/A #include "build/build_config.h"
20829N/A
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #include <cryptoht.h>
20829N/A #elif defined(OS_MACOSX)
20829N/A #include <Security/cssm.h>
20829N/A@@ -81,7 +81,7 @@ class SignatureVerifier {
20829N/A
20829N/A std::vector<uint8> signature_;
20829N/A
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A VFYContext* vfy_context_;
20829N/A #elif defined(OS_MACOSX)
20829N/A std::vector<uint8> public_key_info_;
20829N/Adiff --git a/ipc/chromium/src/base/debug_util_posix.cc b/ipc/chromium/src/base/debug_util_posix.cc
20829N/Aindex ed9ad4f..fed5c45 100644
20829N/A--- a/ipc/chromium/src/base/debug_util_posix.cc
20829N/A+++ b/ipc/chromium/src/base/debug_util_posix.cc
20829N/A@@ -13,8 +13,10 @@
20829N/A #include <unistd.h>
20829N/A #ifndef ANDROID
20829N/A #include <execinfo.h>
20829N/A+#ifndef OS_SOLARIS
20829N/A #include <sys/sysctl.h>
20829N/A #endif
20829N/A+#endif
20829N/A
20829N/A #include "base/basictypes.h"
20829N/A #include "base/eintr_wrapper.h"
20829N/A@@ -71,7 +73,7 @@ bool DebugUtil::BeingDebugged() {
20829N/A return being_debugged;
20829N/A }
20829N/A
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A
20829N/A // We can look in /proc/self/status for TracerPid. We are likely used in crash
20829N/A // handling, so we are careful not to use the heap or have side effects.
20829N/A@@ -106,13 +108,17 @@ bool DebugUtil::BeingDebugged() {
20829N/A return pid_index < status.size() && status[pid_index] != '0';
20829N/A }
20829N/A
20829N/A-#endif // OS_LINUX
20829N/A+#endif // OS_LINUX || OS_SOLARIS
20829N/A
20829N/A // static
20829N/A void DebugUtil::BreakDebugger() {
20829N/A #if defined(ARCH_CPU_X86_FAMILY)
20829N/A+#if defined(COMPILER_SUNPRO)
20829N/A+ asm ("int $3");
20829N/A+#else
20829N/A asm ("int3");
20829N/A #endif
20829N/A+#endif
20829N/A }
20829N/A
20829N/A StackTrace::StackTrace() {
20829N/Adiff --git a/ipc/chromium/src/base/eintr_wrapper.h b/ipc/chromium/src/base/eintr_wrapper.h
20829N/Aindex a3fb1e4..fa44e05 100644
20829N/A--- a/ipc/chromium/src/base/eintr_wrapper.h
20829N/A+++ b/ipc/chromium/src/base/eintr_wrapper.h
20829N/A@@ -16,6 +16,7 @@
20829N/A
20829N/A #include <errno.h>
20829N/A
20829N/A+#ifndef COMPILER_SUNPRO
20829N/A #define HANDLE_EINTR(x) ({ \
20829N/A typeof(x) __eintr_result__; \
20829N/A do { \
20829N/A@@ -23,6 +24,15 @@
20829N/A } while (__eintr_result__ == -1 && errno == EINTR); \
20829N/A __eintr_result__;\
20829N/A })
20829N/A+#else
20829N/A+#define HANDLE_EINTR(x) ({ \
20829N/A+ ssize_t __eintr_result__; \
20829N/A+ do { \
20829N/A+ __eintr_result__ = x; \
20829N/A+ } while (__eintr_result__ == -1 && errno == EINTR); \
20829N/A+ __eintr_result__;\
20829N/A+})
20829N/A+#endif
20829N/A
20829N/A #else
20829N/A
20829N/Adiff --git a/ipc/chromium/src/base/file_util.cc b/ipc/chromium/src/base/file_util.cc
20829N/Aindex b79a7b6..cc98243 100644
20829N/A--- a/ipc/chromium/src/base/file_util.cc
20829N/A+++ b/ipc/chromium/src/base/file_util.cc
20829N/A@@ -16,10 +16,8 @@
20829N/A
20829N/A #include "base/file_path.h"
20829N/A #include "base/logging.h"
20829N/A-#include "base/string_util.h"
20829N/A-
20829N/A #include "base/string_piece.h"
20829N/A-#include "base/sys_string_conversions.h"
20829N/A+#include "base/string_util.h"
20829N/A
20829N/A namespace {
20829N/A
20829N/A@@ -29,34 +27,6 @@ const FilePath::CharType kExtensionSeparator = FILE_PATH_LITERAL('.');
20829N/A
20829N/A namespace file_util {
20829N/A
20829N/A-void PathComponents(const FilePath& path,
20829N/A- std::vector<FilePath::StringType>* components) {
20829N/A- DCHECK(components);
20829N/A- if (!components)
20829N/A- return;
20829N/A-
20829N/A- FilePath::StringType path_str = path.value();
20829N/A- FilePath::StringType::size_type start = 0;
20829N/A- FilePath::StringType::size_type end =
20829N/A- path_str.find_first_of(FilePath::kSeparators);
20829N/A-
20829N/A- // If the path starts with a separator, add it to components.
20829N/A- if (end == start) {
20829N/A- components->push_back(FilePath::StringType(path_str, 0, 1));
20829N/A- start = end + 1;
20829N/A- end = path_str.find_first_of(FilePath::kSeparators, start);
20829N/A- }
20829N/A- while (end != FilePath::StringType::npos) {
20829N/A- FilePath::StringType component =
20829N/A- FilePath::StringType(path_str, start, end - start);
20829N/A- components->push_back(component);
20829N/A- start = end + 1;
20829N/A- end = path_str.find_first_of(FilePath::kSeparators, start);
20829N/A- }
20829N/A-
20829N/A- components->push_back(FilePath::StringType(path_str, start));
20829N/A-}
20829N/A-
20829N/A bool EndsWithSeparator(const FilePath& path) {
20829N/A FilePath::StringType value = path.value();
20829N/A if (value.empty())
20829N/A@@ -79,11 +49,6 @@ bool EnsureEndsWithSeparator(FilePath* path) {
20829N/A return true;
20829N/A }
20829N/A
20829N/A-void TrimTrailingSeparator(std::wstring* dir) {
20829N/A- while (dir->length() > 1 && EndsWithSeparator(dir))
20829N/A- dir->resize(dir->length() - 1);
20829N/A-}
20829N/A-
20829N/A FilePath::StringType GetFileExtensionFromPath(const FilePath& path) {
20829N/A FilePath::StringType file_name = path.BaseName().value();
20829N/A const FilePath::StringType::size_type last_dot =
20829N/A@@ -160,21 +125,60 @@ bool ContentsEqual(const FilePath& filename1, const FilePath& filename2) {
20829N/A file1.read(buffer1, BUFFER_SIZE);
20829N/A file2.read(buffer2, BUFFER_SIZE);
20829N/A
20829N/A- if ((file1.eof() && !file2.eof()) ||
20829N/A- (!file1.eof() && file2.eof()) ||
20829N/A+ if ((file1.eof() != file2.eof()) ||
20829N/A (file1.gcount() != file2.gcount()) ||
20829N/A (memcmp(buffer1, buffer2, file1.gcount()))) {
20829N/A file1.close();
20829N/A file2.close();
20829N/A return false;
20829N/A }
20829N/A- } while (!file1.eof() && !file2.eof());
20829N/A+ } while (!file1.eof() || !file2.eof());
20829N/A
20829N/A file1.close();
20829N/A file2.close();
20829N/A return true;
20829N/A }
20829N/A
20829N/A+bool TextContentsEqual(const FilePath& filename1, const FilePath& filename2) {
20829N/A+ std::ifstream file1(filename1.value().c_str(), std::ios::in);
20829N/A+ std::ifstream file2(filename2.value().c_str(), std::ios::in);
20829N/A+
20829N/A+ // Even if both files aren't openable (and thus, in some sense, "equal"),
20829N/A+ // any unusable file yields a result of "false".
20829N/A+ if (!file1.is_open() || !file2.is_open())
20829N/A+ return false;
20829N/A+
20829N/A+ do {
20829N/A+ std::string line1, line2;
20829N/A+ getline(file1, line1);
20829N/A+ getline(file2, line2);
20829N/A+
20829N/A+ // Check for mismatched EOF states, or any error state.
20829N/A+ if ((file1.eof() != file2.eof()) ||
20829N/A+ file1.bad() || file2.bad()) {
20829N/A+ return false;
20829N/A+ }
20829N/A+
20829N/A+ // Trim all '\r' and '\n' characters from the end of the line.
20829N/A+ std::string::size_type end1 = line1.find_last_not_of("\r\n");
20829N/A+ if (end1 == std::string::npos)
20829N/A+ line1.clear();
20829N/A+ else if (end1 + 1 < line1.length())
20829N/A+ line1.erase(end1 + 1);
20829N/A+
20829N/A+ std::string::size_type end2 = line2.find_last_not_of("\r\n");
20829N/A+ if (end2 == std::string::npos)
20829N/A+ line2.clear();
20829N/A+ else if (end2 + 1 < line2.length())
20829N/A+ line2.erase(end2 + 1);
20829N/A+
20829N/A+ if (line1 != line2)
20829N/A+ return false;
20829N/A+ } while (!file1.eof() || !file2.eof());
20829N/A+
20829N/A+ return true;
20829N/A+}
20829N/A+
20829N/A bool ReadFileToString(const FilePath& path, std::string* contents) {
20829N/A FILE* file = OpenFile(path, "rb");
20829N/A if (!file) {
20829N/A@@ -207,6 +211,14 @@ bool GetFileSize(const FilePath& file_path, int64* file_size) {
20829N/A return true;
20829N/A }
20829N/A
20829N/A+bool IsDot(const FilePath& path) {
20829N/A+ return FILE_PATH_LITERAL(".") == path.BaseName().value();
20829N/A+}
20829N/A+
20829N/A+bool IsDotDot(const FilePath& path) {
20829N/A+ return FILE_PATH_LITERAL("..") == path.BaseName().value();
20829N/A+}
20829N/A+
20829N/A bool CloseFile(FILE* file) {
20829N/A if (file == NULL)
20829N/A return true;
20829N/A@@ -258,6 +270,23 @@ bool ContainsPath(const FilePath &parent, const FilePath& child) {
20829N/A return true;
20829N/A }
20829N/A
20829N/A+int64 ComputeDirectorySize(const FilePath& root_path) {
20829N/A+ int64 running_size = 0;
20829N/A+ FileEnumerator file_iter(root_path, true, FileEnumerator::FILES);
20829N/A+ for (FilePath current = file_iter.Next(); !current.empty();
20829N/A+ current = file_iter.Next()) {
20829N/A+ FileEnumerator::FindInfo info;
20829N/A+ file_iter.GetFindInfo(&info);
20829N/A+#if defined(OS_WIN)
20829N/A+ LARGE_INTEGER li = { info.nFileSizeLow, info.nFileSizeHigh };
20829N/A+ running_size += li.QuadPart;
20829N/A+#else
20829N/A+ running_size += info.stat.st_size;
20829N/A+#endif
20829N/A+ }
20829N/A+ return running_size;
20829N/A+}
20829N/A+
20829N/A ///////////////////////////////////////////////
20829N/A // MemoryMappedFile
20829N/A
20829N/A@@ -265,6 +294,20 @@ MemoryMappedFile::~MemoryMappedFile() {
20829N/A CloseHandles();
20829N/A }
20829N/A
20829N/A+bool MemoryMappedFile::Initialize(base::PlatformFile file) {
20829N/A+ if (IsValid())
20829N/A+ return false;
20829N/A+
20829N/A+ file_ = file;
20829N/A+
20829N/A+ if (!MapFileToMemoryInternal()) {
20829N/A+ CloseHandles();
20829N/A+ return false;
20829N/A+ }
20829N/A+
20829N/A+ return true;
20829N/A+}
20829N/A+
20829N/A bool MemoryMappedFile::Initialize(const FilePath& file_name) {
20829N/A if (IsValid())
20829N/A return false;
20829N/A@@ -277,6 +320,19 @@ bool MemoryMappedFile::Initialize(const FilePath& file_name) {
20829N/A return true;
20829N/A }
20829N/A
20829N/A+bool MemoryMappedFile::MapFileToMemory(const FilePath& file_name) {
20829N/A+ file_ = base::CreatePlatformFile(file_name.ToWStringHack(),
20829N/A+ base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
20829N/A+ NULL);
20829N/A+
20829N/A+ if (file_ == base::kInvalidPlatformFileValue) {
20829N/A+ LOG(ERROR) << "Couldn't open " << file_name.value();
20829N/A+ return false;
20829N/A+ }
20829N/A+
20829N/A+ return MapFileToMemoryInternal();
20829N/A+}
20829N/A+
20829N/A bool MemoryMappedFile::IsValid() {
20829N/A return data_ != NULL;
20829N/A }
20829N/A@@ -294,73 +350,33 @@ bool AbsolutePath(std::wstring* path_str) {
20829N/A *path_str = path.ToWStringHack();
20829N/A return true;
20829N/A }
20829N/A+
20829N/A+#if defined(OS_WIN)
20829N/A+// This function is deprecated; see file_util_deprecated.h for details.
20829N/A void AppendToPath(std::wstring* path, const std::wstring& new_ending) {
20829N/A if (!path) {
20829N/A NOTREACHED();
20829N/A return; // Don't crash in this function in release builds.
20829N/A }
20829N/A
20829N/A- if (!EndsWithSeparator(path))
20829N/A+ if (!EndsWithSeparator(*path))
20829N/A path->push_back(FilePath::kSeparators[0]);
20829N/A path->append(new_ending);
20829N/A }
20829N/A+#endif
20829N/A+
20829N/A bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path,
20829N/A bool recursive) {
20829N/A return CopyDirectory(FilePath::FromWStringHack(from_path),
20829N/A FilePath::FromWStringHack(to_path),
20829N/A recursive);
20829N/A }
20829N/A-bool ContentsEqual(const std::wstring& filename1,
20829N/A- const std::wstring& filename2) {
20829N/A- return ContentsEqual(FilePath::FromWStringHack(filename1),
20829N/A- FilePath::FromWStringHack(filename2));
20829N/A-}
20829N/A-bool CopyFile(const std::wstring& from_path, const std::wstring& to_path) {
20829N/A- return CopyFile(FilePath::FromWStringHack(from_path),
20829N/A- FilePath::FromWStringHack(to_path));
20829N/A-}
20829N/A-bool CreateDirectory(const std::wstring& full_path) {
20829N/A- return CreateDirectory(FilePath::FromWStringHack(full_path));
20829N/A-}
20829N/A-bool CreateNewTempDirectory(const std::wstring& prefix,
20829N/A- std::wstring* new_temp_path) {
20829N/A-#if defined(OS_WIN)
20829N/A- FilePath::StringType dir_prefix(prefix);
20829N/A-#elif defined(OS_POSIX)
20829N/A- FilePath::StringType dir_prefix = WideToUTF8(prefix);
20829N/A-#endif
20829N/A- FilePath temp_path;
20829N/A- if (!CreateNewTempDirectory(dir_prefix, &temp_path))
20829N/A- return false;
20829N/A- *new_temp_path = temp_path.ToWStringHack();
20829N/A- return true;
20829N/A-}
20829N/A-bool CreateTemporaryFileName(std::wstring* temp_file) {
20829N/A- FilePath temp_file_path;
20829N/A- if (!CreateTemporaryFileName(&temp_file_path))
20829N/A- return false;
20829N/A- *temp_file = temp_file_path.ToWStringHack();
20829N/A- return true;
20829N/A-}
20829N/A bool Delete(const std::wstring& path, bool recursive) {
20829N/A return Delete(FilePath::FromWStringHack(path), recursive);
20829N/A }
20829N/A-bool DirectoryExists(const std::wstring& path) {
20829N/A- return DirectoryExists(FilePath::FromWStringHack(path));
20829N/A-}
20829N/A-bool EndsWithSeparator(std::wstring* path) {
20829N/A- return EndsWithSeparator(FilePath::FromWStringHack(*path));
20829N/A-}
20829N/A bool EndsWithSeparator(const std::wstring& path) {
20829N/A return EndsWithSeparator(FilePath::FromWStringHack(path));
20829N/A }
20829N/A-bool GetCurrentDirectory(std::wstring* path_str) {
20829N/A- FilePath path;
20829N/A- if (!GetCurrentDirectory(&path))
20829N/A- return false;
20829N/A- *path_str = path.ToWStringHack();
20829N/A- return true;
20829N/A-}
20829N/A std::wstring GetFileExtensionFromPath(const std::wstring& path) {
20829N/A FilePath::StringType extension =
20829N/A GetFileExtensionFromPath(FilePath::FromWStringHack(path));
20829N/A@@ -370,44 +386,18 @@ std::wstring GetFileExtensionFromPath(const std::wstring& path) {
20829N/A return UTF8ToWide(extension);
20829N/A #endif
20829N/A }
20829N/A-bool GetFileInfo(const std::wstring& file_path, FileInfo* results) {
20829N/A- return GetFileInfo(FilePath::FromWStringHack(file_path), results);
20829N/A-}
20829N/A std::wstring GetFilenameFromPath(const std::wstring& path) {
20829N/A if (path.empty() || EndsWithSeparator(path))
20829N/A return std::wstring();
20829N/A
20829N/A return FilePath::FromWStringHack(path).BaseName().ToWStringHack();
20829N/A }
20829N/A-bool GetFileSize(const std::wstring& file_path, int64* file_size) {
20829N/A- return GetFileSize(FilePath::FromWStringHack(file_path), file_size);
20829N/A-}
20829N/A-bool GetTempDir(std::wstring* path_str) {
20829N/A- FilePath path;
20829N/A- if (!GetTempDir(&path))
20829N/A- return false;
20829N/A- *path_str = path.ToWStringHack();
20829N/A- return true;
20829N/A-}
20829N/A-bool Move(const std::wstring& from_path, const std::wstring& to_path) {
20829N/A- return Move(FilePath::FromWStringHack(from_path),
20829N/A- FilePath::FromWStringHack(to_path));
20829N/A-}
20829N/A FILE* OpenFile(const std::wstring& filename, const char* mode) {
20829N/A return OpenFile(FilePath::FromWStringHack(filename), mode);
20829N/A }
20829N/A-bool PathExists(const std::wstring& path) {
20829N/A- return PathExists(FilePath::FromWStringHack(path));
20829N/A-}
20829N/A-bool PathIsWritable(const std::wstring& path) {
20829N/A- return PathIsWritable(FilePath::FromWStringHack(path));
20829N/A-}
20829N/A int ReadFile(const std::wstring& filename, char* data, int size) {
20829N/A return ReadFile(FilePath::FromWStringHack(filename), data, size);
20829N/A }
20829N/A-bool SetCurrentDirectory(const std::wstring& directory) {
20829N/A- return SetCurrentDirectory(FilePath::FromWStringHack(directory));
20829N/A-}
20829N/A void UpOneDirectory(std::wstring* dir) {
20829N/A FilePath path = FilePath::FromWStringHack(*dir);
20829N/A FilePath directory = path.DirName();
20829N/A@@ -429,4 +419,15 @@ void UpOneDirectoryOrEmpty(std::wstring* dir) {
20829N/A int WriteFile(const std::wstring& filename, const char* data, int size) {
20829N/A return WriteFile(FilePath::FromWStringHack(filename), data, size);
20829N/A }
20829N/A+
20829N/A+///////////////////////////////////////////////
20829N/A+// FileEnumerator
20829N/A+//
20829N/A+// Note: the main logic is in file_util_<platform>.cc
20829N/A+
20829N/A+bool FileEnumerator::ShouldSkip(const FilePath& path) {
20829N/A+ FilePath::StringType basename = path.BaseName().value();
20829N/A+ return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_));
20829N/A+}
20829N/A+
20829N/A } // namespace
20829N/Adiff --git a/ipc/chromium/src/base/file_util.h b/ipc/chromium/src/base/file_util.h
20829N/Aindex 5226768..f142cba 100644
20829N/A--- a/ipc/chromium/src/base/file_util.h
20829N/A+++ b/ipc/chromium/src/base/file_util.h
20829N/A@@ -1,4 +1,4 @@
20829N/A-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
20829N/A+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
20829N/A // Use of this source code is governed by a BSD-style license that can be
20829N/A // found in the LICENSE file.
20829N/A
20829N/A@@ -12,7 +12,7 @@
20829N/A
20829N/A #if defined(OS_WIN)
20829N/A #include <windows.h>
20829N/A-#elif defined(ANDROID)
20829N/A+#elif defined(ANDROID) || defined(OS_SOLARIS)
20829N/A #include <sys/stat.h>
20829N/A #elif defined(OS_POSIX)
20829N/A #include <fts.h>
20829N/A@@ -26,8 +26,18 @@
20829N/A #include <vector>
20829N/A
20829N/A #include "base/basictypes.h"
20829N/A-#include "base/scoped_ptr.h"
20829N/A #include "base/file_path.h"
20829N/A+#include "base/platform_file.h"
20829N/A+#include "base/scoped_ptr.h"
20829N/A+#include "base/string16.h"
20829N/A+#include "base/time.h"
20829N/A+
20829N/A+#include "unistd.h"
20829N/A+
20829N/A+#if defined(OS_POSIX)
20829N/A+#include "base/eintr_wrapper.h"
20829N/A+#include "base/file_descriptor_posix.h"
20829N/A+#endif
20829N/A
20829N/A namespace base {
20829N/A class Time;
20829N/A@@ -38,99 +48,25 @@ namespace file_util {
20829N/A //-----------------------------------------------------------------------------
20829N/A // Functions that operate purely on a path string w/o touching the filesystem:
20829N/A
20829N/A-// Returns a vector of all of the components of the provided path.
20829N/A-void PathComponents(const FilePath& path,
20829N/A- std::vector<FilePath::StringType>* components);
20829N/A-#if defined(OS_WIN)
20829N/A-// Deprecated temporary compatibility function.
20829N/A-void PathComponents(const std::wstring& path,
20829N/A- std::vector<std::wstring>* components);
20829N/A-#endif
20829N/A-
20829N/A // Returns true if the given path ends with a path separator character.
20829N/A bool EndsWithSeparator(const FilePath& path);
20829N/A-// These two versions are both deprecated. TODO(estade): remove them.
20829N/A-bool EndsWithSeparator(std::wstring* path);
20829N/A-bool EndsWithSeparator(const std::wstring& path);
20829N/A
20829N/A // Makes sure that |path| ends with a separator IFF path is a directory that
20829N/A // exists. Returns true if |path| is an existing directory, false otherwise.
20829N/A bool EnsureEndsWithSeparator(FilePath* path);
20829N/A
20829N/A-// Modifies a string by trimming all trailing separators from the end.
20829N/A-// Deprecated. FilePath does this automatically, and if it's constructed from a
20829N/A-// path with a trailing separator, StripTrailingSeparators() may be used.
20829N/A-void TrimTrailingSeparator(std::wstring* dir);
20829N/A-
20829N/A-// Strips the topmost directory from the end of 'dir'. Assumes 'dir' does not
20829N/A-// refer to a file.
20829N/A-// If 'dir' is a root directory, return without change.
20829N/A-// Deprecated. Use FilePath::DirName instead.
20829N/A-void UpOneDirectory(std::wstring* dir);
20829N/A-// Strips the topmost directory from the end of 'dir'. Assumes 'dir' does not
20829N/A-// refer to a file.
20829N/A-// If 'dir' is a root directory, the result becomes empty string.
20829N/A-// Deprecated. Use FilePath::DirName instead.
20829N/A-void UpOneDirectoryOrEmpty(std::wstring* dir);
20829N/A-
20829N/A-// Returns the filename portion of 'path', without any leading \'s or /'s.
20829N/A-// Deprecated. Use FilePath::BaseName instead.
20829N/A-std::wstring GetFilenameFromPath(const std::wstring& path);
20829N/A-
20829N/A-// Deprecated compatibility function. Use FilePath::Extension.
20829N/A-FilePath::StringType GetFileExtensionFromPath(const FilePath& path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-std::wstring GetFileExtensionFromPath(const std::wstring& path);
20829N/A-
20829N/A-// Returns the directory component of a path, without the trailing
20829N/A-// path separator, or an empty string on error. The function does not
20829N/A-// check for the existence of the path, so if it is passed a directory
20829N/A-// without the trailing \, it will interpret the last component of the
20829N/A-// path as a file and chomp it. This does not support relative paths.
20829N/A-// Examples:
20829N/A-// path == "C:\pics\jojo.jpg", returns "C:\pics"
20829N/A-// path == "C:\Windows\system32\", returns "C:\Windows\system32"
20829N/A-// path == "C:\Windows\system32", returns "C:\Windows"
20829N/A-std::wstring GetDirectoryFromPath(const std::wstring& path);
20829N/A-
20829N/A-// Appends new_ending to path, adding a separator between the two if necessary.
20829N/A-void AppendToPath(std::wstring* path, const std::wstring& new_ending);
20829N/A-
20829N/A // Convert provided relative path into an absolute path. Returns false on
20829N/A // error. On POSIX, this function fails if the path does not exist.
20829N/A bool AbsolutePath(FilePath* path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool AbsolutePath(std::wstring* path);
20829N/A
20829N/A // Returns true if |parent| contains |child|. Both paths are converted to
20829N/A // absolute paths before doing the comparison.
20829N/A bool ContainsPath(const FilePath& parent, const FilePath& child);
20829N/A
20829N/A-// Deprecated compatibility function. Use FilePath::InsertBeforeExtension.
20829N/A-void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix);
20829N/A-
20829N/A-// Deprecated compatibility function. Use FilePath::ReplaceExtension.
20829N/A-void ReplaceExtension(FilePath* file_name,
20829N/A- const FilePath::StringType& extension);
20829N/A-
20829N/A-#if defined(OS_WIN)
20829N/A-// Deprecated temporary compatibility functions.
20829N/A-void InsertBeforeExtension(std::wstring* path, const std::wstring& suffix);
20829N/A-void ReplaceExtension(std::wstring* file_name, const std::wstring& extension);
20829N/A-#endif
20829N/A-
20829N/A-// Replaces characters in 'file_name' that are illegal for file names with
20829N/A-// 'replace_char'. 'file_name' must not be a full or relative path, but just the
20829N/A-// file name component. Any leading or trailing whitespace in 'file_name' is
20829N/A-// removed.
20829N/A-// Example:
20829N/A-// file_name == "bad:file*name?.txt", changed to: "bad-file-name-.txt" when
20829N/A-// 'replace_char' is '-'.
20829N/A-void ReplaceIllegalCharacters(std::wstring* file_name, int replace_char);
20829N/A-
20829N/A //-----------------------------------------------------------------------------
20829N/A // Functions that involve filesystem access or modification:
20829N/A
20829N/A+// Returns the number of files matching the current path that were
20829N/A // created on or after the given |file_time|. Doesn't count ".." or ".".
20829N/A //
20829N/A // Note for POSIX environments: a file created before |file_time|
20829N/A@@ -141,6 +77,13 @@ void ReplaceIllegalCharacters(std::wstring* file_name, int replace_char);
20829N/A int CountFilesCreatedAfter(const FilePath& path,
20829N/A const base::Time& file_time);
20829N/A
20829N/A+// Returns the total number of bytes used by all the files under |root_path|.
20829N/A+// If the path does not exist the function returns 0.
20829N/A+//
20829N/A+// This function is implemented using the FileEnumerator class so it is not
20829N/A+// particularly speedy in any platform.
20829N/A+int64 ComputeDirectorySize(const FilePath& root_path);
20829N/A+
20829N/A // Deletes the given path, whether it's a file or a directory.
20829N/A // If it's a directory, it's perfectly happy to delete all of the
20829N/A // directory's contents. Passing true to recursive deletes
20829N/A@@ -150,50 +93,51 @@ int CountFilesCreatedAfter(const FilePath& path,
20829N/A // WARNING: USING THIS WITH recursive==true IS EQUIVALENT
20829N/A // TO "rm -rf", SO USE WITH CAUTION.
20829N/A bool Delete(const FilePath& path, bool recursive);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool Delete(const std::wstring& path, bool recursive);
20829N/A+
20829N/A+#if defined(OS_WIN)
20829N/A+// Schedules to delete the given path, whether it's a file or a directory, until
20829N/A+// the operating system is restarted.
20829N/A+// Note:
20829N/A+// 1) The file/directory to be deleted should exist in a temp folder.
20829N/A+// 2) The directory to be deleted must be empty.
20829N/A+bool DeleteAfterReboot(const FilePath& path);
20829N/A+#endif
20829N/A
20829N/A // Moves the given path, whether it's a file or a directory.
20829N/A // If a simple rename is not possible, such as in the case where the paths are
20829N/A // on different volumes, this will attempt to copy and delete. Returns
20829N/A // true for success.
20829N/A bool Move(const FilePath& from_path, const FilePath& to_path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool Move(const std::wstring& from_path, const std::wstring& to_path);
20829N/A+
20829N/A+// Renames file |from_path| to |to_path|. Both paths must be on the same
20829N/A+// volume, or the function will fail. Destination file will be created
20829N/A+// if it doesn't exist. Prefer this function over Move when dealing with
20829N/A+// temporary files. On Windows it preserves attributes of the target file.
20829N/A+// Returns true on success.
20829N/A+bool ReplaceFile(const FilePath& from_path, const FilePath& to_path);
20829N/A
20829N/A // Copies a single file. Use CopyDirectory to copy directories.
20829N/A bool CopyFile(const FilePath& from_path, const FilePath& to_path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool CopyFile(const std::wstring& from_path, const std::wstring& to_path);
20829N/A
20829N/A // Copies the given path, and optionally all subdirectories and their contents
20829N/A // as well.
20829N/A // If there are files existing under to_path, always overwrite.
20829N/A // Returns true if successful, false otherwise.
20829N/A-// Dont't use wildcards on the names, it may stop working without notice.
20829N/A+// Don't use wildcards on the names, it may stop working without notice.
20829N/A //
20829N/A // If you only need to copy a file use CopyFile, it's faster.
20829N/A bool CopyDirectory(const FilePath& from_path, const FilePath& to_path,
20829N/A bool recursive);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path,
20829N/A- bool recursive);
20829N/A
20829N/A // Returns true if the given path exists on the local filesystem,
20829N/A // false otherwise.
20829N/A bool PathExists(const FilePath& path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool PathExists(const std::wstring& path);
20829N/A
20829N/A // Returns true if the given path is writable by the user, false otherwise.
20829N/A bool PathIsWritable(const FilePath& path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool PathIsWritable(const std::wstring& path);
20829N/A
20829N/A // Returns true if the given path exists and is a directory, false otherwise.
20829N/A bool DirectoryExists(const FilePath& path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool DirectoryExists(const std::wstring& path);
20829N/A
20829N/A #if defined(OS_WIN)
20829N/A // Gets the creation time of the given file (expressed in the local timezone),
20829N/A@@ -211,15 +155,14 @@ bool GetFileCreationLocalTimeFromHandle(HANDLE file_handle,
20829N/A // otherwise. If either file can't be read, returns false.
20829N/A bool ContentsEqual(const FilePath& filename1,
20829N/A const FilePath& filename2);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool ContentsEqual(const std::wstring& filename1,
20829N/A- const std::wstring& filename2);
20829N/A+
20829N/A+// Returns true if the contents of the two text files given are equal, false
20829N/A+// otherwise. This routine treats "\r\n" and "\n" as equivalent.
20829N/A+bool TextContentsEqual(const FilePath& filename1, const FilePath& filename2);
20829N/A
20829N/A // Read the file at |path| into |contents|, returning true on success.
20829N/A // Useful for unit tests.
20829N/A bool ReadFileToString(const FilePath& path, std::string* contents);
20829N/A-// Deprecated version.
20829N/A-bool ReadFileToString(const std::wstring& path, std::string* contents);
20829N/A
20829N/A #if defined(OS_POSIX)
20829N/A // Read exactly |bytes| bytes from file descriptor |fd|, storing the result
20829N/A@@ -230,11 +173,10 @@ bool ReadFromFD(int fd, char* buffer, size_t bytes);
20829N/A
20829N/A #if defined(OS_WIN)
20829N/A // Resolve Windows shortcut (.LNK file)
20829N/A-// Argument path specifies a valid LNK file. On success, return true and put
20829N/A-// the URL into path. If path is a invalid .LNK file, return false.
20829N/A+// This methods tries to resolve a shortcut .LNK file. If the |path| is valid
20829N/A+// returns true and puts the target into the |path|, otherwise returns
20829N/A+// false leaving the path as it is.
20829N/A bool ResolveShortcut(FilePath* path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool ResolveShortcut(std::wstring* path);
20829N/A
20829N/A // Create a Windows shortcut (.LNK file)
20829N/A // This method creates a shortcut link using the information given. Ensure
20829N/A@@ -243,24 +185,32 @@ bool ResolveShortcut(std::wstring* path);
20829N/A // 'source' is the existing file, 'destination' is the new link file to be
20829N/A // created; for best results pass the filename with the .lnk extension.
20829N/A // The 'icon' can specify a dll or exe in which case the icon index is the
20829N/A-// resource id.
20829N/A+// resource id. 'app_id' is the app model id for the shortcut on Win7.
20829N/A // Note that if the shortcut exists it will overwrite it.
20829N/A bool CreateShortcutLink(const wchar_t *source, const wchar_t *destination,
20829N/A const wchar_t *working_dir, const wchar_t *arguments,
20829N/A const wchar_t *description, const wchar_t *icon,
20829N/A- int icon_index);
20829N/A+ int icon_index, const wchar_t* app_id);
20829N/A
20829N/A // Update a Windows shortcut (.LNK file). This method assumes the shortcut
20829N/A // link already exists (otherwise false is returned). Ensure you have
20829N/A // initialized COM before calling into this function. Only 'destination'
20829N/A // parameter is required, everything else can be NULL (but if everything else
20829N/A // is NULL no changes are made to the shortcut). 'destination' is the link
20829N/A-// file to be updated. For best results pass the filename with the .lnk
20829N/A-// extension.
20829N/A+// file to be updated. 'app_id' is the app model id for the shortcut on Win7.
20829N/A+// For best results pass the filename with the .lnk extension.
20829N/A bool UpdateShortcutLink(const wchar_t *source, const wchar_t *destination,
20829N/A const wchar_t *working_dir, const wchar_t *arguments,
20829N/A const wchar_t *description, const wchar_t *icon,
20829N/A- int icon_index);
20829N/A+ int icon_index, const wchar_t* app_id);
20829N/A+
20829N/A+// Pins a shortcut to the Windows 7 taskbar. The shortcut file must already
20829N/A+// exist and be a shortcut that points to an executable.
20829N/A+bool TaskbarPinShortcutLink(const wchar_t* shortcut);
20829N/A+
20829N/A+// Unpins a shortcut from the Windows 7 taskbar. The shortcut must exist and
20829N/A+// already be pinned to the taskbar.
20829N/A+bool TaskbarUnpinShortcutLink(const wchar_t* shortcut);
20829N/A
20829N/A // Return true if the given directory is empty
20829N/A bool IsDirectoryEmpty(const std::wstring& dir_path);
20829N/A@@ -275,21 +225,18 @@ bool CopyAndDeleteDirectory(const FilePath& from_path,
20829N/A
20829N/A // Get the temporary directory provided by the system.
20829N/A bool GetTempDir(FilePath* path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool GetTempDir(std::wstring* path);
20829N/A // Get a temporary directory for shared memory files.
20829N/A // Only useful on POSIX; redirects to GetTempDir() on Windows.
20829N/A bool GetShmemTempDir(FilePath* path);
20829N/A
20829N/A+// Get the home directory. This is more complicated than just getenv("HOME")
20829N/A+// as it knows to fall back on getpwent() etc.
20829N/A+FilePath GetHomeDir();
20829N/A+
20829N/A // Creates a temporary file. The full path is placed in |path|, and the
20829N/A // function returns true if was successful in creating the file. The file will
20829N/A // be empty and all handles closed after this function returns.
20829N/A-// TODO(erikkay): rename this function and track down all of the callers.
20829N/A-// (Clarification of erik's comment: the intent is to rename the BlahFileName()
20829N/A-// calls into BlahFile(), since they create temp files (not temp filenames).)
20829N/A-bool CreateTemporaryFileName(FilePath* path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool CreateTemporaryFileName(std::wstring* temp_file);
20829N/A+bool CreateTemporaryFile(FilePath* path);
20829N/A
20829N/A // Create and open a temporary file. File is opened for read/write.
20829N/A // The full path is placed in |path|, and the function returns true if
20829N/A@@ -301,9 +248,16 @@ FILE* CreateAndOpenTemporaryShmemFile(FilePath* path);
20829N/A // Similar to CreateAndOpenTemporaryFile, but the file is created in |dir|.
20829N/A FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path);
20829N/A
20829N/A-// Same as CreateTemporaryFileName but the file is created in |dir|.
20829N/A-bool CreateTemporaryFileNameInDir(const std::wstring& dir,
20829N/A- std::wstring* temp_file);
20829N/A+// Same as CreateTemporaryFile but the file is created in |dir|.
20829N/A+bool CreateTemporaryFileInDir(const FilePath& dir,
20829N/A+ FilePath* temp_file);
20829N/A+
20829N/A+// Create a directory within another directory.
20829N/A+// Extra characters will be appended to |name_tmpl| to ensure that the
20829N/A+// new directory does not have the same name as an existing directory.
20829N/A+bool CreateTemporaryDirInDir(const FilePath& base_dir,
20829N/A+ const FilePath::StringType& prefix,
20829N/A+ FilePath* new_dir);
20829N/A
20829N/A // Create a new directory under TempPath. If prefix is provided, the new
20829N/A // directory name is in the format of prefixyyyy.
20829N/A@@ -312,21 +266,20 @@ bool CreateTemporaryFileNameInDir(const std::wstring& dir,
20829N/A // If success, return true and output the full path of the directory created.
20829N/A bool CreateNewTempDirectory(const FilePath::StringType& prefix,
20829N/A FilePath* new_temp_path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool CreateNewTempDirectory(const std::wstring& prefix,
20829N/A- std::wstring* new_temp_path);
20829N/A
20829N/A // Creates a directory, as well as creating any parent directories, if they
20829N/A // don't exist. Returns 'true' on successful creation, or if the directory
20829N/A-// already exists.
20829N/A+// already exists. The directory is only readable by the current user.
20829N/A bool CreateDirectory(const FilePath& full_path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool CreateDirectory(const std::wstring& full_path);
20829N/A
20829N/A // Returns the file size. Returns true on success.
20829N/A bool GetFileSize(const FilePath& file_path, int64* file_size);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool GetFileSize(const std::wstring& file_path, int64* file_size);
20829N/A+
20829N/A+// Returns true if the given path's base name is ".".
20829N/A+bool IsDot(const FilePath& path);
20829N/A+
20829N/A+// Returns true if the given path's base name is "..".
20829N/A+bool IsDotDot(const FilePath& path);
20829N/A
20829N/A // Used to hold information about a given file path. See GetFileInfo below.
20829N/A struct FileInfo {
20829N/A@@ -336,19 +289,25 @@ struct FileInfo {
20829N/A // True if the file corresponds to a directory.
20829N/A bool is_directory;
20829N/A
20829N/A+ // The last modified time of a file.
20829N/A+ base::Time last_modified;
20829N/A+
20829N/A // Add additional fields here as needed.
20829N/A };
20829N/A
20829N/A // Returns information about the given file path.
20829N/A bool GetFileInfo(const FilePath& file_path, FileInfo* info);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool GetFileInfo(const std::wstring& file_path, FileInfo* info);
20829N/A+
20829N/A+// Set the time of the last modification. Useful for unit tests.
20829N/A+bool SetLastModifiedTime(const FilePath& file_path, base::Time last_modified);
20829N/A+
20829N/A+#if defined(OS_POSIX)
20829N/A+// Store inode number of |path| in |inode|. Return true on success.
20829N/A+bool GetInode(const FilePath& path, ino_t* inode);
20829N/A+#endif
20829N/A
20829N/A // Wrapper for fopen-like calls. Returns non-NULL FILE* on success.
20829N/A FILE* OpenFile(const FilePath& filename, const char* mode);
20829N/A-// Deprecated temporary compatibility functions.
20829N/A-FILE* OpenFile(const std::string& filename, const char* mode);
20829N/A-FILE* OpenFile(const std::wstring& filename, const char* mode);
20829N/A
20829N/A // Closes file opened by OpenFile. Returns true on success.
20829N/A bool CloseFile(FILE* file);
20829N/A@@ -360,24 +319,20 @@ bool TruncateFile(FILE* file);
20829N/A // Reads the given number of bytes from the file into the buffer. Returns
20829N/A // the number of read bytes, or -1 on error.
20829N/A int ReadFile(const FilePath& filename, char* data, int size);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-int ReadFile(const std::wstring& filename, char* data, int size);
20829N/A
20829N/A // Writes the given buffer into the file, overwriting any data that was
20829N/A // previously there. Returns the number of bytes written, or -1 on error.
20829N/A int WriteFile(const FilePath& filename, const char* data, int size);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-int WriteFile(const std::wstring& filename, const char* data, int size);
20829N/A+#if defined(OS_POSIX)
20829N/A+// Append the data to |fd|. Does not close |fd| when done.
20829N/A+int WriteFileDescriptor(const int fd, const char* data, int size);
20829N/A+#endif
20829N/A
20829N/A // Gets the current working directory for the process.
20829N/A bool GetCurrentDirectory(FilePath* path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool GetCurrentDirectory(std::wstring* path);
20829N/A
20829N/A // Sets the current working directory for the process.
20829N/A bool SetCurrentDirectory(const FilePath& path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool SetCurrentDirectory(const std::wstring& current_directory);
20829N/A
20829N/A // A class to handle auto-closing of FILE*'s.
20829N/A class ScopedFILEClose {
20829N/A@@ -391,6 +346,20 @@ class ScopedFILEClose {
20829N/A
20829N/A typedef scoped_ptr_malloc<FILE, ScopedFILEClose> ScopedFILE;
20829N/A
20829N/A+#if defined(OS_POSIX)
20829N/A+// A class to handle auto-closing of FDs.
20829N/A+class ScopedFDClose {
20829N/A+ public:
20829N/A+ inline void operator()(int* x) const {
20829N/A+ if (x && *x >= 0) {
20829N/A+ HANDLE_EINTR(close(*x));
20829N/A+ }
20829N/A+ }
20829N/A+};
20829N/A+
20829N/A+typedef scoped_ptr_malloc<int, ScopedFDClose> ScopedFD;
20829N/A+#endif // OS_POSIX
20829N/A+
20829N/A // A class for enumerating the files in a provided path. The order of the
20829N/A // results is not guaranteed.
20829N/A //
20829N/A@@ -408,9 +377,12 @@ class FileEnumerator {
20829N/A #endif
20829N/A
20829N/A enum FILE_TYPE {
20829N/A- FILES = 0x1,
20829N/A- DIRECTORIES = 0x2,
20829N/A- FILES_AND_DIRECTORIES = 0x3
20829N/A+ FILES = 1 << 0,
20829N/A+ DIRECTORIES = 1 << 1,
20829N/A+ INCLUDE_DOT_DOT = 1 << 2,
20829N/A+#if defined(OS_POSIX)
20829N/A+ SHOW_SYM_LINKS = 1 << 4,
20829N/A+#endif
20829N/A };
20829N/A
20829N/A // |root_path| is the starting directory to search for. It may or may not end
20829N/A@@ -448,11 +420,40 @@ class FileEnumerator {
20829N/A // Write the file info into |info|.
20829N/A void GetFindInfo(FindInfo* info);
20829N/A
20829N/A+ // Looks inside a FindInfo and determines if it's a directory.
20829N/A+ static bool IsDirectory(const FindInfo& info);
20829N/A+
20829N/A+ static FilePath GetFilename(const FindInfo& find_info);
20829N/A+
20829N/A private:
20829N/A+ // Returns true if the given path should be skipped in enumeration.
20829N/A+ bool ShouldSkip(const FilePath& path);
20829N/A+
20829N/A+
20829N/A+#if defined(OS_WIN)
20829N/A+ WIN32_FIND_DATA find_data_;
20829N/A+ HANDLE find_handle_;
20829N/A+#elif defined(OS_POSIX)
20829N/A+ typedef struct {
20829N/A+ FilePath filename;
20829N/A+ struct stat stat;
20829N/A+ } DirectoryEntryInfo;
20829N/A+
20829N/A+ // Read the filenames in source into the vector of DirectoryEntryInfo's
20829N/A+ static bool ReadDirectory(std::vector<DirectoryEntryInfo>* entries,
20829N/A+ const FilePath& source, bool show_links);
20829N/A+
20829N/A+ // The files in the current directory
20829N/A+ std::vector<DirectoryEntryInfo> directory_entries_;
20829N/A+
20829N/A+ // The next entry to use from the directory_entries_ vector
20829N/A+ size_t current_directory_entry_;
20829N/A+#endif
20829N/A+
20829N/A FilePath root_path_;
20829N/A bool recursive_;
20829N/A FILE_TYPE file_type_;
20829N/A- FilePath pattern_; // Empty when we want to find everything.
20829N/A+ FilePath::StringType pattern_; // Empty when we want to find everything.
20829N/A
20829N/A // Set to true when there is a find operation open. This way, we can lazily
20829N/A // start the operations when the caller calls Next().
20829N/A@@ -462,17 +463,7 @@ class FileEnumerator {
20829N/A // enumerate in the breadth-first search.
20829N/A std::stack<FilePath> pending_paths_;
20829N/A
20829N/A-#if defined(OS_WIN)
20829N/A- WIN32_FIND_DATA find_data_;
20829N/A- HANDLE find_handle_;
20829N/A-#elif defined(ANDROID)
20829N/A- void *fts_;
20829N/A-#elif defined(OS_POSIX)
20829N/A- FTS* fts_;
20829N/A- FTSENT* fts_ent_;
20829N/A-#endif
20829N/A-
20829N/A- DISALLOW_EVIL_CONSTRUCTORS(FileEnumerator);
20829N/A+ DISALLOW_COPY_AND_ASSIGN(FileEnumerator);
20829N/A };
20829N/A
20829N/A class MemoryMappedFile {
20829N/A@@ -487,6 +478,9 @@ class MemoryMappedFile {
20829N/A // the file does not exist, or the memory mapping fails, it will return false.
20829N/A // Later we may want to allow the user to specify access.
20829N/A bool Initialize(const FilePath& file_name);
20829N/A+ // As above, but works with an already-opened file. MemoryMappedFile will take
20829N/A+ // ownership of |file| and close it when done.
20829N/A+ bool Initialize(base::PlatformFile file);
20829N/A
20829N/A const uint8* data() const { return data_; }
20829N/A size_t length() const { return length_; }
20829N/A@@ -495,19 +489,19 @@ class MemoryMappedFile {
20829N/A bool IsValid();
20829N/A
20829N/A private:
20829N/A+ // Open the given file and pass it to MapFileToMemoryInternal().
20829N/A+ bool MapFileToMemory(const FilePath& file_name);
20829N/A+
20829N/A // Map the file to memory, set data_ to that memory address. Return true on
20829N/A // success, false on any kind of failure. This is a helper for Initialize().
20829N/A- bool MapFileToMemory(const FilePath& file_name);
20829N/A+ bool MapFileToMemoryInternal();
20829N/A
20829N/A // Closes all open handles. Later we may want to make this public.
20829N/A void CloseHandles();
20829N/A
20829N/A+ base::PlatformFile file_;
20829N/A #if defined(OS_WIN)
20829N/A- HANDLE file_;
20829N/A HANDLE file_mapping_;
20829N/A-#elif defined(OS_POSIX)
20829N/A- // The file descriptor.
20829N/A- int file_;
20829N/A #endif
20829N/A uint8* data_;
20829N/A size_t length_;
20829N/A@@ -521,6 +515,66 @@ bool RenameFileAndResetSecurityDescriptor(
20829N/A const FilePath& source_file_path,
20829N/A const FilePath& target_file_path);
20829N/A
20829N/A+// Returns whether the file has been modified since a particular date.
20829N/A+bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info,
20829N/A+ const base::Time& cutoff_time);
20829N/A+
20829N/A+#ifdef UNIT_TEST
20829N/A+
20829N/A+inline bool MakeFileUnreadable(const FilePath& path) {
20829N/A+#if defined(OS_POSIX)
20829N/A+ struct stat stat_buf;
20829N/A+ if (stat(path.value().c_str(), &stat_buf) != 0)
20829N/A+ return false;
20829N/A+ stat_buf.st_mode &= ~(S_IRUSR | S_IRGRP | S_IROTH);
20829N/A+
20829N/A+ return chmod(path.value().c_str(), stat_buf.st_mode) == 0;
20829N/A+
20829N/A+#elif defined(OS_WIN)
20829N/A+ PACL old_dacl;
20829N/A+ PSECURITY_DESCRIPTOR security_descriptor;
20829N/A+ if (GetNamedSecurityInfo(const_cast<wchar_t*>(path.value().c_str()),
20829N/A+ SE_FILE_OBJECT,
20829N/A+ DACL_SECURITY_INFORMATION, NULL, NULL, &old_dacl,
20829N/A+ NULL, &security_descriptor) != ERROR_SUCCESS)
20829N/A+ return false;
20829N/A+
20829N/A+ // Deny Read access for the current user.
20829N/A+ EXPLICIT_ACCESS change;
20829N/A+ change.grfAccessPermissions = GENERIC_READ;
20829N/A+ change.grfAccessMode = DENY_ACCESS;
20829N/A+ change.grfInheritance = 0;
20829N/A+ change.Trustee.pMultipleTrustee = NULL;
20829N/A+ change.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
20829N/A+ change.Trustee.TrusteeForm = TRUSTEE_IS_NAME;
20829N/A+ change.Trustee.TrusteeType = TRUSTEE_IS_USER;
20829N/A+ change.Trustee.ptstrName = L"CURRENT_USER";
20829N/A+
20829N/A+ PACL new_dacl;
20829N/A+ if (SetEntriesInAcl(1, &change, old_dacl, &new_dacl) != ERROR_SUCCESS) {
20829N/A+ LocalFree(security_descriptor);
20829N/A+ return false;
20829N/A+ }
20829N/A+
20829N/A+ DWORD rc = SetNamedSecurityInfo(const_cast<wchar_t*>(path.value().c_str()),
20829N/A+ SE_FILE_OBJECT, DACL_SECURITY_INFORMATION,
20829N/A+ NULL, NULL, new_dacl, NULL);
20829N/A+ LocalFree(security_descriptor);
20829N/A+ LocalFree(new_dacl);
20829N/A+
20829N/A+ return rc == ERROR_SUCCESS;
20829N/A+#else
20829N/A+ NOTIMPLEMENTED();
20829N/A+ return false;
20829N/A+#endif
20829N/A+}
20829N/A+
20829N/A+#endif // UNIT_TEST
20829N/A+
20829N/A } // namespace file_util
20829N/A
20829N/A+// Deprecated functions have been moved to this separate header file,
20829N/A+// which must be included last after all the above definitions.
20829N/A+#include "base/file_util_deprecated.h"
20829N/A+
20829N/A #endif // BASE_FILE_UTIL_H_
20829N/Adiff --git a/ipc/chromium/src/base/file_util_posix.cc b/ipc/chromium/src/base/file_util_posix.cc
20829N/Aindex bc07b19..a78c0d3 100644
20829N/A--- a/ipc/chromium/src/base/file_util_posix.cc
20829N/A+++ b/ipc/chromium/src/base/file_util_posix.cc
20829N/A@@ -1,4 +1,4 @@
20829N/A-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
20829N/A+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
20829N/A // Use of this source code is governed by a BSD-style license that can be
20829N/A // found in the LICENSE file.
20829N/A
20829N/A@@ -8,48 +8,60 @@
20829N/A #include <errno.h>
20829N/A #include <fcntl.h>
20829N/A #include <fnmatch.h>
20829N/A-#ifndef ANDROID
20829N/A-#include <fts.h>
20829N/A-#endif
20829N/A #include <libgen.h>
20829N/A #include <stdio.h>
20829N/A+#include <stdlib.h>
20829N/A #include <string.h>
20829N/A #include <sys/errno.h>
20829N/A #include <sys/mman.h>
20829N/A #include <sys/stat.h>
20829N/A+#include <sys/time.h>
20829N/A #include <sys/types.h>
20829N/A #include <time.h>
20829N/A #include <unistd.h>
20829N/A
20829N/A+#if defined(OS_MACOSX)
20829N/A+#include <AvailabilityMacros.h>
20829N/A+#else
20829N/A+#include <glib.h>
20829N/A+#endif
20829N/A+
20829N/A #include <fstream>
20829N/A
20829N/A #include "base/basictypes.h"
20829N/A #include "base/eintr_wrapper.h"
20829N/A #include "base/file_path.h"
20829N/A+#include "base/lock.h"
20829N/A #include "base/logging.h"
20829N/A+#include "base/scoped_ptr.h"
20829N/A+#include "base/singleton.h"
20829N/A #include "base/string_util.h"
20829N/A+#include "base/sys_string_conversions.h"
20829N/A #include "base/time.h"
20829N/A
20829N/A namespace file_util {
20829N/A
20829N/A+#if defined(OS_OPENBSD) || defined(OS_FREEBSD) || \
20829N/A+ (defined(OS_MACOSX) && \
20829N/A+ MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
20829N/A+typedef struct stat stat_wrapper_t;
20829N/A+static int CallStat(const char *path, stat_wrapper_t *sb) {
20829N/A+ return stat(path, sb);
20829N/A+}
20829N/A+#else
20829N/A+typedef struct stat64 stat_wrapper_t;
20829N/A+static int CallStat(const char *path, stat_wrapper_t *sb) {
20829N/A+ return stat64(path, sb);
20829N/A+}
20829N/A+#endif
20829N/A+
20829N/A+
20829N/A #if defined(GOOGLE_CHROME_BUILD)
20829N/A static const char* kTempFileName = "com.google.chrome.XXXXXX";
20829N/A #else
20829N/A static const char* kTempFileName = "org.chromium.XXXXXX";
20829N/A #endif
20829N/A
20829N/A-std::wstring GetDirectoryFromPath(const std::wstring& path) {
20829N/A- if (EndsWithSeparator(path)) {
20829N/A- std::wstring dir = path;
20829N/A- TrimTrailingSeparator(&dir);
20829N/A- return dir;
20829N/A- } else {
20829N/A- char full_path[PATH_MAX];
20829N/A- base::strlcpy(full_path, WideToUTF8(path).c_str(), arraysize(full_path));
20829N/A- return UTF8ToWide(dirname(full_path));
20829N/A- }
20829N/A-}
20829N/A-
20829N/A bool AbsolutePath(FilePath* path) {
20829N/A char full_path[PATH_MAX];
20829N/A if (realpath(path->value().c_str(), full_path) == NULL)
20829N/A@@ -64,17 +76,30 @@ int CountFilesCreatedAfter(const FilePath& path,
20829N/A
20829N/A DIR* dir = opendir(path.value().c_str());
20829N/A if (dir) {
20829N/A+#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) && \
20829N/A+ !defined(OS_OPENBSD) && !defined(OS_SOLARIS)
20829N/A+ #error Port warning: depending on the definition of struct dirent, \
20829N/A+ additional space for pathname may be needed
20829N/A+#endif
20829N/A+
20829N/A+#ifdef OS_SOLARIS
20829N/A+ struct {
20829N/A+ dirent dent_buffer;
20829N/A+ char chars[MAXNAMLEN];
20829N/A+ } ent_buf;
20829N/A+#else
20829N/A struct dirent ent_buf;
20829N/A+#endif
20829N/A struct dirent* ent;
20829N/A- while (readdir_r(dir, &ent_buf, &ent) == 0 && ent) {
20829N/A+ while (readdir_r(dir, (dirent *)&ent_buf, &ent) == 0 && ent) {
20829N/A if ((strcmp(ent->d_name, ".") == 0) ||
20829N/A (strcmp(ent->d_name, "..") == 0))
20829N/A continue;
20829N/A
20829N/A- struct stat64 st;
20829N/A- int test = stat64(path.Append(ent->d_name).value().c_str(), &st);
20829N/A+ stat_wrapper_t st;
20829N/A+ int test = CallStat(path.Append(ent->d_name).value().c_str(), &st);
20829N/A if (test != 0) {
20829N/A- LOG(ERROR) << "stat64 failed: " << strerror(errno);
20829N/A+ LOG(ERROR) << "stat64 failed";
20829N/A continue;
20829N/A }
20829N/A // Here, we use Time::TimeT(), which discards microseconds. This
20829N/A@@ -106,8 +131,8 @@ int CountFilesCreatedAfter(const FilePath& path,
20829N/A // here.
20829N/A bool Delete(const FilePath& path, bool recursive) {
20829N/A const char* path_str = path.value().c_str();
20829N/A- struct stat64 file_info;
20829N/A- int test = stat64(path_str, &file_info);
20829N/A+ stat_wrapper_t file_info;
20829N/A+ int test = CallStat(path_str, &file_info);
20829N/A if (test != 0) {
20829N/A // The Windows version defines this condition as success.
20829N/A bool ret = (errno == ENOENT || errno == ENOTDIR);
20829N/A@@ -118,53 +143,46 @@ bool Delete(const FilePath& path, bool recursive) {
20829N/A if (!recursive)
20829N/A return (rmdir(path_str) == 0);
20829N/A
20829N/A-#ifdef ANDROID
20829N/A- // XXX Need ftsless impl for bionic
20829N/A- return false;
20829N/A-#else
20829N/A bool success = true;
20829N/A- int ftsflags = FTS_PHYSICAL | FTS_NOSTAT;
20829N/A- char top_dir[PATH_MAX];
20829N/A- if (base::strlcpy(top_dir, path_str,
20829N/A- arraysize(top_dir)) >= arraysize(top_dir)) {
20829N/A- return false;
20829N/A+ std::stack<std::string> directories;
20829N/A+ directories.push(path.value());
20829N/A+ FileEnumerator traversal(path, true, static_cast<FileEnumerator::FILE_TYPE>(
20829N/A+ FileEnumerator::FILES | FileEnumerator::DIRECTORIES |
20829N/A+ FileEnumerator::SHOW_SYM_LINKS));
20829N/A+ for (FilePath current = traversal.Next(); success && !current.empty();
20829N/A+ current = traversal.Next()) {
20829N/A+ FileEnumerator::FindInfo info;
20829N/A+ traversal.GetFindInfo(&info);
20829N/A+
20829N/A+ if (S_ISDIR(info.stat.st_mode))
20829N/A+ directories.push(current.value());
20829N/A+ else
20829N/A+ success = (unlink(current.value().c_str()) == 0);
20829N/A }
20829N/A- char* dir_list[2] = { top_dir, NULL };
20829N/A- FTS* fts = fts_open(dir_list, ftsflags, NULL);
20829N/A- if (fts) {
20829N/A- FTSENT* fts_ent = fts_read(fts);
20829N/A- while (success && fts_ent != NULL) {
20829N/A- switch (fts_ent->fts_info) {
20829N/A- case FTS_DNR:
20829N/A- case FTS_ERR:
20829N/A- // log error
20829N/A- success = false;
20829N/A- continue;
20829N/A- break;
20829N/A- case FTS_DP:
20829N/A- success = (rmdir(fts_ent->fts_accpath) == 0);
20829N/A- break;
20829N/A- case FTS_D:
20829N/A- break;
20829N/A- case FTS_NSOK:
20829N/A- case FTS_F:
20829N/A- case FTS_SL:
20829N/A- case FTS_SLNONE:
20829N/A- success = (unlink(fts_ent->fts_accpath) == 0);
20829N/A- break;
20829N/A- default:
20829N/A- DCHECK(false);
20829N/A- break;
20829N/A- }
20829N/A- fts_ent = fts_read(fts);
20829N/A- }
20829N/A- fts_close(fts);
20829N/A+
20829N/A+ while (success && !directories.empty()) {
20829N/A+ FilePath dir = FilePath(directories.top());
20829N/A+ directories.pop();
20829N/A+ success = (rmdir(dir.value().c_str()) == 0);
20829N/A }
20829N/A+
20829N/A return success;
20829N/A-#endif
20829N/A }
20829N/A
20829N/A bool Move(const FilePath& from_path, const FilePath& to_path) {
20829N/A+ // Windows compatibility: if to_path exists, from_path and to_path
20829N/A+ // must be the same type, either both files, or both directories.
20829N/A+ stat_wrapper_t to_file_info;
20829N/A+ if (CallStat(to_path.value().c_str(), &to_file_info) == 0) {
20829N/A+ stat_wrapper_t from_file_info;
20829N/A+ if (CallStat(from_path.value().c_str(), &from_file_info) == 0) {
20829N/A+ if (S_ISDIR(to_file_info.st_mode) != S_ISDIR(from_file_info.st_mode))
20829N/A+ return false;
20829N/A+ } else {
20829N/A+ return false;
20829N/A+ }
20829N/A+ }
20829N/A+
20829N/A if (rename(from_path.value().c_str(), to_path.value().c_str()) == 0)
20829N/A return true;
20829N/A
20829N/A@@ -175,6 +193,10 @@ bool Move(const FilePath& from_path, const FilePath& to_path) {
20829N/A return true;
20829N/A }
20829N/A
20829N/A+bool ReplaceFile(const FilePath& from_path, const FilePath& to_path) {
20829N/A+ return (rename(from_path.value().c_str(), to_path.value().c_str()) == 0);
20829N/A+}
20829N/A+
20829N/A bool CopyDirectory(const FilePath& from_path,
20829N/A const FilePath& to_path,
20829N/A bool recursive) {
20829N/A@@ -191,116 +213,101 @@ bool CopyDirectory(const FilePath& from_path,
20829N/A return false;
20829N/A }
20829N/A
20829N/A-#ifdef ANDROID
20829N/A- // XXX Need ftsless impl for bionic
20829N/A- return false;
20829N/A-#else
20829N/A- char* dir_list[] = { top_dir, NULL };
20829N/A- FTS* fts = fts_open(dir_list, FTS_PHYSICAL | FTS_NOSTAT, NULL);
20829N/A- if (!fts) {
20829N/A- LOG(ERROR) << "fts_open failed: " << strerror(errno);
20829N/A+ // This function does not properly handle destinations within the source
20829N/A+ FilePath real_to_path = to_path;
20829N/A+ if (PathExists(real_to_path)) {
20829N/A+ if (!AbsolutePath(&real_to_path))
20829N/A+ return false;
20829N/A+ } else {
20829N/A+ real_to_path = real_to_path.DirName();
20829N/A+ if (!AbsolutePath(&real_to_path))
20829N/A+ return false;
20829N/A+ }
20829N/A+ FilePath real_from_path = from_path;
20829N/A+ if (!AbsolutePath(&real_from_path))
20829N/A+ return false;
20829N/A+ if (real_to_path.value().size() >= real_from_path.value().size() &&
20829N/A+ real_to_path.value().compare(0, real_from_path.value().size(),
20829N/A+ real_from_path.value()) == 0)
20829N/A return false;
20829N/A+
20829N/A+ bool success = true;
20829N/A+ FileEnumerator::FILE_TYPE traverse_type =
20829N/A+ static_cast<FileEnumerator::FILE_TYPE>(FileEnumerator::FILES |
20829N/A+ FileEnumerator::SHOW_SYM_LINKS);
20829N/A+ if (recursive)
20829N/A+ traverse_type = static_cast<FileEnumerator::FILE_TYPE>(
20829N/A+ traverse_type | FileEnumerator::DIRECTORIES);
20829N/A+ FileEnumerator traversal(from_path, recursive, traverse_type);
20829N/A+
20829N/A+ // We have to mimic windows behavior here. |to_path| may not exist yet,
20829N/A+ // start the loop with |to_path|.
20829N/A+ FileEnumerator::FindInfo info;
20829N/A+ FilePath current = from_path;
20829N/A+ if (stat(from_path.value().c_str(), &info.stat) < 0) {
20829N/A+ LOG(ERROR) << "CopyDirectory() couldn't stat source directory: " <<
20829N/A+ from_path.value() << " errno = " << errno;
20829N/A+ success = false;
20829N/A+ }
20829N/A+ struct stat to_path_stat;
20829N/A+ FilePath from_path_base = from_path;
20829N/A+ if (recursive && stat(to_path.value().c_str(), &to_path_stat) == 0 &&
20829N/A+ S_ISDIR(to_path_stat.st_mode)) {
20829N/A+ // If the destination already exists and is a directory, then the
20829N/A+ // top level of source needs to be copied.
20829N/A+ from_path_base = from_path.DirName();
20829N/A }
20829N/A
20829N/A- int error = 0;
20829N/A- FTSENT* ent;
20829N/A- while (!error && (ent = fts_read(fts)) != NULL) {
20829N/A- // ent->fts_path is the source path, including from_path, so paste
20829N/A+ // The Windows version of this function assumes that non-recursive calls
20829N/A+ // will always have a directory for from_path.
20829N/A+ DCHECK(recursive || S_ISDIR(info.stat.st_mode));
20829N/A+
20829N/A+ while (success && !current.empty()) {
20829N/A+ // current is the source path, including from_path, so paste
20829N/A // the suffix after from_path onto to_path to create the target_path.
20829N/A- std::string suffix(&ent->fts_path[from_path.value().size()]);
20829N/A+ std::string suffix(&current.value().c_str()[from_path_base.value().size()]);
20829N/A // Strip the leading '/' (if any).
20829N/A if (!suffix.empty()) {
20829N/A DCHECK_EQ('/', suffix[0]);
20829N/A suffix.erase(0, 1);
20829N/A }
20829N/A const FilePath target_path = to_path.Append(suffix);
20829N/A- switch (ent->fts_info) {
20829N/A- case FTS_D: // Preorder directory.
20829N/A- // If we encounter a subdirectory in a non-recursive copy, prune it
20829N/A- // from the traversal.
20829N/A- if (!recursive && ent->fts_level > 0) {
20829N/A- if (fts_set(fts, ent, FTS_SKIP) != 0)
20829N/A- error = errno;
20829N/A- continue;
20829N/A- }
20829N/A-
20829N/A- // Try creating the target dir, continuing on it if it exists already.
20829N/A- // Rely on the user's umask to produce correct permissions.
20829N/A- if (mkdir(target_path.value().c_str(), 0777) != 0) {
20829N/A- if (errno != EEXIST)
20829N/A- error = errno;
20829N/A- }
20829N/A- break;
20829N/A- case FTS_F: // Regular file.
20829N/A- case FTS_NSOK: // File, no stat info requested.
20829N/A- errno = 0;
20829N/A- if (!CopyFile(FilePath(ent->fts_path), target_path))
20829N/A- error = errno ? errno : EINVAL;
20829N/A- break;
20829N/A- case FTS_DP: // Postorder directory.
20829N/A- case FTS_DOT: // "." or ".."
20829N/A- // Skip it.
20829N/A- continue;
20829N/A- case FTS_DC: // Directory causing a cycle.
20829N/A- // Skip this branch.
20829N/A- if (fts_set(fts, ent, FTS_SKIP) != 0)
20829N/A- error = errno;
20829N/A- break;
20829N/A- case FTS_DNR: // Directory cannot be read.
20829N/A- case FTS_ERR: // Error.
20829N/A- case FTS_NS: // Stat failed.
20829N/A- // Abort with the error.
20829N/A- error = ent->fts_errno;
20829N/A- break;
20829N/A- case FTS_SL: // Symlink.
20829N/A- case FTS_SLNONE: // Symlink with broken target.
20829N/A- LOG(WARNING) << "CopyDirectory() skipping symbolic link: " <<
20829N/A- ent->fts_path;
20829N/A- continue;
20829N/A- case FTS_DEFAULT: // Some other sort of file.
20829N/A- LOG(WARNING) << "CopyDirectory() skipping file of unknown type: " <<
20829N/A- ent->fts_path;
20829N/A- continue;
20829N/A- default:
20829N/A- NOTREACHED();
20829N/A- continue; // Hope for the best!
20829N/A+
20829N/A+ if (S_ISDIR(info.stat.st_mode)) {
20829N/A+ if (mkdir(target_path.value().c_str(), info.stat.st_mode & 01777) != 0 &&
20829N/A+ errno != EEXIST) {
20829N/A+ LOG(ERROR) << "CopyDirectory() couldn't create directory: " <<
20829N/A+ target_path.value() << " errno = " << errno;
20829N/A+ success = false;
20829N/A+ }
20829N/A+ } else if (S_ISREG(info.stat.st_mode)) {
20829N/A+ if (!CopyFile(current, target_path)) {
20829N/A+ LOG(ERROR) << "CopyDirectory() couldn't create file: " <<
20829N/A+ target_path.value();
20829N/A+ success = false;
20829N/A+ }
20829N/A+ } else {
20829N/A+ LOG(WARNING) << "CopyDirectory() skipping non-regular file: " <<
20829N/A+ current.value();
20829N/A }
20829N/A- }
20829N/A- // fts_read may have returned NULL and set errno to indicate an error.
20829N/A- if (!error && errno != 0)
20829N/A- error = errno;
20829N/A-
20829N/A- if (!fts_close(fts)) {
20829N/A- // If we already have an error, let's use that error instead of the error
20829N/A- // fts_close set.
20829N/A- if (!error)
20829N/A- error = errno;
20829N/A- }
20829N/A
20829N/A- if (error) {
20829N/A- LOG(ERROR) << "CopyDirectory(): " << strerror(error);
20829N/A- return false;
20829N/A+ current = traversal.Next();
20829N/A+ traversal.GetFindInfo(&info);
20829N/A }
20829N/A- return true;
20829N/A-#endif
20829N/A+
20829N/A+ return success;
20829N/A }
20829N/A
20829N/A bool PathExists(const FilePath& path) {
20829N/A- struct stat64 file_info;
20829N/A- return (stat64(path.value().c_str(), &file_info) == 0);
20829N/A+ stat_wrapper_t file_info;
20829N/A+ return CallStat(path.value().c_str(), &file_info) == 0;
20829N/A }
20829N/A
20829N/A bool PathIsWritable(const FilePath& path) {
20829N/A FilePath test_path(path);
20829N/A- struct stat64 file_info;
20829N/A- if (stat64(test_path.value().c_str(), &file_info) != 0) {
20829N/A- // If the path doesn't exist, test the parent dir.
20829N/A- test_path = test_path.DirName();
20829N/A- // If the parent dir doesn't exist, then return false (the path is not
20829N/A- // directly writable).
20829N/A- if (stat64(test_path.value().c_str(), &file_info) != 0)
20829N/A- return false;
20829N/A- }
20829N/A+ stat_wrapper_t file_info;
20829N/A+ if (CallStat(test_path.value().c_str(), &file_info) != 0)
20829N/A+ return false;
20829N/A if (S_IWOTH & file_info.st_mode)
20829N/A return true;
20829N/A if (getegid() == file_info.st_gid && (S_IWGRP & file_info.st_mode))
20829N/A@@ -311,8 +318,8 @@ bool PathIsWritable(const FilePath& path) {
20829N/A }
20829N/A
20829N/A bool DirectoryExists(const FilePath& path) {
20829N/A- struct stat64 file_info;
20829N/A- if (stat64(path.value().c_str(), &file_info) == 0)
20829N/A+ stat_wrapper_t file_info;
20829N/A+ if (CallStat(path.value().c_str(), &file_info) == 0)
20829N/A return S_ISDIR(file_info.st_mode);
20829N/A return false;
20829N/A }
20829N/A@@ -358,10 +365,8 @@ bool ReadFromFD(int fd, char* buffer, size_t bytes) {
20829N/A }
20829N/A
20829N/A // Creates and opens a temporary file in |directory|, returning the
20829N/A-// file descriptor. |path| is set to the temporary file path.
20829N/A-// Note TODO(erikkay) comment in header for BlahFileName() calls; the
20829N/A-// intent is to rename these files BlahFile() (since they create
20829N/A-// files, not filenames). This function does NOT unlink() the file.
20829N/A+// file descriptor. |path| is set to the temporary file path.
20829N/A+// This function does NOT unlink() the file.
20829N/A int CreateAndOpenFdForTemporaryFile(FilePath directory, FilePath* path) {
20829N/A *path = directory.Append(kTempFileName);
20829N/A const std::string& tmpdir_string = path->value();
20829N/A@@ -371,7 +376,7 @@ int CreateAndOpenFdForTemporaryFile(FilePath directory, FilePath* path) {
20829N/A return mkstemp(buffer);
20829N/A }
20829N/A
20829N/A-bool CreateTemporaryFileName(FilePath* path) {
20829N/A+bool CreateTemporaryFile(FilePath* path) {
20829N/A FilePath directory;
20829N/A if (!GetTempDir(&directory))
20829N/A return false;
20829N/A@@ -398,33 +403,46 @@ FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path) {
20829N/A return fdopen(fd, "a+");
20829N/A }
20829N/A
20829N/A-bool CreateTemporaryFileNameInDir(const std::wstring& dir,
20829N/A- std::wstring* temp_file) {
20829N/A- // Not implemented yet.
20829N/A- NOTREACHED();
20829N/A- return false;
20829N/A+bool CreateTemporaryFileInDir(const FilePath& dir, FilePath* temp_file) {
20829N/A+ int fd = CreateAndOpenFdForTemporaryFile(dir, temp_file);
20829N/A+ return ((fd >= 0) && !close(fd));
20829N/A }
20829N/A
20829N/A-bool CreateNewTempDirectory(const FilePath::StringType& prefix,
20829N/A- FilePath* new_temp_path) {
20829N/A- FilePath tmpdir;
20829N/A- if (!GetTempDir(&tmpdir))
20829N/A- return false;
20829N/A- tmpdir = tmpdir.Append(kTempFileName);
20829N/A- std::string tmpdir_string = tmpdir.value();
20829N/A+static bool CreateTemporaryDirInDirImpl(const FilePath& base_dir,
20829N/A+ const FilePath::StringType& name_tmpl,
20829N/A+ FilePath* new_dir) {
20829N/A+ CHECK(name_tmpl.find("XXXXXX") != FilePath::StringType::npos)
20829N/A+ << "Directory name template must contain \"XXXXXX\".";
20829N/A+
20829N/A+ FilePath sub_dir = base_dir.Append(name_tmpl);
20829N/A+ std::string sub_dir_string = sub_dir.value();
20829N/A+
20829N/A // this should be OK since mkdtemp just replaces characters in place
20829N/A- char* buffer = const_cast<char*>(tmpdir_string.c_str());
20829N/A-#ifdef ANDROID
20829N/A- char* dtemp = NULL;
20829N/A-#else
20829N/A+ char* buffer = const_cast<char*>(sub_dir_string.c_str());
20829N/A char* dtemp = mkdtemp(buffer);
20829N/A-#endif
20829N/A if (!dtemp)
20829N/A return false;
20829N/A- *new_temp_path = FilePath(dtemp);
20829N/A+ *new_dir = FilePath(dtemp);
20829N/A return true;
20829N/A }
20829N/A
20829N/A+bool CreateTemporaryDirInDir(const FilePath& base_dir,
20829N/A+ const FilePath::StringType& prefix,
20829N/A+ FilePath* new_dir) {
20829N/A+ FilePath::StringType mkdtemp_template = prefix;
20829N/A+ mkdtemp_template.append(FILE_PATH_LITERAL("XXXXXX"));
20829N/A+ return CreateTemporaryDirInDirImpl(base_dir, mkdtemp_template, new_dir);
20829N/A+}
20829N/A+
20829N/A+bool CreateNewTempDirectory(const FilePath::StringType& prefix,
20829N/A+ FilePath* new_temp_path) {
20829N/A+ FilePath tmpdir;
20829N/A+ if (!GetTempDir(&tmpdir))
20829N/A+ return false;
20829N/A+
20829N/A+ return CreateTemporaryDirInDirImpl(tmpdir, kTempFileName, new_temp_path);
20829N/A+}
20829N/A+
20829N/A bool CreateDirectory(const FilePath& full_path) {
20829N/A std::vector<FilePath> subpaths;
20829N/A
20829N/A@@ -440,20 +458,44 @@ bool CreateDirectory(const FilePath& full_path) {
20829N/A // Iterate through the parents and create the missing ones.
20829N/A for (std::vector<FilePath>::reverse_iterator i = subpaths.rbegin();
20829N/A i != subpaths.rend(); ++i) {
20829N/A- if (!DirectoryExists(*i)) {
20829N/A- if (mkdir(i->value().c_str(), 0777) != 0)
20829N/A- return false;
20829N/A- }
20829N/A+ if (DirectoryExists(*i))
20829N/A+ continue;
20829N/A+ if (mkdir(i->value().c_str(), 0700) == 0)
20829N/A+ continue;
20829N/A+ // Mkdir failed, but it might have failed with EEXIST, or some other error
20829N/A+ // due to the the directory appearing out of thin air. This can occur if
20829N/A+ // two processes are trying to create the same file system tree at the same
20829N/A+ // time. Check to see if it exists and make sure it is a directory.
20829N/A+ if (!DirectoryExists(*i))
20829N/A+ return false;
20829N/A }
20829N/A return true;
20829N/A }
20829N/A
20829N/A bool GetFileInfo(const FilePath& file_path, FileInfo* results) {
20829N/A- struct stat64 file_info;
20829N/A- if (stat64(file_path.value().c_str(), &file_info) != 0)
20829N/A+ stat_wrapper_t file_info;
20829N/A+ if (CallStat(file_path.value().c_str(), &file_info) != 0)
20829N/A return false;
20829N/A results->is_directory = S_ISDIR(file_info.st_mode);
20829N/A results->size = file_info.st_size;
20829N/A+ results->last_modified = base::Time::FromTimeT(file_info.st_mtime);
20829N/A+ return true;
20829N/A+}
20829N/A+
20829N/A+bool SetLastModifiedTime(const FilePath& file_path, base::Time last_modified) {
20829N/A+ struct timeval times[2];
20829N/A+ times[0] = last_modified.ToTimeVal();
20829N/A+ times[1] = last_modified.ToTimeVal();
20829N/A+ return (utimes(file_path.value().c_str(), times) == 0);
20829N/A+}
20829N/A+
20829N/A+bool GetInode(const FilePath& path, ino_t* inode) {
20829N/A+ struct stat buffer;
20829N/A+ int result = stat(path.value().c_str(), &buffer);
20829N/A+ if (result < 0)
20829N/A+ return false;
20829N/A+
20829N/A+ *inode = buffer.st_ino;
20829N/A return true;
20829N/A }
20829N/A
20829N/A@@ -470,9 +512,10 @@ int ReadFile(const FilePath& filename, char* data, int size) {
20829N/A if (fd < 0)
20829N/A return -1;
20829N/A
20829N/A- int ret_value = HANDLE_EINTR(read(fd, data, size));
20829N/A- HANDLE_EINTR(close(fd));
20829N/A- return ret_value;
20829N/A+ ssize_t bytes_read = HANDLE_EINTR(read(fd, data, size));
20829N/A+ if (int ret = HANDLE_EINTR(close(fd)) < 0)
20829N/A+ return ret;
20829N/A+ return bytes_read;
20829N/A }
20829N/A
20829N/A int WriteFile(const FilePath& filename, const char* data, int size) {
20829N/A@@ -480,20 +523,24 @@ int WriteFile(const FilePath& filename, const char* data, int size) {
20829N/A if (fd < 0)
20829N/A return -1;
20829N/A
20829N/A- // Allow for partial writes
20829N/A+ int bytes_written = WriteFileDescriptor(fd, data, size);
20829N/A+ if (int ret = HANDLE_EINTR(close(fd)) < 0)
20829N/A+ return ret;
20829N/A+ return bytes_written;
20829N/A+}
20829N/A+
20829N/A+int WriteFileDescriptor(const int fd, const char* data, int size) {
20829N/A+ // Allow for partial writes.
20829N/A ssize_t bytes_written_total = 0;
20829N/A- do {
20829N/A- ssize_t bytes_written_partial =
20829N/A- HANDLE_EINTR(write(fd, data + bytes_written_total,
20829N/A- size - bytes_written_total));
20829N/A- if (bytes_written_partial < 0) {
20829N/A- HANDLE_EINTR(close(fd));
20829N/A+ for (ssize_t bytes_written_partial = 0; bytes_written_total < size;
20829N/A+ bytes_written_total += bytes_written_partial) {
20829N/A+ bytes_written_partial =
20829N/A+ HANDLE_EINTR(write(fd, data + bytes_written_total,
20829N/A+ size - bytes_written_total));
20829N/A+ if (bytes_written_partial < 0)
20829N/A return -1;
20829N/A- }
20829N/A- bytes_written_total += bytes_written_partial;
20829N/A- } while (bytes_written_total < size);
20829N/A+ }
20829N/A
20829N/A- HANDLE_EINTR(close(fd));
20829N/A return bytes_written_total;
20829N/A }
20829N/A
20829N/A@@ -520,10 +567,13 @@ bool SetCurrentDirectory(const FilePath& path) {
20829N/A FileEnumerator::FileEnumerator(const FilePath& root_path,
20829N/A bool recursive,
20829N/A FileEnumerator::FILE_TYPE file_type)
20829N/A- : recursive_(recursive),
20829N/A+ : current_directory_entry_(0),
20829N/A+ root_path_(root_path),
20829N/A+ recursive_(recursive),
20829N/A file_type_(file_type),
20829N/A- is_in_find_op_(false),
20829N/A- fts_(NULL) {
20829N/A+ is_in_find_op_(false) {
20829N/A+ // INCLUDE_DOT_DOT must not be specified if recursive.
20829N/A+ DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_)));
20829N/A pending_paths_.push(root_path);
20829N/A }
20829N/A
20829N/A@@ -531,136 +581,256 @@ FileEnumerator::FileEnumerator(const FilePath& root_path,
20829N/A bool recursive,
20829N/A FileEnumerator::FILE_TYPE file_type,
20829N/A const FilePath::StringType& pattern)
20829N/A- : recursive_(recursive),
20829N/A+ : current_directory_entry_(0),
20829N/A+ root_path_(root_path),
20829N/A+ recursive_(recursive),
20829N/A file_type_(file_type),
20829N/A- pattern_(root_path.value()),
20829N/A- is_in_find_op_(false),
20829N/A- fts_(NULL) {
20829N/A- // The Windows version of this code only matches against items in the top-most
20829N/A- // directory, and we're comparing fnmatch against full paths, so this is the
20829N/A- // easiest way to get the right pattern.
20829N/A- pattern_ = pattern_.Append(pattern);
20829N/A+ pattern_(root_path.Append(pattern).value()),
20829N/A+ is_in_find_op_(false) {
20829N/A+ // INCLUDE_DOT_DOT must not be specified if recursive.
20829N/A+ DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_)));
20829N/A+ // The Windows version of this code appends the pattern to the root_path,
20829N/A+ // potentially only matching against items in the top-most directory.
20829N/A+ // Do the same here.
20829N/A+ if (pattern.size() == 0)
20829N/A+ pattern_ = FilePath::StringType();
20829N/A pending_paths_.push(root_path);
20829N/A }
20829N/A
20829N/A FileEnumerator::~FileEnumerator() {
20829N/A-#ifndef ANDROID
20829N/A- if (fts_)
20829N/A- fts_close(fts_);
20829N/A-#endif
20829N/A }
20829N/A
20829N/A void FileEnumerator::GetFindInfo(FindInfo* info) {
20829N/A DCHECK(info);
20829N/A
20829N/A- if (!is_in_find_op_)
20829N/A+ if (current_directory_entry_ >= directory_entries_.size())
20829N/A return;
20829N/A
20829N/A-#ifndef ANDROID
20829N/A- memcpy(&(info->stat), fts_ent_->fts_statp, sizeof(info->stat));
20829N/A- info->filename.assign(fts_ent_->fts_name);
20829N/A-#endif
20829N/A+ DirectoryEntryInfo* cur_entry = &directory_entries_[current_directory_entry_];
20829N/A+ memcpy(&(info->stat), &(cur_entry->stat), sizeof(info->stat));
20829N/A+ info->filename.assign(cur_entry->filename.value());
20829N/A+}
20829N/A+
20829N/A+bool FileEnumerator::IsDirectory(const FindInfo& info) {
20829N/A+ return S_ISDIR(info.stat.st_mode);
20829N/A+}
20829N/A+
20829N/A+// static
20829N/A+FilePath FileEnumerator::GetFilename(const FindInfo& find_info) {
20829N/A+ return FilePath(find_info.filename);
20829N/A }
20829N/A
20829N/A-// As it stands, this method calls itself recursively when the next item of
20829N/A-// the fts enumeration doesn't match (type, pattern, etc.). In the case of
20829N/A-// large directories with many files this can be quite deep.
20829N/A-// TODO(erikkay) - get rid of this recursive pattern
20829N/A FilePath FileEnumerator::Next() {
20829N/A-#ifdef ANDROID
20829N/A- return FilePath();
20829N/A-#else
20829N/A- if (!is_in_find_op_) {
20829N/A+ ++current_directory_entry_;
20829N/A+
20829N/A+ // While we've exhausted the entries in the current directory, do the next
20829N/A+ while (current_directory_entry_ >= directory_entries_.size()) {
20829N/A if (pending_paths_.empty())
20829N/A return FilePath();
20829N/A
20829N/A- // The last find FindFirstFile operation is done, prepare a new one.
20829N/A root_path_ = pending_paths_.top();
20829N/A root_path_ = root_path_.StripTrailingSeparators();
20829N/A pending_paths_.pop();
20829N/A
20829N/A- // Start a new find operation.
20829N/A- int ftsflags = FTS_LOGICAL;
20829N/A- char top_dir[PATH_MAX];
20829N/A- base::strlcpy(top_dir, root_path_.value().c_str(), arraysize(top_dir));
20829N/A- char* dir_list[2] = { top_dir, NULL };
20829N/A- fts_ = fts_open(dir_list, ftsflags, NULL);
20829N/A- if (!fts_)
20829N/A- return Next();
20829N/A- is_in_find_op_ = true;
20829N/A- }
20829N/A+ std::vector<DirectoryEntryInfo> entries;
20829N/A+ if (!ReadDirectory(&entries, root_path_, file_type_ & SHOW_SYM_LINKS))
20829N/A+ continue;
20829N/A
20829N/A- fts_ent_ = fts_read(fts_);
20829N/A- if (fts_ent_ == NULL) {
20829N/A- fts_close(fts_);
20829N/A- fts_ = NULL;
20829N/A- is_in_find_op_ = false;
20829N/A- return Next();
20829N/A- }
20829N/A+ directory_entries_.clear();
20829N/A+ current_directory_entry_ = 0;
20829N/A+ for (std::vector<DirectoryEntryInfo>::const_iterator
20829N/A+ i = entries.begin(); i != entries.end(); ++i) {
20829N/A+ FilePath full_path = root_path_.Append(i->filename);
20829N/A+ if (ShouldSkip(full_path))
20829N/A+ continue;
20829N/A+
20829N/A+ if (pattern_.size() &&
20829N/A+ fnmatch(pattern_.c_str(), full_path.value().c_str(), FNM_NOESCAPE))
20829N/A+ continue;
20829N/A+
20829N/A+ if (recursive_ && S_ISDIR(i->stat.st_mode))
20829N/A+ pending_paths_.push(full_path);
20829N/A
20829N/A- // Level 0 is the top, which is always skipped.
20829N/A- if (fts_ent_->fts_level == 0)
20829N/A- return Next();
20829N/A-
20829N/A- // Patterns are only matched on the items in the top-most directory.
20829N/A- // (see Windows implementation)
20829N/A- if (fts_ent_->fts_level == 1 && pattern_.value().length() > 0) {
20829N/A- if (fnmatch(pattern_.value().c_str(), fts_ent_->fts_path, 0) != 0) {
20829N/A- if (fts_ent_->fts_info == FTS_D)
20829N/A- fts_set(fts_, fts_ent_, FTS_SKIP);
20829N/A- return Next();
20829N/A+ if ((S_ISDIR(i->stat.st_mode) && (file_type_ & DIRECTORIES)) ||
20829N/A+ (!S_ISDIR(i->stat.st_mode) && (file_type_ & FILES)))
20829N/A+ directory_entries_.push_back(*i);
20829N/A }
20829N/A }
20829N/A
20829N/A- FilePath cur_file(fts_ent_->fts_path);
20829N/A- if (fts_ent_->fts_info == FTS_D) {
20829N/A- // If not recursive, then prune children.
20829N/A- if (!recursive_)
20829N/A- fts_set(fts_, fts_ent_, FTS_SKIP);
20829N/A- return (file_type_ & FileEnumerator::DIRECTORIES) ? cur_file : Next();
20829N/A- } else if (fts_ent_->fts_info == FTS_F) {
20829N/A- return (file_type_ & FileEnumerator::FILES) ? cur_file : Next();
20829N/A- }
20829N/A- // TODO(erikkay) - verify that the other fts_info types aren't interesting
20829N/A- return Next();
20829N/A+ return root_path_.Append(directory_entries_[current_directory_entry_
20829N/A+ ].filename);
20829N/A+}
20829N/A+
20829N/A+bool FileEnumerator::ReadDirectory(std::vector<DirectoryEntryInfo>* entries,
20829N/A+ const FilePath& source, bool show_links) {
20829N/A+
20829N/A+ DIR* dir = opendir(source.value().c_str());
20829N/A+ if (!dir)
20829N/A+ return false;
20829N/A+#ifdef OS_SOLARIS
20829N/A+ struct {
20829N/A+ dirent dent_buffer;
20829N/A+ char chars[MAXNAMLEN];
20829N/A+ } dent_buf;
20829N/A+#else
20829N/A+ struct dirent dent_buf;
20829N/A+#endif
20829N/A+ struct dirent* dent;
20829N/A+
20829N/A+#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) && \
20829N/A+ !defined(OS_OPENBSD) && !defined(OS_SOLARIS)
20829N/A+ #error Port warning: depending on the definition of struct dirent, \
20829N/A+ additional space for pathname may be needed
20829N/A #endif
20829N/A+
20829N/A+ while (readdir_r(dir, (dirent *)&dent_buf, &dent) == 0 && dent) {
20829N/A+ DirectoryEntryInfo info;
20829N/A+ info.filename = FilePath(dent->d_name);
20829N/A+
20829N/A+ FilePath full_name = source.Append(dent->d_name);
20829N/A+ int ret;
20829N/A+ if (show_links)
20829N/A+ ret = lstat(full_name.value().c_str(), &info.stat);
20829N/A+ else
20829N/A+ ret = stat(full_name.value().c_str(), &info.stat);
20829N/A+ if (ret < 0) {
20829N/A+ // Print the stat() error message unless it was ENOENT and we're
20829N/A+ // following symlinks.
20829N/A+ if (!(errno == ENOENT && !show_links)) {
20829N/A+ LOG(ERROR) << "Couldn't stat "
20829N/A+ << source.Append(dent->d_name).value();
20829N/A+ }
20829N/A+ memset(&info.stat, 0, sizeof(info.stat));
20829N/A+ }
20829N/A+ entries->push_back(info);
20829N/A+ }
20829N/A+
20829N/A+ closedir(dir);
20829N/A+ return true;
20829N/A }
20829N/A
20829N/A ///////////////////////////////////////////////
20829N/A // MemoryMappedFile
20829N/A
20829N/A MemoryMappedFile::MemoryMappedFile()
20829N/A- : file_(-1),
20829N/A+ : file_(base::kInvalidPlatformFileValue),
20829N/A data_(NULL),
20829N/A length_(0) {
20829N/A }
20829N/A
20829N/A-bool MemoryMappedFile::MapFileToMemory(const FilePath& file_name) {
20829N/A- file_ = open(file_name.value().c_str(), O_RDONLY);
20829N/A- if (file_ == -1)
20829N/A- return false;
20829N/A-
20829N/A+bool MemoryMappedFile::MapFileToMemoryInternal() {
20829N/A struct stat file_stat;
20829N/A- if (fstat(file_, &file_stat) == -1)
20829N/A+ if (fstat(file_, &file_stat) == base::kInvalidPlatformFileValue) {
20829N/A+ LOG(ERROR) << "Couldn't fstat " << file_ << ", errno " << errno;
20829N/A return false;
20829N/A+ }
20829N/A length_ = file_stat.st_size;
20829N/A
20829N/A data_ = static_cast<uint8*>(
20829N/A- mmap(NULL, length_, PROT_READ, MAP_SHARED, file_, 0));
20829N/A+ (void*)mmap(NULL, length_, PROT_READ, MAP_SHARED, file_, 0));
20829N/A if (data_ == MAP_FAILED)
20829N/A- data_ = NULL;
20829N/A- return data_ != NULL;
20829N/A+ LOG(ERROR) << "Couldn't mmap " << file_ << ", errno " << errno;
20829N/A+
20829N/A+ return data_ != MAP_FAILED;
20829N/A }
20829N/A
20829N/A void MemoryMappedFile::CloseHandles() {
20829N/A if (data_ != NULL)
20829N/A- munmap(data_, length_);
20829N/A- if (file_ != -1)
20829N/A+ munmap((caddr_t)data_, length_);
20829N/A+ if (file_ != base::kInvalidPlatformFileValue)
20829N/A close(file_);
20829N/A
20829N/A data_ = NULL;
20829N/A length_ = 0;
20829N/A- file_ = -1;
20829N/A+ file_ = base::kInvalidPlatformFileValue;
20829N/A+}
20829N/A+
20829N/A+bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info,
20829N/A+ const base::Time& cutoff_time) {
20829N/A+ return find_info.stat.st_mtime >= cutoff_time.ToTimeT();
20829N/A+}
20829N/A+
20829N/A+#if !defined(OS_MACOSX)
20829N/A+bool GetTempDir(FilePath* path) {
20829N/A+ const char* tmp = getenv("TMPDIR");
20829N/A+ if (tmp)
20829N/A+ *path = FilePath(tmp);
20829N/A+ else
20829N/A+ *path = FilePath("/tmp");
20829N/A+ return true;
20829N/A+}
20829N/A+
20829N/A+bool GetShmemTempDir(FilePath* path) {
20829N/A+#ifdef OS_SOLARIS
20829N/A+ *path = FilePath("/var/tmp");
20829N/A+#else
20829N/A+ *path = FilePath("/dev/shm");
20829N/A+#endif
20829N/A+ return true;
20829N/A+}
20829N/A+
20829N/A+FilePath GetHomeDir() {
20829N/A+ const char* home_dir = getenv("HOME");
20829N/A+ if (home_dir && home_dir[0])
20829N/A+ return FilePath(home_dir);
20829N/A+
20829N/A+ home_dir = g_get_home_dir();
20829N/A+ if (home_dir && home_dir[0])
20829N/A+ return FilePath(home_dir);
20829N/A+
20829N/A+ FilePath rv;
20829N/A+ if (file_util::GetTempDir(&rv))
20829N/A+ return rv;
20829N/A+
20829N/A+ // Last resort.
20829N/A+ return FilePath("/tmp");
20829N/A+}
20829N/A+
20829N/A+bool CopyFile(const FilePath& from_path, const FilePath& to_path) {
20829N/A+ int infile = open(from_path.value().c_str(), O_RDONLY);
20829N/A+ if (infile < 0)
20829N/A+ return false;
20829N/A+
20829N/A+ int outfile = creat(to_path.value().c_str(), 0666);
20829N/A+ if (outfile < 0) {
20829N/A+ close(infile);
20829N/A+ return false;
20829N/A+ }
20829N/A+
20829N/A+ const size_t kBufferSize = 32768;
20829N/A+ std::vector<char> buffer(kBufferSize);
20829N/A+ bool result = true;
20829N/A+
20829N/A+ while (result) {
20829N/A+ ssize_t bytes_read = HANDLE_EINTR(read(infile, &buffer[0], buffer.size()));
20829N/A+ if (bytes_read < 0) {
20829N/A+ result = false;
20829N/A+ break;
20829N/A+ }
20829N/A+ if (bytes_read == 0)
20829N/A+ break;
20829N/A+ // Allow for partial writes
20829N/A+ ssize_t bytes_written_per_read = 0;
20829N/A+ do {
20829N/A+ ssize_t bytes_written_partial = HANDLE_EINTR(write(
20829N/A+ outfile,
20829N/A+ &buffer[bytes_written_per_read],
20829N/A+ bytes_read - bytes_written_per_read));
20829N/A+ if (bytes_written_partial < 0) {
20829N/A+ result = false;
20829N/A+ break;
20829N/A+ }
20829N/A+ bytes_written_per_read += bytes_written_partial;
20829N/A+ } while (bytes_written_per_read < bytes_read);
20829N/A+ }
20829N/A+
20829N/A+ if (HANDLE_EINTR(close(infile)) < 0)
20829N/A+ result = false;
20829N/A+ if (HANDLE_EINTR(close(outfile)) < 0)
20829N/A+ result = false;
20829N/A+
20829N/A+ return result;
20829N/A }
20829N/A+#endif // defined(OS_MACOSX)
20829N/A
20829N/A } // namespace file_util
20829N/Adiff --git a/ipc/chromium/src/base/file_version_info.h b/ipc/chromium/src/base/file_version_info.h
20829N/Aindex f38d23f..065e9ac 100644
20829N/A--- a/ipc/chromium/src/base/file_version_info.h
20829N/A+++ b/ipc/chromium/src/base/file_version_info.h
20829N/A@@ -86,7 +86,7 @@ class FileVersionInfo {
20829N/A explicit FileVersionInfo(NSBundle *bundle);
20829N/A
20829N/A NSBundle *bundle_;
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A FileVersionInfo();
20829N/A #endif
20829N/A
20829N/Adiff --git a/ipc/chromium/src/base/float_util.h b/ipc/chromium/src/base/float_util.h
20829N/Aindex 5909995..905080b 100644
20829N/A--- a/ipc/chromium/src/base/float_util.h
20829N/A+++ b/ipc/chromium/src/base/float_util.h
20829N/A@@ -8,6 +8,9 @@
20829N/A #include "build/build_config.h"
20829N/A
20829N/A #include <float.h>
20829N/A+#ifdef OS_SOLARIS
20829N/A+#include <ieeefp.h>
20829N/A+#endif
20829N/A #include <math.h>
20829N/A
20829N/A namespace base {
20829N/Adiff --git a/ipc/chromium/src/base/gfx/native_widget_types.h b/ipc/chromium/src/base/gfx/native_widget_types.h
20829N/Aindex d43db5c..2f4ab87 100644
20829N/A--- a/ipc/chromium/src/base/gfx/native_widget_types.h
20829N/A+++ b/ipc/chromium/src/base/gfx/native_widget_types.h
20829N/A@@ -46,7 +46,7 @@ class NSView;
20829N/A class NSWindow;
20829N/A class NSTextField;
20829N/A #endif // __OBJC__
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef struct _GtkWidget GtkWidget;
20829N/A typedef struct _GtkWindow GtkWindow;
20829N/A typedef struct _cairo_surface cairo_surface_t;
20829N/A@@ -64,7 +64,7 @@ typedef NSView* NativeView;
20829N/A typedef NSWindow* NativeWindow;
20829N/A typedef NSTextField* NativeEditView;
20829N/A typedef CGContext* NativeDrawingContext;
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef GtkWidget* NativeView;
20829N/A typedef GtkWindow* NativeWindow;
20829N/A typedef GtkWidget* NativeEditView;
20829N/A@@ -86,7 +86,7 @@ typedef intptr_t NativeViewId;
20829N/A static inline NativeView NativeViewFromId(NativeViewId id) {
20829N/A return reinterpret_cast<NativeView>(id);
20829N/A }
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // A NativeView on Linux is a GtkWidget*. However, we can't go directly from an
20829N/A // X window ID to a GtkWidget. Thus, functions which handle NativeViewIds from
20829N/A // the renderer have to use Xlib. This is fine since these functions are
20829N/A@@ -94,7 +94,7 @@ static inline NativeView NativeViewFromId(NativeViewId id) {
20829N/A
20829N/A #define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILIBLE_ON_LINUX
20829N/A
20829N/A-#endif // defined(OS_LINUX)
20829N/A+#endif // defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A
20829N/A // Convert a NativeView to a NativeViewId. See the comments above
20829N/A // NativeViewFromId.
20829N/A@@ -102,10 +102,10 @@ static inline NativeView NativeViewFromId(NativeViewId id) {
20829N/A static inline NativeViewId IdFromNativeView(NativeView view) {
20829N/A return reinterpret_cast<NativeViewId>(view);
20829N/A }
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // Not inlined because it involves pulling too many headers.
20829N/A NativeViewId IdFromNativeView(NativeView view);
20829N/A-#endif // defined(OS_LINUX)
20829N/A+#endif // defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A
20829N/A } // namespace gfx
20829N/A
20829N/Adiff --git a/ipc/chromium/src/base/gfx/rect.cc b/ipc/chromium/src/base/gfx/rect.cc
20829N/Aindex e0226f3..3c89c2c 100755
20829N/A--- a/ipc/chromium/src/base/gfx/rect.cc
20829N/A+++ b/ipc/chromium/src/base/gfx/rect.cc
20829N/A@@ -8,7 +8,7 @@
20829N/A #include <windows.h>
20829N/A #elif defined(OS_MACOSX)
20829N/A #include <CoreGraphics/CGGeometry.h>
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #include <gdk/gdk.h>
20829N/A #endif
20829N/A
20829N/A@@ -74,7 +74,7 @@ Rect& Rect::operator=(const CGRect& r) {
20829N/A set_height(r.size.height);
20829N/A return *this;
20829N/A }
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A Rect::Rect(const GdkRectangle& r)
20829N/A : origin_(r.x, r.y) {
20829N/A set_width(r.width);
20829N/A@@ -126,7 +126,7 @@ RECT Rect::ToRECT() const {
20829N/A r.bottom = bottom();
20829N/A return r;
20829N/A }
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A GdkRectangle Rect::ToGdkRectangle() const {
20829N/A GdkRectangle r = {x(), y(), width(), height()};
20829N/A return r;
20829N/Adiff --git a/ipc/chromium/src/base/gfx/rect.h b/ipc/chromium/src/base/gfx/rect.h
20829N/Aindex 6da1b55..e866398 100644
20829N/A--- a/ipc/chromium/src/base/gfx/rect.h
20829N/A+++ b/ipc/chromium/src/base/gfx/rect.h
20829N/A@@ -19,7 +19,7 @@
20829N/A
20829N/A #if defined(OS_WIN)
20829N/A typedef struct tagRECT RECT;
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef struct _GdkRectangle GdkRectangle;
20829N/A #endif
20829N/A
20829N/A@@ -34,7 +34,7 @@ class Rect {
20829N/A explicit Rect(const RECT& r);
20829N/A #elif defined(OS_MACOSX)
20829N/A explicit Rect(const CGRect& r);
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOALRIS)
20829N/A explicit Rect(const GdkRectangle& r);
20829N/A #endif
20829N/A Rect(const gfx::Point& origin, const gfx::Size& size);
20829N/A@@ -45,7 +45,7 @@ class Rect {
20829N/A Rect& operator=(const RECT& r);
20829N/A #elif defined(OS_MACOSX)
20829N/A Rect& operator=(const CGRect& r);
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A Rect& operator=(const GdkRectangle& r);
20829N/A #endif
20829N/A
20829N/A@@ -97,7 +97,7 @@ class Rect {
20829N/A #if defined(OS_WIN)
20829N/A // Construct an equivalent Win32 RECT object.
20829N/A RECT ToRECT() const;
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A GdkRectangle ToGdkRectangle() const;
20829N/A #elif defined(OS_MACOSX)
20829N/A // Construct an equivalent CoreGraphics object.
20829N/Adiff --git a/ipc/chromium/src/base/hash_tables.h b/ipc/chromium/src/base/hash_tables.h
20829N/Aindex c2dcde5..1edd667 100644
20829N/A--- a/ipc/chromium/src/base/hash_tables.h
20829N/A+++ b/ipc/chromium/src/base/hash_tables.h
20829N/A@@ -26,6 +26,15 @@ namespace base {
20829N/A using stdext::hash_map;
20829N/A using stdext::hash_set;
20829N/A }
20829N/A+#elif defined(COMPILER_SUNPRO)
20829N/A+#include <map>
20829N/A+#include <set>
20829N/A+namespace base {
20829N/A+using std::map;
20829N/A+using std::set;
20829N/A+}
20829N/A+#define hash_map map
20829N/A+#define hash_set set
20829N/A #elif defined(COMPILER_GCC)
20829N/A // This is a hack to disable the gcc 4.4 warning about hash_map and hash_set
20829N/A // being deprecated. We can get rid of this when we upgrade to VS2008 and we
20829N/Adiff --git a/ipc/chromium/src/base/icu_util.cc b/ipc/chromium/src/base/icu_util.cc
20829N/Aindex 701dc73..1732c74 100644
20829N/A--- a/ipc/chromium/src/base/icu_util.cc
20829N/A+++ b/ipc/chromium/src/base/icu_util.cc
20829N/A@@ -30,7 +30,7 @@
20829N/A #define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_SHARED
20829N/A #elif defined(OS_MACOSX)
20829N/A #define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_STATIC
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_FILE
20829N/A #endif
20829N/A
20829N/Adiff --git a/ipc/chromium/src/base/idle_timer.cc b/ipc/chromium/src/base/idle_timer.cc
20829N/Aindex de980f1..34ee461 100644
20829N/A--- a/ipc/chromium/src/base/idle_timer.cc
20829N/A+++ b/ipc/chromium/src/base/idle_timer.cc
20829N/A@@ -7,13 +7,13 @@
20829N/A // We may not want to port idle_timer to Linux, but we have implemented it
20829N/A // anyway. Define this to 1 to enable the Linux idle timer and then add the
20829N/A // libs that need to be linked (Xss).
20829N/A-#define ENABLE_XSS_SUPPORT 0
20829N/A+#define ENABLE_XSS_SUPPORT 1
20829N/A
20829N/A #if defined(OS_MACOSX)
20829N/A #include <ApplicationServices/ApplicationServices.h>
20829N/A #endif
20829N/A
20829N/A-#if defined(OS_LINUX) && ENABLE_XSS_SUPPORT
20829N/A+#if (defined(OS_LINUX) || defined(OS_SOLARIS)) && ENABLE_XSS_SUPPORT
20829N/A // We may not want to port idle_timer to Linux, but we have implemented it
20829N/A // anyway. Remove the 0 above if we want it.
20829N/A #include <gdk/gdkx.h>
20829N/A@@ -54,7 +54,7 @@ bool OSIdleTimeSource(int32 *milliseconds_interval_since_last_event) {
20829N/A kCGAnyInputEventType) * 1000.0;
20829N/A return true;
20829N/A }
20829N/A-#elif defined(OS_LINUX) && ENABLE_XSS_SUPPORT
20829N/A+#elif (defined(OS_LINUX) || defined(OS_SOLARIS)) && ENABLE_XSS_SUPPORT
20829N/A class IdleState {
20829N/A public:
20829N/A IdleState() {
20829N/Adiff --git a/ipc/chromium/src/base/logging.cc b/ipc/chromium/src/base/logging.cc
20829N/Aindex 33d4ca4..6fbb1e0 100644
20829N/A--- a/ipc/chromium/src/base/logging.cc
20829N/A+++ b/ipc/chromium/src/base/logging.cc
20829N/A@@ -118,7 +118,7 @@ typedef HANDLE MutexHandle;
20829N/A #include <mach/mach.h>
20829N/A #include <mach/mach_time.h>
20829N/A #include <mach-o/dyld.h>
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #include <sys/syscall.h>
20829N/A #include <time.h>
20829N/A #endif
20829N/A@@ -230,6 +230,8 @@ int32 CurrentThreadId() {
20829N/A return mach_thread_self();
20829N/A #elif defined(OS_LINUX)
20829N/A return syscall(__NR_gettid);
20829N/A+#elif defined(OS_SOLARIS)
20829N/A+ return thr_self();
20829N/A #endif
20829N/A }
20829N/A
20829N/A@@ -238,7 +240,7 @@ uint64 TickCount() {
20829N/A return GetTickCount();
20829N/A #elif defined(OS_MACOSX)
20829N/A return mach_absolute_time();
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A struct timespec ts;
20829N/A clock_gettime(CLOCK_MONOTONIC, &ts);
20829N/A
20829N/Adiff --git a/ipc/chromium/src/base/message_loop.cc b/ipc/chromium/src/base/message_loop.cc
20829N/Aindex 6e62692..66b96ae 100644
20829N/A--- a/ipc/chromium/src/base/message_loop.cc
20829N/A+++ b/ipc/chromium/src/base/message_loop.cc
20829N/A@@ -19,7 +19,7 @@
20829N/A #if defined(OS_POSIX)
20829N/A #include "base/message_pump_libevent.h"
20829N/A #endif
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #ifdef MOZ_WIDGET_GTK2
20829N/A #include "base/message_pump_glib.h"
20829N/A #endif
20829N/A@@ -120,9 +120,9 @@ MessageLoop::MessageLoop(Type type)
20829N/A if (type_ == TYPE_UI) {
20829N/A #if defined(OS_MACOSX)
20829N/A pump_ = base::MessagePumpMac::Create();
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A pump_ = new base::MessagePumpForUI();
20829N/A-#endif // OS_LINUX
20829N/A+#endif // OS_LINUX || OS_SOLARIS
20829N/A } else if (type_ == TYPE_IO) {
20829N/A pump_ = new base::MessagePumpLibevent();
20829N/A } else {
20829N/Adiff --git a/ipc/chromium/src/base/message_pump_glib.cc b/ipc/chromium/src/base/message_pump_glib.cc
20829N/Aindex 630c2f9..980bccd 100644
20829N/A--- a/ipc/chromium/src/base/message_pump_glib.cc
20829N/A+++ b/ipc/chromium/src/base/message_pump_glib.cc
20829N/A@@ -126,16 +126,22 @@ namespace base {
20829N/A
20829N/A MessagePumpForUI::MessagePumpForUI()
20829N/A : state_(NULL),
20829N/A context_(g_main_context_default()),
20829N/A wakeup_gpollfd_(new GPollFD) {
20829N/A // Create our wakeup pipe, which is used to flag when work was scheduled.
20829N/A int fds[2];
20829N/A CHECK(pipe(fds) == 0);
20829N/A+
20829N/A+ int flags = fcntl(fds[0], F_GETFL, 0);
20829N/A+ if (flags == -1)
20829N/A+ flags = 0;
20829N/A+ fcntl(fds[0], F_SETFL, flags | O_NDELAY);
20829N/A+
20829N/A wakeup_pipe_read_ = fds[0];
20829N/A wakeup_pipe_write_ = fds[1];
20829N/A wakeup_gpollfd_->fd = wakeup_pipe_read_;
20829N/A wakeup_gpollfd_->events = G_IO_IN;
20829N/A
20829N/A work_source_ = g_source_new(&WorkSourceFuncs, sizeof(WorkSource));
20829N/A static_cast<WorkSource*>(work_source_)->pump = this;
20829N/A g_source_add_poll(work_source_, wakeup_gpollfd_.get());
20829N/A@@ -232,20 +238,19 @@ int MessagePumpForUI::HandlePrepare() {
20829N/A bool MessagePumpForUI::HandleCheck() {
20829N/A if (!state_) // state_ may be null during tests.
20829N/A return false;
20829N/A
20829N/A // We should only ever have a single message on the wakeup pipe, since we
20829N/A // are only signaled when the queue went from empty to non-empty. The glib
20829N/A // poll will tell us whether there was data, so this read shouldn't block.
20829N/A if (wakeup_gpollfd_->revents & G_IO_IN) {
20829N/A- char msg;
20829N/A- if (HANDLE_EINTR(read(wakeup_pipe_read_, &msg, 1)) != 1 || msg != '!') {
20829N/A- NOTREACHED() << "Error reading from the wakeup pipe.";
20829N/A- }
20829N/A+ char buf[32];
20829N/A+ while (HANDLE_EINTR(read(wakeup_pipe_read_, &buf, 32)));
20829N/A+
20829N/A // Since we ate the message, we need to record that we have more work,
20829N/A // because HandleCheck() may be called without HandleDispatch being called
20829N/A // afterwards.
20829N/A state_->has_work = true;
20829N/A }
20829N/A
20829N/A if (state_->has_work)
20829N/A return true;
20829N/A@@ -299,16 +304,20 @@ void MessagePumpForUI::Quit() {
20829N/A }
20829N/A }
20829N/A
20829N/A void MessagePumpForUI::ScheduleWork() {
20829N/A // This can be called on any thread, so we don't want to touch any state
20829N/A // variables as we would then need locks all over. This ensures that if
20829N/A // we are sleeping in a poll that we will wake up.
20829N/A char msg = '!';
20829N/A+
20829N/A+ char buf[32];
20829N/A+ while (HANDLE_EINTR(read(wakeup_pipe_read_, &buf, 32)));
20829N/A+
20829N/A if (HANDLE_EINTR(write(wakeup_pipe_write_, &msg, 1)) != 1) {
20829N/A NOTREACHED() << "Could not write to the UI message loop wakeup pipe!";
20829N/A }
20829N/A }
20829N/A
20829N/A void MessagePumpForUI::ScheduleDelayedWork(const Time& delayed_work_time) {
20829N/A // We need to wake up the loop in case the poll timeout needs to be
20829N/A // adjusted. This will cause us to try to do work, but that's ok.
20829N/Adiff --git a/ipc/chromium/src/base/message_pump_libevent.cc b/ipc/chromium/src/base/message_pump_libevent.cc
20829N/Aindex b537988..16ec112 100644
20829N/A--- a/ipc/chromium/src/base/message_pump_libevent.cc
20829N/A+++ b/ipc/chromium/src/base/message_pump_libevent.cc
20829N/A@@ -6,6 +6,10 @@
20829N/A
20829N/A #include <errno.h>
20829N/A #include <fcntl.h>
20829N/A+#if defined(OS_SOLARIS)
20829N/A+#include <unistd.h>
20829N/A+#include <sys/stat.h>
20829N/A+#endif
20829N/A
20829N/A #include "eintr_wrapper.h"
20829N/A #include "base/logging.h"
20829N/Adiff --git a/ipc/chromium/src/base/native_library.h b/ipc/chromium/src/base/native_library.h
20829N/Aindex ce85c23..81d54a1 100644
20829N/A--- a/ipc/chromium/src/base/native_library.h
20829N/A+++ b/ipc/chromium/src/base/native_library.h
20829N/A@@ -26,7 +26,7 @@ typedef char* NativeLibraryFunctionNameType;
20829N/A #elif defined(OS_MACOSX)
20829N/A typedef CFBundleRef NativeLibrary;
20829N/A typedef CFStringRef NativeLibraryFunctionNameType;
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef void* NativeLibrary;
20829N/A typedef const char* NativeLibraryFunctionNameType;
20829N/A #endif // OS_*
20829N/Adiff --git a/ipc/chromium/src/base/observer_list.h b/ipc/chromium/src/base/observer_list.h
20829N/Aindex f67df14..3f26f93 100644
20829N/A--- a/ipc/chromium/src/base/observer_list.h
20829N/A+++ b/ipc/chromium/src/base/observer_list.h
20829N/A@@ -82,7 +82,7 @@ class ObserverList {
20829N/A
20829N/A // Add an observer to the list.
20829N/A void AddObserver(ObserverType* obs) {
20829N/A- DCHECK(find(observers_.begin(), observers_.end(), obs) == observers_.end())
20829N/A+ DCHECK(std::find(observers_.begin(), observers_.end(), obs) == observers_.end())
20829N/A << "Observers can only be added once!";
20829N/A observers_.push_back(obs);
20829N/A }
20829N/Adiff --git a/ipc/chromium/src/base/path_service.cc b/ipc/chromium/src/base/path_service.cc
20829N/Aindex f625c98..3228de7 100644
20829N/A--- a/ipc/chromium/src/base/path_service.cc
20829N/A+++ b/ipc/chromium/src/base/path_service.cc
20829N/A@@ -24,7 +24,7 @@ namespace base {
20829N/A bool PathProviderWin(int key, FilePath* result);
20829N/A #elif defined(OS_MACOSX)
20829N/A bool PathProviderMac(int key, FilePath* result);
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A bool PathProviderLinux(int key, FilePath* result);
20829N/A #endif
20829N/A }
20829N/A@@ -80,7 +80,7 @@ static Provider base_provider_mac = {
20829N/A };
20829N/A #endif
20829N/A
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A static Provider base_provider_linux = {
20829N/A base::PathProviderLinux,
20829N/A &base_provider,
20829N/A@@ -92,6 +92,17 @@ static Provider base_provider_linux = {
20829N/A };
20829N/A #endif
20829N/A
20829N/A+#if 0//defined(OS_SOLARIS)
20829N/A+static Provider base_provider_posix = {
20829N/A+ base::PathProviderPosix,
20829N/A+ &base_provider,
20829N/A+#ifndef NDEBUG
20829N/A+ 0,
20829N/A+ 0,
20829N/A+#endif
20829N/A+ true
20829N/A+};
20829N/A+#endif
20829N/A
20829N/A struct PathData {
20829N/A Lock lock;
20829N/A@@ -104,7 +115,7 @@ struct PathData {
20829N/A providers = &base_provider_win;
20829N/A #elif defined(OS_MACOSX)
20829N/A providers = &base_provider_mac;
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A providers = &base_provider_linux;
20829N/A #endif
20829N/A }
20829N/A@@ -206,6 +217,24 @@ bool PathService::IsOverridden(int key) {
20829N/A return path_data->overrides.find(key) != path_data->overrides.end();
20829N/A }
20829N/A
20829N/A+#ifdef OS_SOLARIS
20829N/A+bool PathService::Override(int key, const FilePath& path) {
20829N/A+ PathData* path_data = GetPathData();
20829N/A+ DCHECK(path_data);
20829N/A+ DCHECK(key > base::DIR_CURRENT) << "invalid path key";
20829N/A+
20829N/A+ FilePath file_path = path;
20829N/A+
20829N/A+ // make sure the directory exists:
20829N/A+ if (!file_util::CreateDirectory(file_path))
20829N/A+ return false;
20829N/A+
20829N/A+ AutoLock scoped_lock(path_data->lock);
20829N/A+ path_data->cache[key] = file_path;
20829N/A+ path_data->overrides.insert(key);
20829N/A+ return true;
20829N/A+}
20829N/A+#else
20829N/A bool PathService::Override(int key, const std::wstring& path) {
20829N/A PathData* path_data = GetPathData();
20829N/A DCHECK(path_data);
20829N/A@@ -231,8 +260,13 @@ bool PathService::Override(int key, const std::wstring& path) {
20829N/A path_data->overrides.insert(key);
20829N/A return true;
20829N/A }
20829N/A+#endif
20829N/A
20829N/A+#ifdef OS_SOLARIS
20829N/A+bool PathService::SetCurrentDirectory(const FilePath& current_directory) {
20829N/A+#else
20829N/A bool PathService::SetCurrentDirectory(const std::wstring& current_directory) {
20829N/A+#endif
20829N/A return file_util::SetCurrentDirectory(current_directory);
20829N/A }
20829N/A
20829N/Adiff --git a/ipc/chromium/src/base/path_service.h b/ipc/chromium/src/base/path_service.h
20829N/Aindex 86d6a4a..41a7d56 100644
20829N/A--- a/ipc/chromium/src/base/path_service.h
20829N/A+++ b/ipc/chromium/src/base/path_service.h
20829N/A@@ -48,13 +48,21 @@ class PathService {
20829N/A //
20829N/A // WARNING: Consumers of PathService::Get may expect paths to be constant
20829N/A // over the lifetime of the app, so this method should be used with caution.
20829N/A+#ifdef OS_SOLARIS
20829N/A+ static bool Override(int key, const FilePath& path);
20829N/A+#else
20829N/A static bool Override(int key, const std::wstring& path);
20829N/A+#endif
20829N/A
20829N/A // Return whether a path was overridden.
20829N/A static bool IsOverridden(int key);
20829N/A
20829N/A // Sets the current directory.
20829N/A+#ifdef OS_SOLARIS
20829N/A+ static bool SetCurrentDirectory(const FilePath& current_directory);
20829N/A+#else
20829N/A static bool SetCurrentDirectory(const std::wstring& current_directory);
20829N/A+#endif
20829N/A
20829N/A // To extend the set of supported keys, you can register a path provider,
20829N/A // which is just a function mirroring PathService::Get. The ProviderFunc
20829N/Adiff --git a/ipc/chromium/src/base/pickle.cc b/ipc/chromium/src/base/pickle.cc
20829N/Aindex da42457..214caee 100644
20829N/A--- a/ipc/chromium/src/base/pickle.cc
20829N/A+++ b/ipc/chromium/src/base/pickle.cc
20829N/A@@ -8,6 +8,7 @@
20829N/A
20829N/A #include <limits>
20829N/A #include <string>
20829N/A+#include <algorithm>
20829N/A
20829N/A //------------------------------------------------------------------------------
20829N/A
20829N/A@@ -102,29 +103,23 @@ bool Pickle::ReadBool(void** iter, bool* result) const {
20829N/A
20829N/A bool Pickle::ReadInt16(void** iter, int16* result) const {
20829N/A DCHECK(iter);
20829N/A- if (!*iter)
20829N/A- *iter = const_cast<char*>(payload());
20829N/A
20829N/A- if (!IteratorHasRoomFor(*iter, sizeof(*result)))
20829N/A+ int tmp;
20829N/A+ if (!ReadInt(iter, &tmp))
20829N/A return false;
20829N/A
20829N/A- memcpy(result, *iter, sizeof(*result));
20829N/A-
20829N/A- UpdateIter(iter, sizeof(*result));
20829N/A+ *result = tmp;
20829N/A return true;
20829N/A }
20829N/A
20829N/A bool Pickle::ReadUInt16(void** iter, uint16* result) const {
20829N/A DCHECK(iter);
20829N/A- if (!*iter)
20829N/A- *iter = const_cast<char*>(payload());
20829N/A
20829N/A- if (!IteratorHasRoomFor(*iter, sizeof(*result)))
20829N/A+ int tmp;
20829N/A+ if (!ReadInt(iter, &tmp))
20829N/A return false;
20829N/A
20829N/A- memcpy(result, *iter, sizeof(*result));
20829N/A-
20829N/A- UpdateIter(iter, sizeof(*result));
20829N/A+ *result = tmp;
20829N/A return true;
20829N/A }
20829N/A
20829N/Adiff --git a/ipc/chromium/src/base/platform_file_posix.cc b/ipc/chromium/src/base/platform_file_posix.cc
20829N/Aindex 57cb6e3..5dad416 100644
20829N/A--- a/ipc/chromium/src/base/platform_file_posix.cc
20829N/A+++ b/ipc/chromium/src/base/platform_file_posix.cc
20829N/A@@ -8,6 +8,8 @@
20829N/A #include <errno.h>
20829N/A #ifdef ANDROID
20829N/A #include <linux/stat.h>
20829N/A+#elif defined(OS_SOLARIS)
20829N/A+#include <sys/stat.h>
20829N/A #endif
20829N/A
20829N/A #include "base/logging.h"
20829N/Adiff --git a/ipc/chromium/src/base/platform_thread.h b/ipc/chromium/src/base/platform_thread.h
20829N/Aindex 4a2d507..8a124f6 100644
20829N/A--- a/ipc/chromium/src/base/platform_thread.h
20829N/A+++ b/ipc/chromium/src/base/platform_thread.h
20829N/A@@ -22,7 +22,7 @@ typedef void* PlatformThreadHandle; // HANDLE
20829N/A #elif defined(OS_POSIX)
20829N/A #include <pthread.h>
20829N/A typedef pthread_t PlatformThreadHandle;
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #include <unistd.h>
20829N/A typedef pid_t PlatformThreadId;
20829N/A #elif defined(OS_MACOSX)
20829N/Adiff --git a/ipc/chromium/src/base/platform_thread_posix.cc b/ipc/chromium/src/base/platform_thread_posix.cc
20829N/Aindex 3789715..965055e 100644
20829N/A--- a/ipc/chromium/src/base/platform_thread_posix.cc
20829N/A+++ b/ipc/chromium/src/base/platform_thread_posix.cc
20829N/A@@ -9,10 +9,13 @@
20829N/A
20829N/A #if defined(OS_MACOSX)
20829N/A #include <mach/mach.h>
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #include <sys/syscall.h>
20829N/A #include <unistd.h>
20829N/A #endif
20829N/A+#if defined(OS_SOLARIS)
20829N/A+#include <thread.h>
20829N/A+#endif
20829N/A
20829N/A #if defined(OS_MACOSX)
20829N/A namespace base {
20829N/A@@ -35,6 +38,8 @@ PlatformThreadId PlatformThread::CurrentId() {
20829N/A return mach_thread_self();
20829N/A #elif defined(OS_LINUX)
20829N/A return syscall(__NR_gettid);
20829N/A+#elif defined(OS_SOLARIS)
20829N/A+ return thr_self();
20829N/A #endif
20829N/A }
20829N/A
20829N/Adiff --git a/ipc/chromium/src/base/port.h b/ipc/chromium/src/base/port.h
20829N/Aindex 0fc530d..2609c3e 100644
20829N/A--- a/ipc/chromium/src/base/port.h
20829N/A+++ b/ipc/chromium/src/base/port.h
20829N/A@@ -44,7 +44,7 @@ namespace base {
20829N/A inline void va_copy(va_list& a, va_list& b) {
20829N/A #if defined(COMPILER_GCC)
20829N/A ::va_copy(a, b);
20829N/A-#elif defined(COMPILER_MSVC)
20829N/A+#elif defined(COMPILER_MSVC) || defined(COMPILER_SUNPRO)
20829N/A a = b;
20829N/A #endif
20829N/A }
20829N/A@@ -54,7 +54,7 @@ inline void va_copy(va_list& a, va_list& b) {
20829N/A // use va_list as ref args to a function, as above, breaks some machines.
20829N/A # if defined(COMPILER_GCC)
20829N/A # define base_va_copy(_a, _b) ::va_copy(_a, _b)
20829N/A-# elif defined(COMPILER_MSVC)
20829N/A+# elif defined(COMPILER_MSVC) || defined(COMPILER_SUNPRO)
20829N/A # define base_va_copy(_a, _b) (_a = _b)
20829N/A # else
20829N/A # error No va_copy for your compiler
20829N/A@@ -67,7 +67,7 @@ inline void va_copy(va_list& a, va_list& b) {
20829N/A // Define an OS-neutral wrapper for shared library entry points
20829N/A #if defined(OS_WIN)
20829N/A #define API_CALL __stdcall
20829N/A-#elif defined(OS_LINUX) || defined(OS_MACOSX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_MACOSX)
20829N/A #define API_CALL
20829N/A #endif
20829N/A
20829N/Adiff --git a/ipc/chromium/src/base/process_util.h b/ipc/chromium/src/base/process_util.h
20829N/Aindex 914a34b..e3527d3 100644
20829N/A--- a/ipc/chromium/src/base/process_util.h
20829N/A+++ b/ipc/chromium/src/base/process_util.h
20829N/A@@ -13,7 +13,7 @@
20829N/A #if defined(OS_WIN)
20829N/A #include <windows.h>
20829N/A #include <tlhelp32.h>
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #include <dirent.h>
20829N/A #include <limits.h>
20829N/A #include <sys/types.h>
20829N/A@@ -21,6 +21,10 @@
20829N/A #include <mach/mach.h>
20829N/A #endif
20829N/A
20829N/A+#if defined(OS_SOLARIS)
20829N/A+#define NAME_MAX 14
20829N/A+#endif
20829N/A+
20829N/A #include <map>
20829N/A #include <string>
20829N/A #include <vector>
20829N/A@@ -62,7 +66,8 @@ enum ProcessArchitecture {
20829N/A PROCESS_ARCH_I386 = 0x1,
20829N/A PROCESS_ARCH_X86_64 = 0x2,
20829N/A PROCESS_ARCH_PPC = 0x4,
20829N/A- PROCESS_ARCH_ARM = 0x8
20829N/A+ PROCESS_ARCH_ARM = 0x8,
20829N/A+ PROCESS_ARCH_SPARC = 0x10
20829N/A };
20829N/A
20829N/A static ProcessArchitecture GetCurrentProcessArchitecture()
20829N/A@@ -76,6 +81,8 @@ static ProcessArchitecture GetCurrentProcessArchitecture()
20829N/A currentArchitecture = base::PROCESS_ARCH_PPC;
20829N/A #elif defined(ARCH_CPU_ARMEL)
20829N/A currentArchitecture = base::PROCESS_ARCH_ARM;
20829N/A+#elif defined(ARCH_CPU_SPARC)
20829N/A+ currentArchitecture = base::PROCESS_ARCH_SPARC;
20829N/A #endif
20829N/A return currentArchitecture;
20829N/A }
20829N/A@@ -296,7 +303,7 @@ class NamedProcessIterator {
20829N/A #if defined(OS_WIN)
20829N/A HANDLE snapshot_;
20829N/A bool started_iteration_;
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A DIR *procfs_dir_;
20829N/A #elif defined(OS_MACOSX)
20829N/A std::vector<kinfo_proc> kinfo_procs_;
20829N/Adiff --git a/ipc/chromium/src/base/process_util_posix.cc b/ipc/chromium/src/base/process_util_posix.cc
20829N/Aindex 7d83431..1686121 100644
20829N/A--- a/ipc/chromium/src/base/process_util_posix.cc
20829N/A+++ b/ipc/chromium/src/base/process_util_posix.cc
20829N/A@@ -102,7 +102,7 @@ typedef unsigned long int rlim_t;
20829N/A #endif
20829N/A
20829N/A void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) {
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A static const rlim_t kSystemDefaultMaxFds = 8192;
20829N/A static const char fd_dir[] = "/proc/self/fd";
20829N/A #elif defined(OS_MACOSX)
20829N/A@@ -179,7 +179,7 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) {
20829N/A // TODO(agl): Remove this function. It's fundamentally broken for multithreaded
20829N/A // apps.
20829N/A void SetAllFDsToCloseOnExec() {
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A const char fd_dir[] = "/proc/self/fd";
20829N/A #elif defined(OS_MACOSX)
20829N/A const char fd_dir[] = "/dev/fd";
20829N/Adiff --git a/ipc/chromium/src/base/shared_memory_posix.cc b/ipc/chromium/src/base/shared_memory_posix.cc
20829N/Aindex 3a26550..006672e 100644
20829N/A--- a/ipc/chromium/src/base/shared_memory_posix.cc
20829N/A+++ b/ipc/chromium/src/base/shared_memory_posix.cc
20829N/A@@ -136,9 +136,15 @@ bool SharedMemory::FilenameForMemoryName(const std::wstring &memname,
20829N/A if (file_util::GetShmemTempDir(&temp_dir) == false)
20829N/A return false;
20829N/A
20829N/A+#ifndef OS_SOLARIS
20829N/A mem_filename = UTF8ToWide(temp_dir.value());
20829N/A file_util::AppendToPath(&mem_filename, L"com.google.chrome.shmem." + memname);
20829N/A *filename = mem_filename;
20829N/A+#else
20829N/A+ *filename = (temp_dir.Append("com.google.chrome.shmem." +
20829N/A+ WideToUTF8(memname))).ToWStringHack();
20829N/A+#endif
20829N/A+
20829N/A return true;
20829N/A }
20829N/A
20829N/A@@ -256,7 +262,7 @@ bool SharedMemory::Unmap() {
20829N/A if (memory_ == NULL)
20829N/A return false;
20829N/A
20829N/A- munmap(memory_, max_size_);
20829N/A+ munmap((caddr_t)memory_, max_size_);
20829N/A memory_ = NULL;
20829N/A max_size_ = 0;
20829N/A return true;
20829N/Adiff --git a/ipc/chromium/src/base/stack_container.h b/ipc/chromium/src/base/stack_container.h
20829N/Aindex 1b325b1..379a614 100644
20829N/A--- a/ipc/chromium/src/base/stack_container.h
20829N/A+++ b/ipc/chromium/src/base/stack_container.h
20829N/A@@ -96,12 +96,17 @@ class StackAllocator : public std::allocator<T> {
20829N/A // and the size requested fits. Otherwise, fall through to the standard
20829N/A // allocator.
20829N/A pointer allocate(size_type n, void* hint = 0) {
20829N/A+#ifdef COMPILER_SUNPRO
20829N/A+ if (source_ != NULL && !source_->used_stack_buffer_
20829N/A+ && (n/sizeof(T)) <= stack_capacity) {
20829N/A+#else
20829N/A if (source_ != NULL && !source_->used_stack_buffer_
20829N/A && n <= stack_capacity) {
20829N/A+#endif
20829N/A source_->used_stack_buffer_ = true;
20829N/A return source_->stack_buffer();
20829N/A } else {
20829N/A- return std::allocator<T>::allocate(n, hint);
20829N/A+ return (pointer)std::allocator<T>::allocate(n, hint);
20829N/A }
20829N/A }
20829N/A
20829N/Adiff --git a/ipc/chromium/src/base/string16.h b/ipc/chromium/src/base/string16.h
20829N/Aindex 28cf3d8..80d5e68 100644
20829N/A--- a/ipc/chromium/src/base/string16.h
20829N/A+++ b/ipc/chromium/src/base/string16.h
20829N/A@@ -162,7 +162,9 @@ struct string16_char_traits {
20829N/A //
20829N/A // TODO(mark): File this bug with Apple and update this note with a bug number.
20829N/A
20829N/A+#ifndef COMPILER_SUNPRO
20829N/A extern template class std::basic_string<char16, base::string16_char_traits>;
20829N/A+#endif
20829N/A
20829N/A typedef std::basic_string<char16, base::string16_char_traits> string16;
20829N/A
20829N/Adiff --git a/ipc/chromium/src/base/string_piece.h b/ipc/chromium/src/base/string_piece.h
20829N/Aindex fe10806..ae3106d 100644
20829N/A--- a/ipc/chromium/src/base/string_piece.h
20829N/A+++ b/ipc/chromium/src/base/string_piece.h
20829N/A@@ -113,8 +113,13 @@ class StringPiece {
20829N/A static const size_type npos;
20829N/A typedef const char* const_iterator;
20829N/A typedef const char* iterator;
20829N/A+#ifdef COMPILER_SUNPRO
20829N/A+ typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag, const value_type> const_reverse_iterator;
20829N/A+ typedef std::reverse_iterator<iterator, std::random_access_iterator_tag, value_type> reverse_iterator;
20829N/A+#else
20829N/A typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
20829N/A typedef std::reverse_iterator<iterator> reverse_iterator;
20829N/A+#endif
20829N/A iterator begin() const { return ptr_; }
20829N/A iterator end() const { return ptr_ + length_; }
20829N/A const_reverse_iterator rbegin() const {
20829N/Adiff --git a/ipc/chromium/src/base/string_util.cc b/ipc/chromium/src/base/string_util.cc
20829N/Aindex 1566ed6..991d8ea 100644
20829N/A--- a/ipc/chromium/src/base/string_util.cc
20829N/A+++ b/ipc/chromium/src/base/string_util.cc
20829N/A@@ -503,22 +503,46 @@ std::wstring CollapseWhitespace(const std::wstring& text,
20829N/A
20829N/A std::string WideToASCII(const std::wstring& wide) {
20829N/A DCHECK(IsStringASCII(wide));
20829N/A+#ifdef COMPILER_SUNPRO
20829N/A+ std::string str(wide.length(), ' ');
20829N/A+ std::copy(wide.begin(), wide.end(), str.begin());
20829N/A+ return str;
20829N/A+#else
20829N/A return std::string(wide.begin(), wide.end());
20829N/A+#endif
20829N/A }
20829N/A
20829N/A std::wstring ASCIIToWide(const std::string& ascii) {
20829N/A DCHECK(IsStringASCII(ascii));
20829N/A+#ifdef COMPILER_SUNPRO
20829N/A+ std::wstring wstr(ascii.length(), L' ');
20829N/A+ std::copy(ascii.begin(), ascii.end(), wstr.begin());
20829N/A+ return wstr;
20829N/A+#else
20829N/A return std::wstring(ascii.begin(), ascii.end());
20829N/A+#endif
20829N/A }
20829N/A
20829N/A std::string UTF16ToASCII(const string16& utf16) {
20829N/A DCHECK(IsStringASCII(utf16));
20829N/A+#ifdef COMPILER_SUNPRO
20829N/A+ std::string str(utf16.length(), ' ');
20829N/A+ std::copy(utf16.begin(), utf16.end(), str.begin());
20829N/A+ return str;
20829N/A+#else
20829N/A return std::string(utf16.begin(), utf16.end());
20829N/A+#endif
20829N/A }
20829N/A
20829N/A string16 ASCIIToUTF16(const std::string& ascii) {
20829N/A DCHECK(IsStringASCII(ascii));
20829N/A+#ifdef COMPILER_SUNPRO
20829N/A+ string16 str(ascii.length(), ' ');
20829N/A+ std::copy(ascii.begin(), ascii.end(), str.begin());
20829N/A+ return str;
20829N/A+#else
20829N/A return string16(ascii.begin(), ascii.end());
20829N/A+#endif
20829N/A }
20829N/A
20829N/A // Latin1 is just the low range of Unicode, so we can copy directly to convert.
20829N/A@@ -734,6 +758,7 @@ bool LowerCaseEqualsASCII(std::wstring::const_iterator a_begin,
20829N/A const char* b) {
20829N/A return DoLowerCaseEqualsASCII(a_begin, a_end, b);
20829N/A }
20829N/A+#ifndef COMPILER_SUNPRO
20829N/A bool LowerCaseEqualsASCII(const char* a_begin,
20829N/A const char* a_end,
20829N/A const char* b) {
20829N/A@@ -744,6 +769,7 @@ bool LowerCaseEqualsASCII(const wchar_t* a_begin,
20829N/A const char* b) {
20829N/A return DoLowerCaseEqualsASCII(a_begin, a_end, b);
20829N/A }
20829N/A+#endif
20829N/A
20829N/A bool StartsWithASCII(const std::string& str,
20829N/A const std::string& search,
20829N/Adiff --git a/ipc/chromium/src/base/sys_info_posix.cc b/ipc/chromium/src/base/sys_info_posix.cc
20829N/Aindex 33ed0f7..b5bd350 100644
20829N/A--- a/ipc/chromium/src/base/sys_info_posix.cc
20829N/A+++ b/ipc/chromium/src/base/sys_info_posix.cc
20829N/A@@ -96,7 +96,7 @@ std::wstring SysInfo::GetEnvVar(const wchar_t* var) {
20829N/A
20829N/A // static
20829N/A std::string SysInfo::OperatingSystemName() {
20829N/A- utsname info;
20829N/A+ struct utsname info;
20829N/A if (uname(&info) < 0) {
20829N/A NOTREACHED();
20829N/A return "";
20829N/A@@ -106,7 +106,7 @@ std::string SysInfo::OperatingSystemName() {
20829N/A
20829N/A // static
20829N/A std::string SysInfo::OperatingSystemVersion() {
20829N/A- utsname info;
20829N/A+ struct utsname info;
20829N/A if (uname(&info) < 0) {
20829N/A NOTREACHED();
20829N/A return "";
20829N/A@@ -116,7 +116,7 @@ std::string SysInfo::OperatingSystemVersion() {
20829N/A
20829N/A // static
20829N/A std::string SysInfo::CPUArchitecture() {
20829N/A- utsname info;
20829N/A+ struct utsname info;
20829N/A if (uname(&info) < 0) {
20829N/A NOTREACHED();
20829N/A return "";
20829N/Adiff --git a/ipc/chromium/src/base/third_party/nspr/prcpucfg.h b/ipc/chromium/src/base/third_party/nspr/prcpucfg.h
20829N/Aindex d54f0d1..a2726fa 100644
20829N/A--- a/ipc/chromium/src/base/third_party/nspr/prcpucfg.h
20829N/A+++ b/ipc/chromium/src/base/third_party/nspr/prcpucfg.h
20829N/A@@ -36,6 +36,8 @@
20829N/A #include "base/third_party/nspr/prcpucfg_mac.h"
20829N/A #elif defined(__linux__) || defined(ANDROID)
20829N/A #include "base/third_party/nspr/prcpucfg_linux.h"
20829N/A+#elif defined(__sun) || defined(sun)
20829N/A+#include "base/third_party/nspr/prcpucfg_solaris.h"
20829N/A #else
20829N/A #error Provide a prcpucfg.h appropriate for your platform
20829N/A #endif
20829N/Adiff --git a/ipc/chromium/src/base/third_party/nspr/prtime.cc b/ipc/chromium/src/base/third_party/nspr/prtime.cc
20829N/Aindex e6176aa..62473f7 100644
20829N/A--- a/ipc/chromium/src/base/third_party/nspr/prtime.cc
20829N/A+++ b/ipc/chromium/src/base/third_party/nspr/prtime.cc
20829N/A@@ -242,6 +242,49 @@ PR_ImplodeTime(const PRExplodedTime *exploded)
20829N/A result *= kSecondsToMicroseconds;
20829N/A result += exploded->tm_usec;
20829N/A return result;
20829N/A+#elif defined(OS_SOLARIS)
20829N/A+
20829N/A+#define COUNT_LEAPS(Y) ( ((Y)-1)/4 - ((Y)-1)/100 + ((Y)-1)/400 )
20829N/A+#define COUNT_DAYS(Y) ( ((Y)-1)*365 + COUNT_LEAPS(Y) )
20829N/A+#define DAYS_BETWEEN_YEARS(A, B) (COUNT_DAYS(B) - COUNT_DAYS(A))
20829N/A+#define LL_ADD(r, a, b) ((r) = (a) + (b))
20829N/A+#define LL_SUB(r, a, b) ((r) = (a) - (b))
20829N/A+
20829N/A+ PRExplodedTime copy;
20829N/A+ PRTime retVal;
20829N/A+ PRInt64 secPerDay, usecPerSec;
20829N/A+ PRInt64 temp;
20829N/A+ PRInt64 numSecs64;
20829N/A+ PRInt32 numDays;
20829N/A+ PRInt32 numSecs;
20829N/A+
20829N/A+ /* Normalize first. Do this on our copy */
20829N/A+ copy = *exploded;
20829N/A+ PR_NormalizeTime(&copy, PR_GMTParameters);
20829N/A+
20829N/A+ numDays = DAYS_BETWEEN_YEARS(1970, copy.tm_year);
20829N/A+
20829N/A+ numSecs = copy.tm_yday * 86400 + copy.tm_hour * 3600
20829N/A+ + copy.tm_min * 60 + copy.tm_sec;
20829N/A+
20829N/A+ LL_I2L(temp, numDays);
20829N/A+ LL_I2L(secPerDay, 86400);
20829N/A+ LL_MUL(temp, temp, secPerDay);
20829N/A+ LL_I2L(numSecs64, numSecs);
20829N/A+ LL_ADD(numSecs64, numSecs64, temp);
20829N/A+
20829N/A+ /* apply the GMT and DST offsets */
20829N/A+ LL_I2L(temp, copy.tm_params.tp_gmt_offset);
20829N/A+ LL_SUB(numSecs64, numSecs64, temp);
20829N/A+ LL_I2L(temp, copy.tm_params.tp_dst_offset);
20829N/A+ LL_SUB(numSecs64, numSecs64, temp);
20829N/A+
20829N/A+ LL_I2L(usecPerSec, 1000000L);
20829N/A+ LL_MUL(temp, numSecs64, usecPerSec);
20829N/A+ LL_I2L(retVal, copy.tm_usec);
20829N/A+ LL_ADD(retVal, retVal, temp);
20829N/A+
20829N/A+ return retVal;
20829N/A #else
20829N/A #error No PR_ImplodeTime implemented on your platform.
20829N/A #endif
20829N/Adiff --git a/ipc/chromium/src/base/time.h b/ipc/chromium/src/base/time.h
20829N/Aindex 0625bfb..a62f20d 100644
20829N/A--- a/ipc/chromium/src/base/time.h
20829N/A+++ b/ipc/chromium/src/base/time.h
20829N/A@@ -62,6 +62,10 @@ class TimeDelta {
20829N/A return delta_;
20829N/A }
20829N/A
20829N/A+#if defined(OS_POSIX)
20829N/A+ struct timespec ToTimeSpec() const;
20829N/A+#endif
20829N/A+
20829N/A // Returns the time delta in some unit. The F versions return a floating
20829N/A // point value, the "regular" versions return a rounded-down value.
20829N/A int InDays() const;
20829N/A@@ -224,6 +228,10 @@ class Time {
20829N/A static Time FromDoubleT(double dt);
20829N/A double ToDoubleT() const;
20829N/A
20829N/A+#if defined(OS_POSIX)
20829N/A+ struct timeval ToTimeVal() const;
20829N/A+#endif
20829N/A+
20829N/A
20829N/A #if defined(OS_WIN)
20829N/A static Time FromFileTime(FILETIME ft);
20829N/Adiff --git a/ipc/chromium/src/base/time_posix.cc b/ipc/chromium/src/base/time_posix.cc
20829N/Aindex 1014962..3bd0bad 100644
20829N/A--- a/ipc/chromium/src/base/time_posix.cc
20829N/A+++ b/ipc/chromium/src/base/time_posix.cc
20829N/A@@ -62,11 +62,13 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) {
20829N/A timestruct.tm_wday = exploded.day_of_week; // mktime/timegm ignore this
20829N/A timestruct.tm_yday = 0; // mktime/timegm ignore this
20829N/A timestruct.tm_isdst = -1; // attempt to figure it out
20829N/A+#ifndef OS_SOLARIS
20829N/A timestruct.tm_gmtoff = 0; // not a POSIX field, so mktime/timegm ignore
20829N/A timestruct.tm_zone = NULL; // not a POSIX field, so mktime/timegm ignore
20829N/A-
20829N/A+#endif
20829N/A+
20829N/A time_t seconds;
20829N/A-#ifdef ANDROID
20829N/A+#if defined(ANDROID) || defined(OS_SOLARIS)
20829N/A seconds = mktime(&timestruct);
20829N/A #else
20829N/A if (is_local)
20829N/A@@ -165,7 +167,7 @@ TimeTicks TimeTicks::Now() {
20829N/A // reported in nanoseconds is enough to last nearly 585 years.
20829N/A
20829N/A #elif defined(OS_POSIX) && \
20829N/A- defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0
20829N/A+ defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0 || defined(OS_SOLARIS)
20829N/A
20829N/A struct timespec ts;
20829N/A if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
20829N/A@@ -189,4 +191,25 @@ TimeTicks TimeTicks::HighResNow() {
20829N/A return Now();
20829N/A }
20829N/A
20829N/A+struct timespec TimeDelta::ToTimeSpec() const {
20829N/A+ int64 microseconds = InMicroseconds();
20829N/A+ time_t seconds = 0;
20829N/A+ if (microseconds >= Time::kMicrosecondsPerSecond) {
20829N/A+ seconds = InSeconds();
20829N/A+ microseconds -= seconds * Time::kMicrosecondsPerSecond;
20829N/A+ }
20829N/A+ struct timespec result =
20829N/A+ {seconds,
20829N/A+ microseconds * Time::kNanosecondsPerMicrosecond};
20829N/A+ return result;
20829N/A+}
20829N/A+
20829N/A+struct timeval Time::ToTimeVal() const {
20829N/A+ struct timeval result;
20829N/A+ int64 us = us_ - kTimeTToMicrosecondsOffset;
20829N/A+ result.tv_sec = us / Time::kMicrosecondsPerSecond;
20829N/A+ result.tv_usec = us % Time::kMicrosecondsPerSecond;
20829N/A+ return result;
20829N/A+}
20829N/A+
20829N/A } // namespace base
20829N/Adiff --git a/ipc/chromium/src/base/tracked_objects.cc b/ipc/chromium/src/base/tracked_objects.cc
20829N/Aindex 7506df7..63cd557 100644
20829N/A--- a/ipc/chromium/src/base/tracked_objects.cc
20829N/A+++ b/ipc/chromium/src/base/tracked_objects.cc
20829N/A@@ -804,7 +804,11 @@ void Comparator::SetSubgroupTiebreaker(Selector selector) {
20829N/A }
20829N/A
20829N/A void Comparator::ParseKeyphrase(const std::string key_phrase) {
20829N/A+#if defined(COMPILER_SUNPRO)
20829N/A+ static std::map<std::string, Selector> key_map;
20829N/A+#else
20829N/A static std::map<const std::string, Selector> key_map;
20829N/A+#endif
20829N/A static bool initialized = false;
20829N/A if (!initialized) {
20829N/A initialized = true;
20829N/Adiff --git a/ipc/chromium/src/build/build_config.h b/ipc/chromium/src/build/build_config.h
20829N/Aindex 06ee253..319cada 100644
20829N/A--- a/ipc/chromium/src/build/build_config.h
20829N/A+++ b/ipc/chromium/src/build/build_config.h
20829N/A@@ -4,9 +4,9 @@
20829N/A
20829N/A // This file adds defines about the platform we're currently building on.
20829N/A // Operating System:
20829N/A-// OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX)
20829N/A+// OS_WIN / OS_MACOSX / OS_LINUX / OS_SOLARIS / OS_POSIX (MACOSX or LINUX)
20829N/A // Compiler:
20829N/A-// COMPILER_MSVC / COMPILER_GCC
20829N/A+// COMPILER_MSVC / COMPILER_GCC / COMPILER_SUNPRO
20829N/A // Processor:
20829N/A // ARCH_CPU_X86 / ARCH_CPU_X86_64 / ARCH_CPU_X86_FAMILY (X86 or X86_64)
20829N/A // ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
20829N/A@@ -21,19 +21,23 @@
20829N/A #define OS_LINUX 1
20829N/A #elif defined(_WIN32)
20829N/A #define OS_WIN 1
20829N/A+#elif defined(__sun__) || defined(__sun)
20829N/A+#define OS_SOLARIS 1
20829N/A #else
20829N/A #error Please add support for your platform in build/build_config.h
20829N/A #endif
20829N/A
20829N/A // For access to standard POSIX features, use OS_POSIX instead of a more
20829N/A // specific macro.
20829N/A-#if defined(OS_MACOSX) || defined(OS_LINUX)
20829N/A+#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #define OS_POSIX 1
20829N/A #endif
20829N/A
20829N/A // Compiler detection.
20829N/A #if defined(__GNUC__)
20829N/A #define COMPILER_GCC 1
20829N/A+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
20829N/A+#define COMPILER_SUNPRO 1
20829N/A #elif defined(_MSC_VER)
20829N/A #define COMPILER_MSVC 1
20829N/A #else
20829N/A@@ -44,11 +48,11 @@
20829N/A // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
20829N/A // http://www.agner.org/optimize/calling_conventions.pdf
20829N/A // or with gcc, run: "echo | gcc -E -dM -"
20829N/A-#if defined(_M_X64) || defined(__x86_64__)
20829N/A+#if defined(_M_X64) || defined(__x86_64__) || defined(__x86_64)
20829N/A #define ARCH_CPU_X86_FAMILY 1
20829N/A #define ARCH_CPU_X86_64 1
20829N/A #define ARCH_CPU_64_BITS 1
20829N/A-#elif defined(_M_IX86) || defined(__i386__)
20829N/A+#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
20829N/A #define ARCH_CPU_X86_FAMILY 1
20829N/A #define ARCH_CPU_X86 1
20829N/A #define ARCH_CPU_32_BITS 1
20829N/A@@ -60,6 +64,14 @@
20829N/A #elif defined(__ppc__) || defined(__powerpc__)
20829N/A #define ARCH_CPU_PPC 1
20829N/A #define ARCH_CPU_32_BITS 1
20829N/A+#elif defined(__sparc)
20829N/A+#define ARCH_CPU_SPARC_FAMILY 1
20829N/A+#define ARCH_CPU_SPARC 1
20829N/A+#define ARCH_CPU_32_BITS 1
20829N/A+#elif defined(__sparcv9)
20829N/A+#define ARCH_CPU_SPARC_FAMILY 1
20829N/A+#define ARCH_CPU_SPARC 1
20829N/A+#define ARCH_CPU_64_BITS 1
20829N/A #else
20829N/A #error Please add support for your architecture in build/build_config.h
20829N/A #endif
20829N/Adiff --git a/ipc/chromium/src/chrome/common/chrome_constants.cc b/ipc/chromium/src/chrome/common/chrome_constants.cc
20829N/Aindex 2ca8f0c..162b57f 100644
20829N/A--- a/ipc/chromium/src/chrome/common/chrome_constants.cc
20829N/A+++ b/ipc/chromium/src/chrome/common/chrome_constants.cc
20829N/A@@ -14,7 +14,7 @@ namespace chrome {
20829N/A // for system strings only. UI changes should be made in the GRD.
20829N/A #if defined(OS_WIN)
20829N/A const wchar_t kBrowserProcessExecutableName[] = L"chrome.exe";
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A const wchar_t kBrowserProcessExecutableName[] = L"chrome";
20829N/A #elif defined(OS_MACOSX)
20829N/A const wchar_t kBrowserProcessExecutableName[] =
20829N/A@@ -26,7 +26,7 @@ const wchar_t kBrowserProcessExecutableName[] =
20829N/A #endif // OS_*
20829N/A #if defined(OS_WIN)
20829N/A const wchar_t kBrowserProcessExecutablePath[] = L"chrome.exe";
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A const wchar_t kBrowserProcessExecutablePath[] = L"chrome";
20829N/A #elif defined(OS_MACOSX)
20829N/A const wchar_t kBrowserProcessExecutablePath[] =
20829N/Adiff --git a/ipc/chromium/src/chrome/common/chrome_paths.cc b/ipc/chromium/src/chrome/common/chrome_paths.cc
20829N/Aindex 2414306..e8cd9be 100644
20829N/A--- a/ipc/chromium/src/chrome/common/chrome_paths.cc
20829N/A+++ b/ipc/chromium/src/chrome/common/chrome_paths.cc
20829N/A@@ -113,7 +113,7 @@ bool PathProvider(int key, FilePath* result) {
20829N/A create_dir = true;
20829N/A break;
20829N/A case chrome::DIR_APP_DICTIONARIES:
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // We can't write into the EXE dir on Linux, so keep dictionaries
20829N/A // alongside the safe browsing database in the user data dir.
20829N/A if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
20829N/Adiff --git a/ipc/chromium/src/chrome/common/file_descriptor_set_posix.cc b/ipc/chromium/src/chrome/common/file_descriptor_set_posix.cc
20829N/Aindex 49d8199..006b483 100644
20829N/A--- a/ipc/chromium/src/chrome/common/file_descriptor_set_posix.cc
20829N/A+++ b/ipc/chromium/src/chrome/common/file_descriptor_set_posix.cc
20829N/A@@ -4,6 +4,10 @@
20829N/A
20829N/A #include "chrome/common/file_descriptor_set_posix.h"
20829N/A
20829N/A+#if defined(OS_SOLARIS)
20829N/A+#include <unistd.h>
20829N/A+#endif
20829N/A+
20829N/A #include "base/eintr_wrapper.h"
20829N/A #include "base/logging.h"
20829N/A
20829N/Adiff --git a/ipc/chromium/src/chrome/common/ipc_channel_posix.h b/ipc/chromium/src/chrome/common/ipc_channel_posix.h
20829N/Aindex 1302d58..0d450d6 100644
20829N/A--- a/ipc/chromium/src/chrome/common/ipc_channel_posix.h
20829N/A+++ b/ipc/chromium/src/chrome/common/ipc_channel_posix.h
20829N/A@@ -92,7 +92,7 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher {
20829N/A };
20829N/A
20829N/A // This is a control message buffer large enough to hold kMaxReadFDs
20829N/A-#if defined(OS_MACOSX)
20829N/A+#if defined(OS_MACOSX) || defined(OS_SOLARIS)
20829N/A // TODO(agl): OSX appears to have non-constant CMSG macros!
20829N/A char input_cmsg_buf_[1024];
20829N/A #else
20829N/Adiff --git a/ipc/chromium/src/chrome/common/ipc_message.h b/ipc/chromium/src/chrome/common/ipc_message.h
20829N/Aindex 5cff474..c4e890f 100644
20829N/A--- a/ipc/chromium/src/chrome/common/ipc_message.h
20829N/A+++ b/ipc/chromium/src/chrome/common/ipc_message.h
20829N/A@@ -289,7 +289,11 @@ class Message : public Pickle {
20829N/A #endif
20829N/A };
20829N/A
20829N/A+#if defined(COMPILER_SUNPRO)
20829N/A+#pragma pack (2)
20829N/A+#else
20829N/A #pragma pack(push, 2)
20829N/A+#endif
20829N/A struct Header : Pickle::Header {
20829N/A int32 routing; // ID of the view that this message is destined for
20829N/A msgid_t type; // specifies the user-defined message type
20829N/A@@ -310,7 +314,11 @@ class Message : public Pickle {
20829N/A int32 seqno;
20829N/A #endif
20829N/A };
20829N/A+#if defined(COMPILER_SUNPRO)
20829N/A+#pragma pack (0)
20829N/A+#else
20829N/A #pragma pack(pop)
20829N/A+#endif
20829N/A
20829N/A Header* header() {
20829N/A return headerT<Header>();
20829N/Adiff --git a/ipc/chromium/src/chrome/common/ipc_message_utils.h b/ipc/chromium/src/chrome/common/ipc_message_utils.h
20829N/Aindex c4e0856..097f2da 100644
20829N/A--- a/ipc/chromium/src/chrome/common/ipc_message_utils.h
20829N/A+++ b/ipc/chromium/src/chrome/common/ipc_message_utils.h
20829N/A@@ -219,7 +219,7 @@
20829N/A }
20829N/A };
20829N/A
20829N/A-#if !(defined(OS_MACOSX) || defined(OS_WIN) || (defined(CHROMIUM_MOZILLA_BUILD) && defined(OS_LINUX) && defined(ARCH_CPU_64_BITS)))
20829N/A+#if !(defined(OS_MACOSX) || defined(OS_WIN) || (defined(CHROMIUM_MOZILLA_BUILD) && (defined(OS_LINUX) || defined(OS_SOLARIS)) && defined(ARCH_CPU_64_BITS)))
20829N/A // There size_t is a synonym for |unsigned long| ...
20829N/A template <>
20829N/A struct ParamTraits<size_t> {
20829N/A@@ -252,7 +252,7 @@
20829N/A }
20829N/A };
20829N/A
20829N/A-#endif // if !(defined(OS_LINUX) && defined(ARCH_CPU_64_BITS))
20829N/A+#endif // if !((defined(OS_LINUX) || defined(OS_SOLARIS)) && defined(ARCH_CPU_64_BITS))
20829N/A
20829N/A #if defined(OS_MACOSX)
20829N/A // On Linux size_t & uint32 can be the same type.
20829N/A@@ -272,7 +272,7 @@
20829N/A };
20829N/A #endif // defined(OS_MACOSX)
20829N/A
20829N/A-#if !(defined(CHROMIUM_MOZILLA_BUILD) && defined(OS_LINUX) && defined(ARCH_CPU_64_BITS))
20829N/A+#if !(defined(CHROMIUM_MOZILLA_BUILD) && (defined(OS_LINUX) || defined(OS_SOLARIS)) && defined(ARCH_CPU_64_BITS))
20829N/A // int64 is |long int| on 64-bit systems, uint64 is |unsigned long|
20829N/A template <>
20829N/A struct ParamTraits<int64> {
20829N/A@@ -309,7 +309,7 @@
20829N/A #endif // ifndef CHROMIUM_MOZILLA_BUILD
20829N/A }
20829N/A };
20829N/A-#endif // if !(defined(CHROMIUM_MOZILLA_BUILD) && defined(OS_LINUX) && defined(ARCH_CPU_64_BITS))
20829N/A+#endif // if !(defined(CHROMIUM_MOZILLA_BUILD) && (defined(OS_LINUX) || defined(OS_SOLARIS)) && defined(ARCH_CPU_64_BITS))
20829N/A
20829N/A template <>
20829N/A struct ParamTraits<double> {
20829N/Adiff --git a/ipc/chromium/src/chrome/common/native_web_keyboard_event.h b/ipc/chromium/src/chrome/common/native_web_keyboard_event.h
20829N/Aindex 0400b41..a462baf 100644
20829N/A--- a/ipc/chromium/src/chrome/common/native_web_keyboard_event.h
20829N/A+++ b/ipc/chromium/src/chrome/common/native_web_keyboard_event.h
20829N/A@@ -16,7 +16,7 @@
20829N/A #else
20829N/A class NSEvent;
20829N/A #endif // __OBJC__
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #include <gdk/gdk.h>
20829N/A #endif
20829N/A
20829N/A@@ -29,8 +29,8 @@ struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
20829N/A NativeWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
20829N/A #elif defined(OS_MACOSX)
20829N/A explicit NativeWebKeyboardEvent(NSEvent *event);
20829N/A-#elif defined(OS_LINUX)
20829N/A- explicit NativeWebKeyboardEvent(const GdkEventKey* event);
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A+ explicit NativeWebKeyboardEvent(c onst GdkEventKey* event);
20829N/A #endif
20829N/A
20829N/A NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event);
20829N/A@@ -42,7 +42,7 @@ struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
20829N/A MSG os_event;
20829N/A #elif defined(OS_MACOSX)
20829N/A NSEvent* os_event;
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A GdkEventKey* os_event;
20829N/A #endif
20829N/A };
20829N/Adiff --git a/ipc/chromium/src/chrome/common/temp_scaffolding_stubs.cc b/ipc/chromium/src/chrome/common/temp_scaffolding_stubs.cc
20829N/Aindex b4d87c8..e49e9e4 100644
20829N/A--- a/ipc/chromium/src/chrome/common/temp_scaffolding_stubs.cc
20829N/A+++ b/ipc/chromium/src/chrome/common/temp_scaffolding_stubs.cc
20829N/A@@ -121,7 +121,7 @@ void AutomationProvider::OnMessageFromExternalHost(
20829N/A
20829N/A //--------------------------------------------------------------------------
20829N/A
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A bool ShellIntegration::SetAsDefaultBrowser() {
20829N/A NOTIMPLEMENTED();
20829N/A return true;
20829N/Adiff --git a/ipc/chromium/src/chrome/common/transport_dib.h b/ipc/chromium/src/chrome/common/transport_dib.h
20829N/Aindex 33c0649..c690f89 100644
20829N/A--- a/ipc/chromium/src/chrome/common/transport_dib.h
20829N/A+++ b/ipc/chromium/src/chrome/common/transport_dib.h
20829N/A@@ -13,7 +13,7 @@
20829N/A
20829N/A #if defined(OS_WIN)
20829N/A #include <windows.h>
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #include "chrome/common/x11_util.h"
20829N/A #endif
20829N/A
20829N/A@@ -70,7 +70,7 @@ class TransportDIB {
20829N/A typedef base::SharedMemoryHandle Handle;
20829N/A // On Mac, the inode number of the backing file is used as an id.
20829N/A typedef base::SharedMemoryId Id;
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef int Handle; // These two ints are SysV IPC shared memory keys
20829N/A typedef int Id;
20829N/A #endif
20829N/A@@ -100,7 +100,7 @@ class TransportDIB {
20829N/A // wire to give this transport DIB to another process.
20829N/A Handle handle() const;
20829N/A
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // Map the shared memory into the X server and return an id for the shared
20829N/A // segment.
20829N/A XID MapToX(Display* connection);
20829N/A@@ -112,7 +112,7 @@ class TransportDIB {
20829N/A explicit TransportDIB(base::SharedMemoryHandle dib);
20829N/A base::SharedMemory shared_memory_;
20829N/A uint32 sequence_num_;
20829N/A-#elif defined(OS_LINUX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A int key_; // SysV shared memory id
20829N/A void* address_; // mapped address
20829N/A XID x_shm_; // X id for the shared segment
20829N/Adiff --git a/ipc/chromium/src/third_party/libevent/linux/config.h b/ipc/chromium/src/third_party/libevent/linux/config.h
20829N/Aindex 9af92cc..fd92ec9 100644
20829N/A--- a/ipc/chromium/src/third_party/libevent/linux/config.h
20829N/A+++ b/ipc/chromium/src/third_party/libevent/linux/config.h
20829N/A@@ -16,11 +16,13 @@
20829N/A /* Define to 1 if you have the <dlfcn.h> header file. */
20829N/A #define HAVE_DLFCN_H 1
20829N/A
20829N/A+#ifndef OS_SOLARIS
20829N/A /* Define if your system supports the epoll system calls */
20829N/A #define HAVE_EPOLL 1
20829N/A
20829N/A /* Define to 1 if you have the `epoll_ctl' function. */
20829N/A #define HAVE_EPOLL_CTL 1
20829N/A+#endif
20829N/A
20829N/A /* Define if your system supports event ports */
20829N/A /* #undef HAVE_EVENT_PORTS */
20829N/Adiff --git a/ipc/glue/BrowserProcessSubThread.cpp b/ipc/glue/BrowserProcessSubThread.cpp
20829N/Aindex e51db3c..6c0eb32 100644
20829N/A--- a/ipc/glue/BrowserProcessSubThread.cpp
20829N/A+++ b/ipc/glue/BrowserProcessSubThread.cpp
20829N/A@@ -57,7 +57,7 @@ static const char* kBrowserThreadNames[BrowserProcessSubThread::ID_COUNT] = {
20829N/A // "Chrome_FileThread", // FILE
20829N/A // "Chrome_DBThread", // DB
20829N/A // "Chrome_HistoryThread", // HISTORY
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A "Gecko_Background_X11Thread", // BACKGROUND_X11
20829N/A #endif
20829N/A };
20829N/A@@ -68,7 +68,7 @@ BrowserProcessSubThread* BrowserProcessSubThread::sBrowserThreads[ID_COUNT] = {
20829N/A // NULL, // FILE
20829N/A // NULL, // DB
20829N/A // NULL, // HISTORY
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A NULL, // BACKGROUND_X11
20829N/A #endif
20829N/A };
20829N/Adiff --git a/ipc/glue/BrowserProcessSubThread.h b/ipc/glue/BrowserProcessSubThread.h
20829N/Aindex 68c8973..26bf0b3 100644
20829N/A--- a/ipc/glue/BrowserProcessSubThread.h
20829N/A+++ b/ipc/glue/BrowserProcessSubThread.h
20829N/A@@ -60,7 +60,7 @@ public:
20829N/A //FILE,
20829N/A //DB,
20829N/A //HISTORY,
20829N/A-#if defined(OS_LINUX)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // This thread has a second connection to the X server and is used
20829N/A // to process UI requests when routing the request to the UI
20829N/A // thread would risk deadlock.
20829N/Adiff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp
20829N/Aindex 67a9651..47e9363 100644
20829N/A--- a/ipc/glue/GeckoChildProcessHost.cpp
20829N/A+++ b/ipc/glue/GeckoChildProcessHost.cpp
20829N/A@@ -459,7 +459,7 @@ GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts, b
20829N/A childArgv.push_back(pidstring);
20829N/A
20829N/A #if defined(MOZ_CRASHREPORTER)
20829N/A-# if defined(OS_LINUX)
20829N/A+# if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A int childCrashFd, childCrashRemapFd;
20829N/A if (!CrashReporter::CreateNotificationPipeForChild(
20829N/A &childCrashFd, &childCrashRemapFd))
20829N/A@@ -475,7 +475,7 @@ GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts, b
20829N/A }
20829N/A # elif defined(XP_MACOSX)
20829N/A childArgv.push_back(CrashReporter::GetChildNotificationPipe());
20829N/A-# endif // OS_LINUX
20829N/A+# endif // OS_LINUX || defined(OS_SOLARIS)
20829N/A #endif
20829N/A
20829N/A #ifdef XP_MACOSX
20829N/A@@ -498,6 +498,8 @@ GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts, b
20829N/A base::LaunchApp(childArgv, mFileMap,
20829N/A #if defined(OS_LINUX) || defined(OS_MACOSX)
20829N/A newEnvVars,
20829N/A+#elif defined(OS_SOLARIS)
20829N/A+ base::environment_map(),
20829N/A #endif
20829N/A false, &process, arch);
20829N/A
20829N/Adiff --git a/ipc/glue/SharedMemorySysV.h b/ipc/glue/SharedMemorySysV.h
20829N/Aindex a68b22b..1df19ef 100644
20829N/A--- a/ipc/glue/SharedMemorySysV.h
20829N/A+++ b/ipc/glue/SharedMemorySysV.h
20829N/A@@ -40,7 +40,7 @@
20829N/A #ifndef mozilla_ipc_SharedMemorySysV_h
20829N/A #define mozilla_ipc_SharedMemorySysV_h
20829N/A
20829N/A-#if defined(OS_LINUX) && !defined(ANDROID)
20829N/A+#if (defined(OS_LINUX) || defined(OS_SOLARIS)) && !defined(ANDROID)
20829N/A
20829N/A // SysV shared memory isn't available on Windows, but we define the
20829N/A // following macro so that #ifdefs are clearer (compared to #ifdef
20829N/A@@ -87,6 +87,9 @@ public:
20829N/A virtual ~SharedMemorySysV()
20829N/A {
20829N/A shmdt(mData);
20829N/A+#ifdef OS_SOLARIS
20829N/A+ shmctl(mHandle, IPC_RMID, 0);
20829N/A+#endif
20829N/A mHandle = -1;
20829N/A mData = nsnull;
20829N/A }
20829N/A@@ -128,7 +131,9 @@ public:
20829N/A
20829N/A // Mark the handle as deleted so that, should this process go away, the
20829N/A // segment is cleaned up.
20829N/A+#ifndef OS_SOLARIS
20829N/A shmctl(mHandle, IPC_RMID, 0);
20829N/A+#endif
20829N/A
20829N/A mData = mem;
20829N/A
20829N/A@@ -181,6 +186,6 @@ private:
20829N/A } // namespace ipc
20829N/A } // namespace mozilla
20829N/A
20829N/A-#endif // OS_LINUX
20829N/A+#endif // OS_LINUX || OS_SOLARIS
20829N/A
20829N/A #endif // ifndef mozilla_ipc_SharedMemorySysV_h
20829N/Adiff --git a/ipc/ipdl/test/cxx/Makefile.in b/ipc/ipdl/test/cxx/Makefile.in
20829N/Aindex c244534..ceca18a 100644
20829N/A--- a/ipc/ipdl/test/cxx/Makefile.in
20829N/A+++ b/ipc/ipdl/test/cxx/Makefile.in
20829N/A@@ -87,6 +87,10 @@ ifeq ($(OS_ARCH),Linux)
20829N/A IPDLTESTS += TestSysVShmem
20829N/A endif
20829N/A
20829N/A+ifeq ($(OS_ARCH),SunOS)
20829N/A+IPDLTESTS += TestSysVShmem
20829N/A+endif
20829N/A+
20829N/A IPDLTESTSRCS = $(addsuffix .cpp,$(IPDLTESTS))
20829N/A IPDLTESTHDRS = $(addprefix $(srcdir)/,$(addsuffix .h,$(IPDLTESTS)))
20829N/A
20829N/Adiff --git a/ipc/ipdl/test/cxx/TestShutdown.cpp b/ipc/ipdl/test/cxx/TestShutdown.cpp
20829N/Aindex 217aabc..6fe4dbd 100644
20829N/A--- a/ipc/ipdl/test/cxx/TestShutdown.cpp
20829N/A+++ b/ipc/ipdl/test/cxx/TestShutdown.cpp
20829N/A@@ -184,6 +184,8 @@ TestShutdownChild::RecvStart()
20829N/A // detectors
20829N/A _exit(0);
20829N/A }
20829N/A+
20829N/A+ return false;
20829N/A }
20829N/A
20829N/A void
20829N/Adiff --git a/layout/base/nsPresArena.cpp b/layout/base/nsPresArena.cpp
20829N/Aindex 4456cd1..7e23a5d 100644
20829N/A--- a/layout/base/nsPresArena.cpp
20829N/A+++ b/layout/base/nsPresArena.cpp
20829N/A@@ -82,6 +82,8 @@
20829N/A # endif
20829N/A #endif
20829N/A
20829N/A+extern "C" int madvise(caddr_t, size_t, int);
20829N/A+
20829N/A // Size to use for PLArena block allocations.
20829N/A static const size_t ARENA_PAGE_SIZE = 4096;
20829N/A
20829N/Adiff --git a/layout/base/tests/TestPoisonArea.cpp b/layout/base/tests/TestPoisonArea.cpp
20829N/Aindex 20cf9ed..646fd13 100644
20829N/A--- a/layout/base/tests/TestPoisonArea.cpp
20829N/A+++ b/layout/base/tests/TestPoisonArea.cpp
20829N/A@@ -149,6 +149,7 @@ typedef unsigned int uint32_t;
20829N/A #include <sys/wait.h>
20829N/A
20829N/A #include <sys/mman.h>
20829N/A+extern "C" int madvise(caddr_t, size_t, int);
20829N/A #ifndef MAP_ANON
20829N/A #ifdef MAP_ANONYMOUS
20829N/A #define MAP_ANON MAP_ANONYMOUS
20829N/Adiff --git a/xpcom/io/nsFastLoadFile.cpp b/xpcom/io/nsFastLoadFile.cpp
20829N/Aindex aaf7dcb..0aca1e4 100644
20829N/A--- a/xpcom/io/nsFastLoadFile.cpp
20829N/A+++ b/xpcom/io/nsFastLoadFile.cpp
20829N/A@@ -58,6 +58,7 @@
20829N/A #include "nsFastLoadFile.h"
20829N/A #ifdef XP_UNIX
20829N/A #include <sys/mman.h>
20829N/A+extern "C" int madvise(caddr_t, size_t, int);
20829N/A #endif
20829N/A
20829N/A #ifdef DEBUG_brendan
20829N/Adiff --git a/ipc/chromium/src/base/file_util_deprecated.h b/ipc/chromium/src/base/file_util_deprecated.h
20829N/Anew file mode 100644
20829N/Aindex 0000000..9a8c5bf
20829N/A--- /dev/null
20829N/A+++ b/ipc/chromium/src/base/file_util_deprecated.h
20829N/A@@ -0,0 +1,74 @@
20829N/A+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
20829N/A+// Use of this source code is governed by a BSD-style license that can be
20829N/A+// found in the LICENSE file.
20829N/A+
20829N/A+// We're trying to transition away from paths as wstrings into using
20829N/A+// FilePath objects. This file contains declarations of deprecated
20829N/A+// functions. By hiding them here rather in the main header, we hope
20829N/A+// to discourage callers.
20829N/A+
20829N/A+// See file_util.h for documentation on all functions that don't have
20829N/A+// documentation here.
20829N/A+
20829N/A+#ifndef BASE_FILE_UTIL_DEPRECATED_H_
20829N/A+#define BASE_FILE_UTIL_DEPRECATED_H_
20829N/A+
20829N/A+#include "build/build_config.h"
20829N/A+
20829N/A+namespace file_util {
20829N/A+
20829N/A+bool EndsWithSeparator(std::wstring* path);
20829N/A+bool EndsWithSeparator(const std::wstring& path);
20829N/A+
20829N/A+// Use FilePath::DirName instead.
20829N/A+void UpOneDirectory(std::wstring* dir);
20829N/A+// Use FilePath::DirName instead.
20829N/A+void UpOneDirectoryOrEmpty(std::wstring* dir);
20829N/A+
20829N/A+// Use FilePath::BaseName instead.
20829N/A+std::wstring GetFilenameFromPath(const std::wstring& path);
20829N/A+
20829N/A+// Use FilePath::Extension instead.
20829N/A+FilePath::StringType GetFileExtensionFromPath(const FilePath& path);
20829N/A+std::wstring GetFileExtensionFromPath(const std::wstring& path);
20829N/A+
20829N/A+bool AbsolutePath(std::wstring* path);
20829N/A+
20829N/A+// Use FilePath::InsertBeforeExtension.
20829N/A+void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix);
20829N/A+
20829N/A+// Use FilePath::ReplaceExtension.
20829N/A+void ReplaceExtension(FilePath* file_name,
20829N/A+ const FilePath::StringType& extension);
20829N/A+
20829N/A+bool Delete(const std::wstring& path, bool recursive);
20829N/A+bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path,
20829N/A+ bool recursive);
20829N/A+bool ReadFileToString(const std::wstring& path, std::string* contents);
20829N/A+FILE* OpenFile(const std::string& filename, const char* mode);
20829N/A+FILE* OpenFile(const std::wstring& filename, const char* mode);
20829N/A+int ReadFile(const std::wstring& filename, char* data, int size);
20829N/A+int WriteFile(const std::wstring& filename, const char* data, int size);
20829N/A+
20829N/A+// Functions successfully deprecated on non-Windows, but Win-specific
20829N/A+// callers remain.
20829N/A+#if defined(OS_WIN)
20829N/A+// Returns the directory component of a path, without the trailing
20829N/A+// path separator, or an empty string on error. The function does not
20829N/A+// check for the existence of the path, so if it is passed a directory
20829N/A+// without the trailing \, it will interpret the last component of the
20829N/A+// path as a file and chomp it. This does not support relative paths.
20829N/A+// Examples:
20829N/A+// path == "C:\pics\jojo.jpg", returns "C:\pics"
20829N/A+// path == "C:\Windows\system32\", returns "C:\Windows\system32"
20829N/A+// path == "C:\Windows\system32", returns "C:\Windows"
20829N/A+// Deprecated. Use FilePath's DirName() instead.
20829N/A+std::wstring GetDirectoryFromPath(const std::wstring& path);
20829N/A+
20829N/A+// Appends new_ending to path, adding a separator between the two if necessary.
20829N/A+void AppendToPath(std::wstring* path, const std::wstring& new_ending);
20829N/A+#endif
20829N/A+
20829N/A+}
20829N/A+
20829N/A+#endif // BASE_FILE_UTIL_DEPRECATED_H_
20829N/Adiff --git a/ipc/chromium/src/base/third_party/nspr/prcpucfg_solaris.h b/ipc/chromium/src/base/third_party/nspr/prcpucfg_solaris.h
20829N/Anew file mode 100644
20829N/Aindex 0000000..81313e5
20829N/A--- /dev/null
20829N/A+++ b/ipc/chromium/src/base/third_party/nspr/prcpucfg_solaris.h
20829N/A@@ -0,0 +1,203 @@
20829N/A+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
20829N/A+/* ***** BEGIN LICENSE BLOCK *****
20829N/A+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
20829N/A+ *
20829N/A+ * The contents of this file are subject to the Mozilla Public License Version
20829N/A+ * 1.1 (the "License"); you may not use this file except in compliance with
20829N/A+ * the License. You may obtain a copy of the License at
20829N/A+ * http://www.mozilla.org/MPL/
20829N/A+ *
20829N/A+ * Software distributed under the License is distributed on an "AS IS" basis,
20829N/A+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
20829N/A+ * for the specific language governing rights and limitations under the
20829N/A+ * License.
20829N/A+ *
20829N/A+ * The Original Code is the Netscape Portable Runtime (NSPR).
20829N/A+ *
20829N/A+ * The Initial Developer of the Original Code is
20829N/A+ * Netscape Communications Corporation.
20829N/A+ * Portions created by the Initial Developer are Copyright (C) 1998-2000
20829N/A+ * the Initial Developer. All Rights Reserved.
20829N/A+ *
20829N/A+ * Contributor(s):
20829N/A+ *
20829N/A+ * Alternatively, the contents of this file may be used under the terms of
20829N/A+ * either the GNU General Public License Version 2 or later (the "GPL"), or
20829N/A+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
20829N/A+ * in which case the provisions of the GPL or the LGPL are applicable instead
20829N/A+ * of those above. If you wish to allow use of your version of this file only
20829N/A+ * under the terms of either the GPL or the LGPL, and not to allow others to
20829N/A+ * use your version of this file under the terms of the MPL, indicate your
20829N/A+ * decision by deleting the provisions above and replace them with the notice
20829N/A+ * and other provisions required by the GPL or the LGPL. If you do not delete
20829N/A+ * the provisions above, a recipient may use your version of this file under
20829N/A+ * the terms of any one of the MPL, the GPL or the LGPL.
20829N/A+ *
20829N/A+ * ***** END LICENSE BLOCK ***** */
20829N/A+
20829N/A+#ifndef nspr_cpucfg___
20829N/A+#define nspr_cpucfg___
20829N/A+
20829N/A+#ifndef XP_UNIX
20829N/A+#define XP_UNIX
20829N/A+#endif
20829N/A+
20829N/A+#ifndef SOLARIS
20829N/A+#define SOLARIS
20829N/A+#endif
20829N/A+
20829N/A+#define PR_AF_INET6 26 /* same as AF_INET6 */
20829N/A+
20829N/A+#if defined(sparc) || defined(__sparc)
20829N/A+#undef IS_LITTLE_ENDIAN
20829N/A+#define IS_BIG_ENDIAN 1
20829N/A+#define PR_ALIGN_OF_INT64 8
20829N/A+#define PR_ALIGN_OF_DOUBLE 8
20829N/A+#if defined(__sparcv9)
20829N/A+#define IS_64
20829N/A+#endif
20829N/A+#elif defined(__x86_64)
20829N/A+#define IS_LITTLE_ENDIAN 1
20829N/A+#undef IS_BIG_ENDIAN
20829N/A+#define PR_ALIGN_OF_INT64 8
20829N/A+#define PR_ALIGN_OF_DOUBLE 8
20829N/A+#define IS_64
20829N/A+#elif defined(i386) || defined(__i386)
20829N/A+#define IS_LITTLE_ENDIAN 1
20829N/A+#undef IS_BIG_ENDIAN
20829N/A+#define PR_ALIGN_OF_INT64 4
20829N/A+#define PR_ALIGN_OF_DOUBLE 4
20829N/A+#else
20829N/A+#error unknown processor
20829N/A+#endif
20829N/A+
20829N/A+#ifdef IS_64
20829N/A+
20829N/A+#define PR_BYTES_PER_BYTE 1
20829N/A+#define PR_BYTES_PER_SHORT 2
20829N/A+#define PR_BYTES_PER_INT 4
20829N/A+#define PR_BYTES_PER_INT64 8
20829N/A+#define PR_BYTES_PER_LONG 8
20829N/A+#define PR_BYTES_PER_FLOAT 4
20829N/A+#define PR_BYTES_PER_DOUBLE 8
20829N/A+#define PR_BYTES_PER_WORD 8
20829N/A+#define PR_BYTES_PER_DWORD 8
20829N/A+#define PR_BYTES_PER_WORD_LOG2 3
20829N/A+#define PR_BYTES_PER_DWORD_LOG2 3
20829N/A+
20829N/A+#define PR_BITS_PER_BYTE 8
20829N/A+#define PR_BITS_PER_SHORT 16
20829N/A+#define PR_BITS_PER_INT 32
20829N/A+#define PR_BITS_PER_INT64 64
20829N/A+#define PR_BITS_PER_LONG 64
20829N/A+#define PR_BITS_PER_FLOAT 32
20829N/A+#define PR_BITS_PER_DOUBLE 64
20829N/A+#define PR_BITS_PER_WORD 64
20829N/A+
20829N/A+#define PR_BITS_PER_BYTE_LOG2 3
20829N/A+#define PR_BITS_PER_SHORT_LOG2 4
20829N/A+#define PR_BITS_PER_INT_LOG2 5
20829N/A+#define PR_BITS_PER_INT64_LOG2 6
20829N/A+#define PR_BITS_PER_LONG_LOG2 6
20829N/A+#define PR_BITS_PER_FLOAT_LOG2 5
20829N/A+#define PR_BITS_PER_DOUBLE_LOG2 6
20829N/A+#define PR_BITS_PER_WORD_LOG2 6
20829N/A+
20829N/A+#define PR_ALIGN_OF_SHORT 2
20829N/A+#define PR_ALIGN_OF_INT 4
20829N/A+#define PR_ALIGN_OF_LONG 8
20829N/A+#define PR_ALIGN_OF_FLOAT 4
20829N/A+#define PR_ALIGN_OF_POINTER 8
20829N/A+
20829N/A+#else /* IS_64 */
20829N/A+
20829N/A+#define PR_BYTES_PER_BYTE 1
20829N/A+#define PR_BYTES_PER_SHORT 2
20829N/A+#define PR_BYTES_PER_INT 4
20829N/A+#define PR_BYTES_PER_INT64 8
20829N/A+#define PR_BYTES_PER_LONG 4
20829N/A+#define PR_BYTES_PER_FLOAT 4
20829N/A+#define PR_BYTES_PER_DOUBLE 8
20829N/A+#define PR_BYTES_PER_WORD 4
20829N/A+#define PR_BYTES_PER_DWORD 8
20829N/A+#define PR_BYTES_PER_WORD_LOG2 2
20829N/A+#define PR_BYTES_PER_DWORD_LOG2 3
20829N/A+
20829N/A+#define PR_BITS_PER_BYTE 8
20829N/A+#define PR_BITS_PER_SHORT 16
20829N/A+#define PR_BITS_PER_INT 32
20829N/A+#define PR_BITS_PER_INT64 64
20829N/A+#define PR_BITS_PER_LONG 32
20829N/A+#define PR_BITS_PER_FLOAT 32
20829N/A+#define PR_BITS_PER_DOUBLE 64
20829N/A+#define PR_BITS_PER_WORD 32
20829N/A+
20829N/A+#define PR_BITS_PER_BYTE_LOG2 3
20829N/A+#define PR_BITS_PER_SHORT_LOG2 4
20829N/A+#define PR_BITS_PER_INT_LOG2 5
20829N/A+#define PR_BITS_PER_INT64_LOG2 6
20829N/A+#define PR_BITS_PER_LONG_LOG2 5
20829N/A+#define PR_BITS_PER_FLOAT_LOG2 5
20829N/A+#define PR_BITS_PER_DOUBLE_LOG2 6
20829N/A+#define PR_BITS_PER_WORD_LOG2 5
20829N/A+
20829N/A+#define PR_ALIGN_OF_SHORT 2
20829N/A+#define PR_ALIGN_OF_INT 4
20829N/A+#define PR_ALIGN_OF_LONG 4
20829N/A+#define PR_ALIGN_OF_FLOAT 4
20829N/A+#define PR_ALIGN_OF_POINTER 4
20829N/A+
20829N/A+#endif /* IS_64 */
20829N/A+
20829N/A+#ifndef HAVE_LONG_LONG
20829N/A+#define HAVE_LONG_LONG
20829N/A+#endif
20829N/A+#define HAVE_ALIGNED_DOUBLES
20829N/A+#define HAVE_ALIGNED_LONGLONGS
20829N/A+
20829N/A+#ifndef NO_NSPR_10_SUPPORT
20829N/A+
20829N/A+#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
20829N/A+#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
20829N/A+#define BYTES_PER_INT PR_BYTES_PER_INT
20829N/A+#define BYTES_PER_INT64 PR_BYTES_PER_INT64
20829N/A+#define BYTES_PER_LONG PR_BYTES_PER_LONG
20829N/A+#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
20829N/A+#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
20829N/A+#define BYTES_PER_WORD PR_BYTES_PER_WORD
20829N/A+#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
20829N/A+
20829N/A+#define BITS_PER_BYTE PR_BITS_PER_BYTE
20829N/A+#define BITS_PER_SHORT PR_BITS_PER_SHORT
20829N/A+#define BITS_PER_INT PR_BITS_PER_INT
20829N/A+#define BITS_PER_INT64 PR_BITS_PER_INT64
20829N/A+#define BITS_PER_LONG PR_BITS_PER_LONG
20829N/A+#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
20829N/A+#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
20829N/A+#define BITS_PER_WORD PR_BITS_PER_WORD
20829N/A+
20829N/A+#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
20829N/A+#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
20829N/A+#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
20829N/A+#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
20829N/A+#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
20829N/A+#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
20829N/A+#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
20829N/A+#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
20829N/A+
20829N/A+#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
20829N/A+#define ALIGN_OF_INT PR_ALIGN_OF_INT
20829N/A+#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
20829N/A+#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
20829N/A+#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
20829N/A+#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
20829N/A+#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
20829N/A+#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
20829N/A+
20829N/A+#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
20829N/A+#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
20829N/A+#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
20829N/A+
20829N/A+#endif /* NO_NSPR_10_SUPPORT */
20829N/A+
20829N/A+#endif /* ifndef nspr_cpucfg___ */
20829N/Adiff --git a/ipc/chromium/src/third_party/libevent/solaris/config.h b/ipc/chromium/src/third_party/libevent/solaris/config.h
20829N/Anew file mode 100644
20829N/Aindex 0000000..2e2a78a
20829N/A--- /dev/null
20829N/A+++ b/ipc/chromium/src/third_party/libevent/solaris/config.h
20829N/A@@ -0,0 +1,254 @@
20829N/A+/* config.h. Generated from config.h.in by configure. */
20829N/A+/* config.h.in. Generated from configure.in by autoheader. */
20829N/A+
20829N/A+/* Define if clock_gettime is available in libc */
20829N/A+#define DNS_USE_CPU_CLOCK_FOR_ID 1
20829N/A+
20829N/A+/* Define is no secure id variant is available */
20829N/A+/* #undef DNS_USE_GETTIMEOFDAY_FOR_ID */
20829N/A+
20829N/A+/* Define to 1 if you have the `clock_gettime' function. */
20829N/A+#define HAVE_CLOCK_GETTIME 1
20829N/A+
20829N/A+/* Define if /dev/poll is available */
20829N/A+#define HAVE_DEVPOLL 1
20829N/A+
20829N/A+/* Define to 1 if you have the <dlfcn.h> header file. */
20829N/A+#define HAVE_DLFCN_H 1
20829N/A+
20829N/A+/* Define if your system supports the epoll system calls */
20829N/A+/* #undef HAVE_EPOLL */
20829N/A+
20829N/A+/* Define to 1 if you have the `epoll_ctl' function. */
20829N/A+/* #undef HAVE_EPOLL_CTL */
20829N/A+
20829N/A+/* Define if your system supports event ports */
20829N/A+#define HAVE_EVENT_PORTS 1
20829N/A+
20829N/A+/* Define to 1 if you have the `fcntl' function. */
20829N/A+#define HAVE_FCNTL 1
20829N/A+
20829N/A+/* Define to 1 if you have the <fcntl.h> header file. */
20829N/A+#define HAVE_FCNTL_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the `getaddrinfo' function. */
20829N/A+#define HAVE_GETADDRINFO 1
20829N/A+
20829N/A+/* Define to 1 if you have the `getnameinfo' function. */
20829N/A+#define HAVE_GETNAMEINFO 1
20829N/A+
20829N/A+/* Define to 1 if you have the `gettimeofday' function. */
20829N/A+#define HAVE_GETTIMEOFDAY 1
20829N/A+
20829N/A+/* Define to 1 if you have the `inet_ntop' function. */
20829N/A+#define HAVE_INET_NTOP 1
20829N/A+
20829N/A+/* Define to 1 if you have the <inttypes.h> header file. */
20829N/A+#define HAVE_INTTYPES_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the `kqueue' function. */
20829N/A+/* #undef HAVE_KQUEUE */
20829N/A+
20829N/A+/* Define to 1 if you have the `nsl' library (-lnsl). */
20829N/A+#define HAVE_LIBNSL 1
20829N/A+
20829N/A+/* Define to 1 if you have the `resolv' library (-lresolv). */
20829N/A+#define HAVE_LIBRESOLV 1
20829N/A+
20829N/A+/* Define to 1 if you have the `rt' library (-lrt). */
20829N/A+#define HAVE_LIBRT 1
20829N/A+
20829N/A+/* Define to 1 if you have the `socket' library (-lsocket). */
20829N/A+#define HAVE_LIBSOCKET 1
20829N/A+
20829N/A+/* Define to 1 if you have the <memory.h> header file. */
20829N/A+#define HAVE_MEMORY_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <netinet/in6.h> header file. */
20829N/A+/* #undef HAVE_NETINET_IN6_H */
20829N/A+
20829N/A+/* Define to 1 if you have the `poll' function. */
20829N/A+#define HAVE_POLL 1
20829N/A+
20829N/A+/* Define to 1 if you have the <poll.h> header file. */
20829N/A+#define HAVE_POLL_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the `port_create' function. */
20829N/A+#define HAVE_PORT_CREATE 1
20829N/A+
20829N/A+/* Define to 1 if you have the <port.h> header file. */
20829N/A+#define HAVE_PORT_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the `select' function. */
20829N/A+#define HAVE_SELECT 1
20829N/A+
20829N/A+/* Define if F_SETFD is defined in <fcntl.h> */
20829N/A+#define HAVE_SETFD 1
20829N/A+
20829N/A+/* Define to 1 if you have the `sigaction' function. */
20829N/A+#define HAVE_SIGACTION 1
20829N/A+
20829N/A+/* Define to 1 if you have the `signal' function. */
20829N/A+#define HAVE_SIGNAL 1
20829N/A+
20829N/A+/* Define to 1 if you have the <signal.h> header file. */
20829N/A+#define HAVE_SIGNAL_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <stdarg.h> header file. */
20829N/A+#define HAVE_STDARG_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <stdint.h> header file. */
20829N/A+#define HAVE_STDINT_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <stdlib.h> header file. */
20829N/A+#define HAVE_STDLIB_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <strings.h> header file. */
20829N/A+#define HAVE_STRINGS_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <string.h> header file. */
20829N/A+#define HAVE_STRING_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the `strlcpy' function. */
20829N/A+#define HAVE_STRLCPY 1
20829N/A+
20829N/A+/* Define to 1 if you have the `strsep' function. */
20829N/A+#define HAVE_STRSEP 1
20829N/A+
20829N/A+/* Define to 1 if you have the `strtok_r' function. */
20829N/A+#define HAVE_STRTOK_R 1
20829N/A+
20829N/A+/* Define to 1 if you have the `strtoll' function. */
20829N/A+#define HAVE_STRTOLL 1
20829N/A+
20829N/A+/* Define to 1 if the system has the type `struct in6_addr'. */
20829N/A+#define HAVE_STRUCT_IN6_ADDR 1
20829N/A+
20829N/A+/* Define to 1 if you have the <sys/devpoll.h> header file. */
20829N/A+#define HAVE_SYS_DEVPOLL_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <sys/epoll.h> header file. */
20829N/A+/* #undef HAVE_SYS_EPOLL_H */
20829N/A+
20829N/A+/* Define to 1 if you have the <sys/event.h> header file. */
20829N/A+/* #undef HAVE_SYS_EVENT_H */
20829N/A+
20829N/A+/* Define to 1 if you have the <sys/ioctl.h> header file. */
20829N/A+#define HAVE_SYS_IOCTL_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <sys/param.h> header file. */
20829N/A+#define HAVE_SYS_PARAM_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <sys/queue.h> header file. */
20829N/A+#define HAVE_SYS_QUEUE_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <sys/select.h> header file. */
20829N/A+#define HAVE_SYS_SELECT_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <sys/socket.h> header file. */
20829N/A+#define HAVE_SYS_SOCKET_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <sys/stat.h> header file. */
20829N/A+#define HAVE_SYS_STAT_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <sys/time.h> header file. */
20829N/A+#define HAVE_SYS_TIME_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the <sys/types.h> header file. */
20829N/A+#define HAVE_SYS_TYPES_H 1
20829N/A+
20829N/A+/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
20829N/A+#define HAVE_TAILQFOREACH 1
20829N/A+
20829N/A+/* Define if timeradd is defined in <sys/time.h> */
20829N/A+#define HAVE_TIMERADD 1
20829N/A+
20829N/A+/* Define if timerclear is defined in <sys/time.h> */
20829N/A+#define HAVE_TIMERCLEAR 1
20829N/A+
20829N/A+/* Define if timercmp is defined in <sys/time.h> */
20829N/A+#define HAVE_TIMERCMP 1
20829N/A+
20829N/A+/* Define if timerisset is defined in <sys/time.h> */
20829N/A+#define HAVE_TIMERISSET 1
20829N/A+
20829N/A+/* Define to 1 if the system has the type `uint16_t'. */
20829N/A+#define HAVE_UINT16_T 1
20829N/A+
20829N/A+/* Define to 1 if the system has the type `uint32_t'. */
20829N/A+#define HAVE_UINT32_T 1
20829N/A+
20829N/A+/* Define to 1 if the system has the type `uint64_t'. */
20829N/A+#define HAVE_UINT64_T 1
20829N/A+
20829N/A+/* Define to 1 if the system has the type `uint8_t'. */
20829N/A+#define HAVE_UINT8_T 1
20829N/A+
20829N/A+/* Define to 1 if you have the <unistd.h> header file. */
20829N/A+#define HAVE_UNISTD_H 1
20829N/A+
20829N/A+/* Define to 1 if you have the `vasprintf' function. */
20829N/A+#define HAVE_VASPRINTF 1
20829N/A+
20829N/A+/* Define if kqueue works correctly with pipes */
20829N/A+/* #undef HAVE_WORKING_KQUEUE */
20829N/A+
20829N/A+/* Name of package */
20829N/A+#define PACKAGE "libevent"
20829N/A+
20829N/A+/* Define to the address where bug reports for this package should be sent. */
20829N/A+#define PACKAGE_BUGREPORT ""
20829N/A+
20829N/A+/* Define to the full name of this package. */
20829N/A+#define PACKAGE_NAME ""
20829N/A+
20829N/A+/* Define to the full name and version of this package. */
20829N/A+#define PACKAGE_STRING ""
20829N/A+
20829N/A+/* Define to the one symbol short name of this package. */
20829N/A+#define PACKAGE_TARNAME ""
20829N/A+
20829N/A+/* Define to the version of this package. */
20829N/A+#define PACKAGE_VERSION ""
20829N/A+
20829N/A+/* The size of `int', as computed by sizeof. */
20829N/A+#define SIZEOF_INT 4
20829N/A+
20829N/A+/* The size of `long', as computed by sizeof. */
20829N/A+#define SIZEOF_LONG 4
20829N/A+
20829N/A+/* The size of `long long', as computed by sizeof. */
20829N/A+#define SIZEOF_LONG_LONG 8
20829N/A+
20829N/A+/* The size of `short', as computed by sizeof. */
20829N/A+#define SIZEOF_SHORT 2
20829N/A+
20829N/A+/* Define to 1 if you have the ANSI C header files. */
20829N/A+#define STDC_HEADERS 1
20829N/A+
20829N/A+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
20829N/A+#define TIME_WITH_SYS_TIME 1
20829N/A+
20829N/A+/* Version number of package */
20829N/A+#define VERSION "1.4.7-stable"
20829N/A+
20829N/A+/* Define to appropriate substitue if compiler doesnt have __func__ */
20829N/A+/* #undef __func__ */
20829N/A+
20829N/A+/* Define to empty if `const' does not conform to ANSI C. */
20829N/A+/* #undef const */
20829N/A+
20829N/A+/* Define to `__inline__' or `__inline' if that's what the C compiler
20829N/A+ calls it, or to nothing if 'inline' is not supported under any name. */
20829N/A+#ifndef __cplusplus
20829N/A+/* #undef inline */
20829N/A+#endif
20829N/A+
20829N/A+/* Define to `int' if <sys/types.h> does not define. */
20829N/A+/* #undef pid_t */
20829N/A+
20829N/A+/* Define to `unsigned int' if <sys/types.h> does not define. */
20829N/A+/* #undef size_t */
20829N/A+
20829N/A+/* Define to unsigned int if you dont have it */
20829N/A+/* #undef socklen_t */