PR pkg/48840: Don't assume cocoa toolkit just because OS_ARCH is Darwin
This commit is contained in:
parent
03e83630d2
commit
9b2f37cfe2
7 changed files with 518 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: distinfo,v 1.146 2014/05/28 07:18:28 pho Exp $
|
||||
$NetBSD: distinfo,v 1.147 2014/05/28 10:08:18 pho Exp $
|
||||
|
||||
SHA1 (firefox-29.0.1.source.tar.bz2) = 2819ef63403de2bcfff5496bd21a3b8cb5dfce82
|
||||
RMD160 (firefox-29.0.1.source.tar.bz2) = f728179a12a46824971ca01cf79eb0318e4775c5
|
||||
|
@ -48,6 +48,9 @@ SHA1 (patch-content_svg_content_src_nsSVGFilters.cpp) = ed8810687e5f5b60b64c5128
|
|||
SHA1 (patch-content_svg_content_src_nsSVGFilters.h) = 37ead5c8f14551d843be8bc09be254175b38b4d7
|
||||
SHA1 (patch-dom_indexedDB_IDBEvents.cpp) = 4b3c649fe0119b8b883cd4bcf25a594510096d50
|
||||
SHA1 (patch-dom_indexedDB_IDBEvents.h) = 7558cd531ae408736e38efa2fdbff218e2d2124f
|
||||
SHA1 (patch-dom_plugins_base_npapi.h) = f0c9fa4ffbd6589afef70b69b08f1c03daa55676
|
||||
SHA1 (patch-dom_plugins_base_npfunctions.h) = 2ebb18a7d33ec035fc30e0bcd9af8b12958e6485
|
||||
SHA1 (patch-dom_plugins_ipc_PluginMessageUtils.h) = 66d653b2d765c74dba738e2f9a7b9f6aab44b465
|
||||
SHA1 (patch-dom_plugins_ipc_PluginModuleChild.cpp) = 69b0a51d733cd52e7d200052362e0faf4ec918f1
|
||||
SHA1 (patch-dom_plugins_ipc_PluginModuleChild.h) = 0a7f3167e939822013ae6195406657453578453e
|
||||
SHA1 (patch-dom_system_OSFileConstants.cpp) = 6c45e3d5fa3369432ff59871a8cbc6176f297794
|
||||
|
@ -63,6 +66,7 @@ SHA1 (patch-image_decoders_nsJPEGDecoder.cpp) = e5df11499b1ec14e1d4c9a1408c0611d
|
|||
SHA1 (patch-intl_hyphenation_src_hnjalloc.h) = 7fcc7b0fcf5a33486214197e925fbc8e6e22e2ee
|
||||
SHA1 (patch-intl_unicharutil_util_Makefile.in) = c8f37cc420ba26b63c66fbbf69b13a8b4fea43fc
|
||||
SHA1 (patch-ipc_chromium_Makefile.in) = 3a1f5b218217fc8e5e9a07195054618071c38059
|
||||
SHA1 (patch-ipc_chromium_moz.build) = de12255865e45cfdf0f7dc57ce101be75ac8ad54
|
||||
SHA1 (patch-ipc_chromium_src_base_base__paths.h) = 7bc83577a9678542db4dff7dda19d751ff6d78c1
|
||||
SHA1 (patch-ipc_chromium_src_base_debug__util__posix.cc) = 677f0b5ccdcde7a8551f2d07d2a472361a5da03f
|
||||
SHA1 (patch-ipc_chromium_src_base_file__util.h) = 9d6d074b1692c6b4e722bfac8d67c66040a6fa76
|
||||
|
@ -71,6 +75,7 @@ SHA1 (patch-ipc_chromium_src_base_message__pump__libevent.cc) = 12f3e063cf3fef23
|
|||
SHA1 (patch-ipc_chromium_src_base_platform__thread.h) = e6d7ac39a8b2a1b232638f7671e8530acfed0b97
|
||||
SHA1 (patch-ipc_chromium_src_base_platform__thread__posix.cc) = e386bfd56ae6f77ef1aaadd0fa81af147a09f75d
|
||||
SHA1 (patch-ipc_chromium_src_base_process__util.h) = 31b592d69d3c4f63642dae3c81c771ee3dfa8502
|
||||
SHA1 (patch-ipc_chromium_src_base_process__util__bsd.cc) = 4f05fce050796f86b5aedf910eb709c9969fa982
|
||||
SHA1 (patch-ipc_chromium_src_base_process__util__posix.cc) = 6b2611cc902f17e726aabcf4fb5fff2c71852408
|
||||
SHA1 (patch-ipc_chromium_src_base_sys__info__posix.cc) = 27890c56194e483fc0758ed767ca5795cc5112eb
|
||||
SHA1 (patch-ipc_chromium_src_base_time__posix.cc) = 337a0b4a5d51d68c7699b79c7591b953ea23ca67
|
||||
|
@ -106,6 +111,7 @@ SHA1 (patch-memory_mozalloc_mozalloc__abort.cpp) = 9d9036ddd28c7b8ce37860e0120df
|
|||
SHA1 (patch-mfbt_Poison.cpp) = b582943c02f57835451c9eecd004c9912d42ce84
|
||||
SHA1 (patch-modules_libjar_nsZipArchive.cpp) = 6aff0f8ed42575d8ca36a524e12e9a1f7351004a
|
||||
SHA1 (patch-netwerk_dns_Makefile.in) = b6bd9814d909dd6f7cff10dbeac3bedd79c2508e
|
||||
SHA1 (patch-netwerk_protocol_http_nsHttpHandler.cpp) = 517cf1ac41a06ce1d02c7e1a6c5e74a983307dd6
|
||||
SHA1 (patch-netwerk_sctp_src_netinet6_sctp6__usrreq.c) = 31d49db31b1e130f1b455f883e5b7c606d438771
|
||||
SHA1 (patch-netwerk_sctp_src_netinet_sctp__os__userspace.h) = b3f94ac0f2bd652371fef22c642b14bf30162998
|
||||
SHA1 (patch-netwerk_sctp_src_netinet_sctp__usrreq.c) = 421b6e071a9934567ccba337033a42208e6e4bd5
|
||||
|
|
132
www/firefox/patches/patch-dom_plugins_base_npapi.h
Normal file
132
www/firefox/patches/patch-dom_plugins_base_npapi.h
Normal file
|
@ -0,0 +1,132 @@
|
|||
$NetBSD: patch-dom_plugins_base_npapi.h,v 1.1 2014/05/28 10:08:18 pho Exp $
|
||||
|
||||
Don't assume cocoa toolkit just because OS_ARCH is Darwin.
|
||||
|
||||
--- dom/plugins/base/npapi.h.orig 2014-05-06 22:55:25.000000000 +0000
|
||||
+++ dom/plugins/base/npapi.h
|
||||
@@ -43,7 +43,7 @@
|
||||
#define NP_NO_CARBON
|
||||
#endif
|
||||
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#ifndef NP_NO_CARBON
|
||||
@@ -128,7 +128,7 @@ typedef char* NPMIMEType;
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#if !defined(__LP64__)
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
#pragma options align=mac68k
|
||||
#endif
|
||||
#endif /* __LP64__ */
|
||||
@@ -269,7 +269,7 @@ typedef struct
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
typedef enum {
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
#ifndef NP_NO_QUICKDRAW
|
||||
NPDrawingModelQuickDraw = 0,
|
||||
#endif
|
||||
@@ -290,7 +290,7 @@ typedef enum {
|
||||
#endif
|
||||
} NPDrawingModel;
|
||||
|
||||
-#ifdef XP_MACOSX
|
||||
+#ifdef MOZ_WIDGET_COCOA
|
||||
typedef enum {
|
||||
#ifndef NP_NO_CARBON
|
||||
NPEventModelCarbon = 0,
|
||||
@@ -379,7 +379,7 @@ typedef enum {
|
||||
|
||||
/* Used for negotiating drawing models */
|
||||
NPPVpluginDrawingModel = 1000
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
/* Used for negotiating event models */
|
||||
, NPPVpluginEventModel = 1001
|
||||
/* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */
|
||||
@@ -420,7 +420,7 @@ typedef enum {
|
||||
NPNVdocumentOrigin = 22,
|
||||
|
||||
NPNVpluginDrawingModel = 1000 /* Get the current drawing model (NPDrawingModel) */
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
, NPNVcontentsScaleFactor = 1001
|
||||
#ifndef NP_NO_QUICKDRAW
|
||||
, NPNVsupportsQuickDrawBool = 2000
|
||||
@@ -434,7 +434,7 @@ typedef enum {
|
||||
#if defined(XP_WIN)
|
||||
, NPNVsupportsAsyncWindowsDXGISurfaceBool = 2008
|
||||
#endif
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
#ifndef NP_NO_CARBON
|
||||
, NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
|
||||
#endif
|
||||
@@ -478,7 +478,7 @@ typedef struct _NPWindow
|
||||
uint32_t width; /* Maximum window size */
|
||||
uint32_t height;
|
||||
NPRect clipRect; /* Clipping rectangle in port coordinates */
|
||||
-#if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX)
|
||||
+#if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(MOZ_WIDGET_COCOA)
|
||||
void * ws_info; /* Platform-dependent additional data */
|
||||
#endif /* XP_UNIX */
|
||||
NPWindowType type; /* Is this a window or a drawable? */
|
||||
@@ -524,7 +524,7 @@ typedef struct _NPPrint
|
||||
} print;
|
||||
} NPPrint;
|
||||
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
#ifndef NP_NO_CARBON
|
||||
typedef EventRecord NPEvent;
|
||||
#endif
|
||||
@@ -550,7 +550,7 @@ typedef XEvent NPEvent;
|
||||
typedef void* NPEvent;
|
||||
#endif
|
||||
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
typedef void* NPRegion;
|
||||
#ifndef NP_NO_QUICKDRAW
|
||||
typedef RgnHandle NPQDRegion;
|
||||
@@ -570,7 +570,7 @@ typedef struct _NPNSString NPNSString;
|
||||
typedef struct _NPNSWindow NPNSWindow;
|
||||
typedef struct _NPNSMenu NPNSMenu;
|
||||
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
typedef NPNSMenu NPMenu;
|
||||
#else
|
||||
typedef void *NPMenu;
|
||||
@@ -584,7 +584,7 @@ typedef enum {
|
||||
NPCoordinateSpaceFlippedScreen
|
||||
} NPCoordinateSpace;
|
||||
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
|
||||
#ifndef NP_NO_QUICKDRAW
|
||||
typedef struct NP_Port
|
||||
@@ -688,7 +688,7 @@ enum NPEventType {
|
||||
};
|
||||
#endif /* NP_NO_CARBON */
|
||||
|
||||
-#endif /* XP_MACOSX */
|
||||
+#endif /* MOZ_WIDGET_COCOA */
|
||||
|
||||
/*
|
||||
* Values for mode passed to NPP_New:
|
||||
@@ -713,7 +713,7 @@ enum NPEventType {
|
||||
#define NP_CLEAR_CACHE (1 << 0)
|
||||
|
||||
#if !defined(__LP64__)
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
#pragma options align=reset
|
||||
#endif
|
||||
#endif /* __LP64__ */
|
24
www/firefox/patches/patch-dom_plugins_base_npfunctions.h
Normal file
24
www/firefox/patches/patch-dom_plugins_base_npfunctions.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
$NetBSD: patch-dom_plugins_base_npfunctions.h,v 1.1 2014/05/28 10:08:18 pho Exp $
|
||||
|
||||
Don't assume cocoa toolkit just because OS_ARCH is Darwin.
|
||||
|
||||
--- dom/plugins/base/npfunctions.h.orig 2014-05-06 22:55:25.000000000 +0000
|
||||
+++ dom/plugins/base/npfunctions.h
|
||||
@@ -191,7 +191,7 @@ typedef struct _NPNetscapeFuncs {
|
||||
NPN_SetCurrentAsyncSurfacePtr setcurrentasyncsurface;
|
||||
} NPNetscapeFuncs;
|
||||
|
||||
-#ifdef XP_MACOSX
|
||||
+#ifdef MOZ_WIDGET_COCOA
|
||||
/*
|
||||
* Mac OS X version(s) of NP_GetMIMEDescription(const char *)
|
||||
* These can be called to retreive MIME information from the plugin dynamically
|
||||
@@ -281,7 +281,7 @@ typedef char* (*NP_GetPluginVer
|
||||
NP_EXPORT(char*) NP_GetPluginVersion(void);
|
||||
typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
|
||||
NP_EXPORT(const char*) NP_GetMIMEDescription(void);
|
||||
-#ifdef XP_MACOSX
|
||||
+#ifdef MOZ_WIDGET_COCOA
|
||||
typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*);
|
||||
NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs);
|
||||
typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
|
138
www/firefox/patches/patch-dom_plugins_ipc_PluginMessageUtils.h
Normal file
138
www/firefox/patches/patch-dom_plugins_ipc_PluginMessageUtils.h
Normal file
|
@ -0,0 +1,138 @@
|
|||
$NetBSD: patch-dom_plugins_ipc_PluginMessageUtils.h,v 1.1 2014/05/28 10:08:18 pho Exp $
|
||||
|
||||
Don't assume cocoa toolkit just because OS_ARCH is Darwin.
|
||||
|
||||
--- dom/plugins/ipc/PluginMessageUtils.h.orig 2014-05-06 22:55:25.000000000 +0000
|
||||
+++ dom/plugins/ipc/PluginMessageUtils.h
|
||||
@@ -25,7 +25,7 @@
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
# include "nsExceptionHandler.h"
|
||||
#endif
|
||||
-#ifdef XP_MACOSX
|
||||
+#ifdef MOZ_WIDGET_COCOA
|
||||
#include "PluginInterposeOSX.h"
|
||||
#else
|
||||
namespace mac_plugin_interposing { class NSCursorInfo { }; }
|
||||
@@ -99,14 +99,14 @@ struct NPRemoteWindow
|
||||
uint32_t height;
|
||||
NPRect clipRect;
|
||||
NPWindowType type;
|
||||
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
+#if defined(MOZ_X11) && defined(XP_UNIX)
|
||||
VisualID visualID;
|
||||
Colormap colormap;
|
||||
#endif /* XP_UNIX */
|
||||
#if defined(XP_WIN)
|
||||
base::SharedMemoryHandle surfaceHandle;
|
||||
#endif
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
double contentsScaleFactor;
|
||||
#endif
|
||||
};
|
||||
@@ -115,7 +115,7 @@ struct NPRemoteWindow
|
||||
typedef HWND NativeWindowHandle;
|
||||
#elif defined(MOZ_X11)
|
||||
typedef XID NativeWindowHandle;
|
||||
-#elif defined(XP_MACOSX) || defined(ANDROID) || defined(MOZ_WIDGET_QT)
|
||||
+#elif defined(MOZ_WIDGET_COCOA) || defined(ANDROID) || defined(MOZ_WIDGET_QT)
|
||||
typedef intptr_t NativeWindowHandle; // never actually used, will always be 0
|
||||
#else
|
||||
#error Need NativeWindowHandle for this platform
|
||||
@@ -160,7 +160,7 @@ NPPVariableToString(NPPVariable aVar)
|
||||
|
||||
VARSTR(NPPVpluginWantsAllNetworkStreams);
|
||||
|
||||
-#ifdef XP_MACOSX
|
||||
+#ifdef MOZ_WIDGET_COCOA
|
||||
VARSTR(NPPVpluginDrawingModel);
|
||||
VARSTR(NPPVpluginEventModel);
|
||||
#endif
|
||||
@@ -377,14 +377,14 @@ struct ParamTraits<mozilla::plugins::NPR
|
||||
WriteParam(aMsg, aParam.height);
|
||||
WriteParam(aMsg, aParam.clipRect);
|
||||
WriteParam(aMsg, aParam.type);
|
||||
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
+#if defined(MOZ_X11) && defined(XP_UNIX)
|
||||
aMsg->WriteULong(aParam.visualID);
|
||||
aMsg->WriteULong(aParam.colormap);
|
||||
#endif
|
||||
#if defined(XP_WIN)
|
||||
WriteParam(aMsg, aParam.surfaceHandle);
|
||||
#endif
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
aMsg->WriteDouble(aParam.contentsScaleFactor);
|
||||
#endif
|
||||
}
|
||||
@@ -405,7 +405,7 @@ struct ParamTraits<mozilla::plugins::NPR
|
||||
ReadParam(aMsg, aIter, &type)))
|
||||
return false;
|
||||
|
||||
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
+#if defined(MOZ_X11) && defined(XP_UNIX)
|
||||
unsigned long visualID;
|
||||
unsigned long colormap;
|
||||
if (!(aMsg->ReadULong(aIter, &visualID) &&
|
||||
@@ -419,7 +419,7 @@ struct ParamTraits<mozilla::plugins::NPR
|
||||
return false;
|
||||
#endif
|
||||
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
double contentsScaleFactor;
|
||||
if (!aMsg->ReadDouble(aIter, &contentsScaleFactor))
|
||||
return false;
|
||||
@@ -432,14 +432,14 @@ struct ParamTraits<mozilla::plugins::NPR
|
||||
aResult->height = height;
|
||||
aResult->clipRect = clipRect;
|
||||
aResult->type = type;
|
||||
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
+#if defined(MOZ_X11) && defined(XP_UNIX)
|
||||
aResult->visualID = visualID;
|
||||
aResult->colormap = colormap;
|
||||
#endif
|
||||
#if defined(XP_WIN)
|
||||
aResult->surfaceHandle = surfaceHandle;
|
||||
#endif
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
aResult->contentsScaleFactor = contentsScaleFactor;
|
||||
#endif
|
||||
return true;
|
||||
@@ -492,7 +492,7 @@ struct ParamTraits<NPString>
|
||||
}
|
||||
};
|
||||
|
||||
-#ifdef XP_MACOSX
|
||||
+#ifdef MOZ_WIDGET_COCOA
|
||||
template <>
|
||||
struct ParamTraits<NPNSString*>
|
||||
{
|
||||
@@ -563,7 +563,7 @@ struct ParamTraits<NPNSString*>
|
||||
};
|
||||
#endif
|
||||
|
||||
-#ifdef XP_MACOSX
|
||||
+#ifdef MOZ_WIDGET_COCOA
|
||||
template <>
|
||||
struct ParamTraits<NSCursorInfo>
|
||||
{
|
||||
@@ -655,7 +655,7 @@ struct ParamTraits<NSCursorInfo>
|
||||
return false;
|
||||
}
|
||||
};
|
||||
-#endif // #ifdef XP_MACOSX
|
||||
+#endif // #ifdef MOZ_WIDGET_COCOA
|
||||
|
||||
template <>
|
||||
struct ParamTraits<NPVariant>
|
||||
@@ -900,7 +900,7 @@ struct ParamTraits<NPCoordinateSpace>
|
||||
//
|
||||
// NB: these guards are based on those where struct NPEvent is defined
|
||||
// in npapi.h. They should be kept in sync.
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
# include "mozilla/plugins/NPEventOSX.h"
|
||||
#elif defined(XP_WIN)
|
||||
# include "mozilla/plugins/NPEventWindows.h"
|
18
www/firefox/patches/patch-ipc_chromium_moz.build
Normal file
18
www/firefox/patches/patch-ipc_chromium_moz.build
Normal file
|
@ -0,0 +1,18 @@
|
|||
$NetBSD: patch-ipc_chromium_moz.build,v 1.1 2014/05/28 10:08:18 pho Exp $
|
||||
|
||||
Don't assume cocoa toolkit just because OS_ARCH is Darwin.
|
||||
|
||||
--- ipc/chromium/moz.build.orig 2014-05-06 22:55:41.000000000 +0000
|
||||
+++ ipc/chromium/moz.build
|
||||
@@ -19,7 +19,10 @@ if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
else:
|
||||
os_posix = 1
|
||||
if CONFIG['OS_ARCH'] == 'Darwin':
|
||||
- os_macosx = 1
|
||||
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
+ os_macosx = 1
|
||||
+ else:
|
||||
+ os_bsd = 1
|
||||
elif CONFIG['OS_ARCH'] == 'DragonFly':
|
||||
os_dragonfly = 1
|
||||
os_bsd = 1
|
|
@ -0,0 +1,166 @@
|
|||
$NetBSD: patch-ipc_chromium_src_base_process__util__bsd.cc,v 1.1 2014/05/28 10:08:18 pho Exp $
|
||||
|
||||
Darwin does not provide kvm_getprocs(3). The code for OS_MACOSX is
|
||||
simply copied from process_util_mac.mm
|
||||
|
||||
--- ipc/chromium/src/base/process_util_bsd.cc.orig 2014-05-06 22:55:41.000000000 +0000
|
||||
+++ ipc/chromium/src/base/process_util_bsd.cc
|
||||
@@ -15,7 +15,9 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
+#if defined(OS_BSD)
|
||||
#include <kvm.h>
|
||||
+#endif
|
||||
#include <unistd.h>
|
||||
|
||||
#include <string>
|
||||
@@ -311,6 +313,141 @@ void SetCurrentProcessPrivileges(ChildPr
|
||||
|
||||
#endif
|
||||
|
||||
+#if defined(OS_MACOSX)
|
||||
+NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name,
|
||||
+ const ProcessFilter* filter)
|
||||
+ : executable_name_(executable_name),
|
||||
+ index_of_kinfo_proc_(0),
|
||||
+ filter_(filter) {
|
||||
+ // Get a snapshot of all of my processes (yes, as we loop it can go stale, but
|
||||
+ // but trying to find where we were in a constantly changing list is basically
|
||||
+ // impossible.
|
||||
+
|
||||
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, int(geteuid()) };
|
||||
+
|
||||
+ // Since more processes could start between when we get the size and when
|
||||
+ // we get the list, we do a loop to keep trying until we get it.
|
||||
+ bool done = false;
|
||||
+ int try_num = 1;
|
||||
+ const int max_tries = 10;
|
||||
+ do {
|
||||
+ // Get the size of the buffer
|
||||
+ size_t len = 0;
|
||||
+ if (sysctl(mib, arraysize(mib), NULL, &len, NULL, 0) < 0) {
|
||||
+ CHROMIUM_LOG(ERROR) << "failed to get the size needed for the process list";
|
||||
+ kinfo_procs_.resize(0);
|
||||
+ done = true;
|
||||
+ } else {
|
||||
+ size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
|
||||
+ // Leave some spare room for process table growth (more could show up
|
||||
+ // between when we check and now)
|
||||
+ num_of_kinfo_proc += 4;
|
||||
+ kinfo_procs_.resize(num_of_kinfo_proc);
|
||||
+ len = num_of_kinfo_proc * sizeof(struct kinfo_proc);
|
||||
+ // Load the list of processes
|
||||
+ if (sysctl(mib, arraysize(mib), &kinfo_procs_[0], &len, NULL, 0) < 0) {
|
||||
+ // If we get a mem error, it just means we need a bigger buffer, so
|
||||
+ // loop around again. Anything else is a real error and give up.
|
||||
+ if (errno != ENOMEM) {
|
||||
+ CHROMIUM_LOG(ERROR) << "failed to get the process list";
|
||||
+ kinfo_procs_.resize(0);
|
||||
+ done = true;
|
||||
+ }
|
||||
+ } else {
|
||||
+ // Got the list, just make sure we're sized exactly right
|
||||
+ size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
|
||||
+ kinfo_procs_.resize(num_of_kinfo_proc);
|
||||
+ done = true;
|
||||
+ }
|
||||
+ }
|
||||
+ } while (!done && (try_num++ < max_tries));
|
||||
+
|
||||
+ if (!done) {
|
||||
+ CHROMIUM_LOG(ERROR) << "failed to collect the process list in a few tries";
|
||||
+ kinfo_procs_.resize(0);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+NamedProcessIterator::~NamedProcessIterator() {
|
||||
+}
|
||||
+
|
||||
+const ProcessEntry* NamedProcessIterator::NextProcessEntry() {
|
||||
+ bool result = false;
|
||||
+ do {
|
||||
+ result = CheckForNextProcess();
|
||||
+ } while (result && !IncludeEntry());
|
||||
+
|
||||
+ if (result) {
|
||||
+ return &entry_;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+bool NamedProcessIterator::CheckForNextProcess() {
|
||||
+ std::string executable_name_utf8(WideToUTF8(executable_name_));
|
||||
+
|
||||
+ std::string data;
|
||||
+ std::string exec_name;
|
||||
+
|
||||
+ for (; index_of_kinfo_proc_ < kinfo_procs_.size(); ++index_of_kinfo_proc_) {
|
||||
+ kinfo_proc* kinfo = &kinfo_procs_[index_of_kinfo_proc_];
|
||||
+
|
||||
+ // Skip processes just awaiting collection
|
||||
+ if ((kinfo->kp_proc.p_pid > 0) && (kinfo->kp_proc.p_stat == SZOMB))
|
||||
+ continue;
|
||||
+
|
||||
+ int mib[] = { CTL_KERN, KERN_PROCARGS, kinfo->kp_proc.p_pid };
|
||||
+
|
||||
+ // Found out what size buffer we need
|
||||
+ size_t data_len = 0;
|
||||
+ if (sysctl(mib, arraysize(mib), NULL, &data_len, NULL, 0) < 0) {
|
||||
+ CHROMIUM_LOG(ERROR) << "failed to figure out the buffer size for a commandline";
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ data.resize(data_len);
|
||||
+ if (sysctl(mib, arraysize(mib), &data[0], &data_len, NULL, 0) < 0) {
|
||||
+ CHROMIUM_LOG(ERROR) << "failed to fetch a commandline";
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // Data starts w/ the full path null termed, so we have to extract just the
|
||||
+ // executable name from the path.
|
||||
+
|
||||
+ size_t exec_name_end = data.find('\0');
|
||||
+ if (exec_name_end == std::string::npos) {
|
||||
+ CHROMIUM_LOG(ERROR) << "command line data didn't match expected format";
|
||||
+ continue;
|
||||
+ }
|
||||
+ size_t last_slash = data.rfind('/', exec_name_end);
|
||||
+ if (last_slash == std::string::npos)
|
||||
+ exec_name = data.substr(0, exec_name_end);
|
||||
+ else
|
||||
+ exec_name = data.substr(last_slash + 1, exec_name_end - last_slash - 1);
|
||||
+
|
||||
+ // Check the name
|
||||
+ if (executable_name_utf8 == exec_name) {
|
||||
+ entry_.pid = kinfo->kp_proc.p_pid;
|
||||
+ entry_.ppid = kinfo->kp_eproc.e_ppid;
|
||||
+ base::strlcpy(entry_.szExeFile, exec_name.c_str(),
|
||||
+ sizeof(entry_.szExeFile));
|
||||
+ // Start w/ the next entry next time through
|
||||
+ ++index_of_kinfo_proc_;
|
||||
+ // Done
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+bool NamedProcessIterator::IncludeEntry() {
|
||||
+ // Don't need to check the name, we did that w/in CheckForNextProcess.
|
||||
+ if (!filter_)
|
||||
+ return true;
|
||||
+ return filter_->Includes(entry_.pid, entry_.ppid);
|
||||
+}
|
||||
+#else
|
||||
NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name,
|
||||
const ProcessFilter* filter)
|
||||
{
|
||||
@@ -370,5 +507,6 @@ const ProcessEntry* NamedProcessIterator
|
||||
if (nextEntry >= content.size()) return NULL;
|
||||
return &content[nextEntry++];
|
||||
}
|
||||
+#endif
|
||||
|
||||
} // namespace base
|
|
@ -0,0 +1,33 @@
|
|||
$NetBSD: patch-netwerk_protocol_http_nsHttpHandler.cpp,v 1.1 2014/05/28 10:08:18 pho Exp $
|
||||
|
||||
nsCocoaFeatures is only available when the toolkit is cocoa.
|
||||
|
||||
--- netwerk/protocol/http/nsHttpHandler.cpp.orig 2014-05-06 22:56:20.000000000 +0000
|
||||
+++ netwerk/protocol/http/nsHttpHandler.cpp
|
||||
@@ -57,7 +57,7 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
-#if defined(XP_MACOSX)
|
||||
+#if defined(MOZ_WIDGET_COCOA)
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include "nsCocoaFeatures.h"
|
||||
#endif
|
||||
@@ -671,7 +671,7 @@ nsHttpHandler::InitUserAgentComponents()
|
||||
"OS/2"
|
||||
#elif defined(XP_WIN)
|
||||
"Windows"
|
||||
-#elif defined(XP_MACOSX)
|
||||
+#elif defined(MOZ_WIDGET_COCOA)
|
||||
"Macintosh"
|
||||
#elif defined(MOZ_X11)
|
||||
"X11"
|
||||
@@ -734,7 +734,7 @@ nsHttpHandler::InitUserAgentComponents()
|
||||
PR_smprintf_free(buf);
|
||||
}
|
||||
}
|
||||
-#elif defined (XP_MACOSX)
|
||||
+#elif defined (MOZ_WIDGET_COCOA)
|
||||
#if defined(__ppc__)
|
||||
mOscpu.AssignLiteral("PPC Mac OS X");
|
||||
#elif defined(__i386__) || defined(__x86_64__)
|
Loading…
Reference in a new issue