diff options
author | Grant Gayed <grant_gayed@ca.ibm.com> | 2012-04-02 10:23:56 -0400 |
---|---|---|
committer | Grant Gayed <grant_gayed@ca.ibm.com> | 2012-04-02 10:25:38 -0400 |
commit | ff8ec8fc1484c7eedcc70981458ecc23d5a64f37 (patch) | |
tree | b7ca46329bd2fcaf36ada6d0289d180a15aca1d2 /bundles/org.eclipse.swt | |
parent | 3550033b997d0fa2bf95b0dc245702b98b5325bd (diff) | |
download | eclipse.platform.swt-ff8ec8fc1484c7eedcc70981458ecc23d5a64f37.tar.gz eclipse.platform.swt-ff8ec8fc1484c7eedcc70981458ecc23d5a64f37.tar.xz eclipse.platform.swt-ff8ec8fc1484c7eedcc70981458ecc23d5a64f37.zip |
Bug 327696 - implement support for xulrunner >= 4.0 (jemalloc workaround
for Linux)
Diffstat (limited to 'bundles/org.eclipse.swt')
4 files changed, 52 insertions, 13 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java index 39100de07c..3828e578a2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java @@ -543,6 +543,17 @@ static String Arch () { return osArch; } +static String OS() { + String osName = System.getProperty("os.name"); //$NON-NLS-1$ + if (osName.equals ("Linux")) return "linux"; //$NON-NLS-1$ $NON-NLS-2$ + if (osName.equals ("AIX")) return "aix"; //$NON-NLS-1$ $NON-NLS-2$ + if (osName.equals ("Solaris") || osName.equals ("SunOS")) return "solaris"; //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ + if (osName.equals ("HP-UX")) return "hpux"; //$NON-NLS-1$ $NON-NLS-2$ + if (osName.equals ("Mac OS X")) return "macosx"; //$NON-NLS-1$ $NON-NLS-2$ + if (osName.startsWith ("Win")) return "win32"; //$NON-NLS-1$ $NON-NLS-2$ + return osName; +} + static void LoadLibraries () { boolean initLoaded = false; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/MozillaDelegate.java index d61093ec56..afe1f0fd5a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/MozillaDelegate.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/MozillaDelegate.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.swt.browser; +import java.io.*; + import org.eclipse.swt.SWT; import org.eclipse.swt.browser.Browser; import org.eclipse.swt.internal.*; @@ -111,13 +113,38 @@ static String getSWTInitLibraryName () { } static void loadAdditionalLibraries (String mozillaPath) { -// the following is intentionally commented + if (Mozilla.IsPre_4) return; -// if (!Mozilla.IsPre_4) { -// System.loadLibrary ("swt-xulrunner10"); // get it extracted -// byte[] bytes = Converter.wcsToMbcs (null, /* path to libswt-xulrunner10.so */ "", true); //$NON-NLS-1$ -// OS.dlopen (bytes, OS.RTLD_NOW | OS.RTLD_GLOBAL); -// } + /* + * The use of the swt-xulrunner-fix library works around mozilla bug + * https://bugzilla.mozilla.org/show_bug.cgi?id=720682 (XULRunner 10). + */ + String libName = "libswt-xulrunner-fix.so"; //$NON-NLS-1$ + File libsDir = new File (getProfilePath () + "/libs/" + Mozilla.OS() + '/' + Mozilla.Arch ()); //$NON-NLS-1$ + File file = new File (libsDir, libName); + java.io.InputStream is = Library.class.getResourceAsStream ('/' + libName); + if (is != null) { + if (!libsDir.exists ()) { + libsDir.mkdirs (); + } + int read; + byte [] buffer = new byte [4096]; + try { + FileOutputStream os = new FileOutputStream (file); + while ((read = is.read (buffer)) != -1) { + os.write(buffer, 0, read); + } + os.close (); + is.close (); + } catch (FileNotFoundException e) { + } catch (IOException e) { + } + } + + if (file.exists ()) { + byte[] bytes = Converter.wcsToMbcs (null, file.getAbsolutePath (), true); + OS.dlopen (bytes, OS.RTLD_NOW | OS.RTLD_GLOBAL); + } } static char[] mbcsToWcs (String codePage, byte [] buffer) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak index ad5b1cae27..c8cc080958 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak @@ -241,6 +241,7 @@ xpcom_stats.o: xpcom_stats.cpp make_xulrunner:$(XULRUNNER_LIB) $(XULRUNNER_LIB): $(XULRUNNER_OBJECTS) + echo -e "#include<stdlib.h>\nsize_t je_malloc_usable_size_in_advance(size_t n) {\nreturn n;\n}" | gcc --shared -xc - -o libswt-xulrunner-fix.so $(CXX) -o $(XULRUNNER_LIB) $(XULRUNNER_OBJECTS) $(MOZILLALFLAGS) ${XULRUNNER_LIBS} xpcomxul.o: xpcom.cpp diff --git a/bundles/org.eclipse.swt/buildSWT.xml b/bundles/org.eclipse.swt/buildSWT.xml index 74379ba1a3..d6e8f868c5 100644 --- a/bundles/org.eclipse.swt/buildSWT.xml +++ b/bundles/org.eclipse.swt/buildSWT.xml @@ -78,27 +78,27 @@ <param name="fragment" value="org.eclipse.swt.gtk.hpux.ia64_32"/> </antcall> <antcall target="check_fragment_libraries"> - <param name="library_count" value="11"/> + <param name="library_count" value="12"/> <param name="fragment" value="org.eclipse.swt.gtk.linux.ppc"/> </antcall> <antcall target="check_fragment_libraries"> - <param name="library_count" value="11"/> + <param name="library_count" value="12"/> <param name="fragment" value="org.eclipse.swt.gtk.linux.ppc64"/> </antcall> <antcall target="check_fragment_libraries"> - <param name="library_count" value="11"/> + <param name="library_count" value="12"/> <param name="fragment" value="org.eclipse.swt.gtk.linux.s390"/> </antcall> <antcall target="check_fragment_libraries"> - <param name="library_count" value="11"/> + <param name="library_count" value="12"/> <param name="fragment" value="org.eclipse.swt.gtk.linux.s390x"/> </antcall> <antcall target="check_fragment_libraries"> - <param name="library_count" value="11"/> + <param name="library_count" value="12"/> <param name="fragment" value="org.eclipse.swt.gtk.linux.x86"/> </antcall> <antcall target="check_fragment_libraries"> - <param name="library_count" value="11"/> + <param name="library_count" value="12"/> <param name="fragment" value="org.eclipse.swt.gtk.linux.x86_64"/> </antcall> <antcall target="check_fragment_libraries"> @@ -159,7 +159,7 @@ <target name="check_fragment_libraries" depends="get_version"> <echo>Checking ${fragment}</echo> <property name="checkdir" value="~/build/check_libraries"/> - <property name="library_count" value="125"/> + <property name="library_count" value="131"/> <property name="fragment" value=""/> <fileset id="match" dir="${repo.bin}/bundles/${fragment}"> <filename regex="[0-9][0-9][0-9][0-9]."/> |