From 45e403f4be678b926aeb41986002b9c75db53384 Mon Sep 17 00:00:00 2001 From: Siddharth Agarwal Date: Fri, 11 Nov 2011 10:38:26 +0530 Subject: [PATCH 1/7] Bug 699203 - Remove the obsolete mozilla-dos2unix.py script. r=ted --- build/win32/mozilla-dos2unix.py | 73 --------------------------------- 1 file changed, 73 deletions(-) delete mode 100755 build/win32/mozilla-dos2unix.py diff --git a/build/win32/mozilla-dos2unix.py b/build/win32/mozilla-dos2unix.py deleted file mode 100755 index bfdbd6f7f4b..00000000000 --- a/build/win32/mozilla-dos2unix.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/python - -import sys -if not sys.platform == "win32": - raise Exception("This script was only meant for Windows.") - -import os - -def dos2unix(path): - print "dos2unix: %s" % path - - inf = open(path, "r") - data = inf.read() - inf.close() - - - outf = open(path, "wb") - outf.write(data) - outf.close() - -adminfiles = [ - "Root", - "Repository", - "Entries", - "Entries.Log", - "Entries.Static", - "Tag", - "Notify", - "Template" - ] - -def walkdirectory(path): - if not os.path.exists(os.path.join(path, "CVS")): - return - - print "Directory: %s" % path - - for f in adminfiles: - cvsf = os.path.join(path, "CVS", f) - if os.path.exists(cvsf): - dos2unix(cvsf) - - entries = open(os.path.join(path, "CVS", "Entries"), "r") - for entry in entries: - if entry == "D\n": - continue - - (type, filename, rev, date, flags, extra) = entry.split('/') - if type == "D" or flags == "-kb" or rev[0] == "-": - continue - - dos2unix(os.path.join(path, filename)) - - # Now walk subdirectories - for entry in os.listdir(path): - subdir = os.path.join(path, entry) - if os.path.isdir(subdir): - walkdirectory(subdir) - -topsrcdir = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-3]) - -print """This command will convert the source tree at -%s -to an MSYS-compatible (unix mode) source tree. You can run this -command multiple times safely. Are you sure you want to continue (Y/N)? """ % topsrcdir, -sys.stdout.flush() -print - -ask = raw_input() -if len(ask) == 0 or (ask[0] != "y" and ask[0] != "Y"): - raise Exception("User aborted action.") - -walkdirectory(topsrcdir) From 2520de439a35f9d890453ce3a01973a911f710d9 Mon Sep 17 00:00:00 2001 From: Siddharth Agarwal Date: Fri, 11 Nov 2011 10:39:59 +0530 Subject: [PATCH 2/7] Bug 700959 - Disable MSVC incremental linking on all VC8 builds and on all 32-bit hosts. r=ted --- toolkit/library/Makefile.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index 4f6de767f01..10d9733d95a 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -113,10 +113,13 @@ else SDK_LIBRARY = $(SHARED_LIBRARY) endif -# See bug 653662 - some builders are hitting an internal size limit -# on incremental builds. Disable this for debug builds using VC8/9. +# See bug 653662 - some builders are hitting an internal size limit on +# incremental builds. Disable incremental linking for debug builds on VC8 or +# on 32-bit hosts. +# See: http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/c34d5c37-ca4a-4580-9c7c-4379a8c76d1f/ ifeq ($(OS_ARCH),WINNT) -ifeq (,$(filter-out 1400 1500,$(_MSC_VER))) +IS_32BIT_HOST := $(if $(filter AMD64,$(PROCESSOR_ARCHITECTURE) $(PROCESSOR_ARCHITEW6432)),,yes) +ifneq (,$(or $(filter 1400,$(_MSC_VER)),$(IS_32BIT_HOST))) ifdef MOZ_DEBUG EXTRA_DSO_LDOPTS += -INCREMENTAL:NO endif From 84fc0b630edac42a20c810cfe45f255b245b7ab5 Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Fri, 11 Nov 2011 12:25:22 -0800 Subject: [PATCH 3/7] Bug 701822 - Add TEST_DIRS Makefile variable; r=ted --- config/rules.mk | 13 +++++++++++++ js/src/config/rules.mk | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/config/rules.mk b/config/rules.mk index d1b969becd4..4b8ae1f9f7c 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -122,6 +122,19 @@ testxpcobjdir = $(DEPTH)/_tests/xpcshell ifdef ENABLE_TESTS +# Add test directories to the regular directories list. TEST_DIRS should +# arguably have the same status as TOOL_DIRS and other *_DIRS variables. It is +# coded this way until Makefiles stop using the "ifdef ENABLE_TESTS; DIRS +=" +# convention. +# +# The current developer workflow expects tests to be updated when processing +# the default target. If we ever change this implementation, the behavior +# should be preserved or the change should be widely communicated. A +# consequence of not processing test dir targets during the default target is +# that changes to tests may not be updated and code could assume to pass +# locally against non-current test code. +DIRS += $(TEST_DIRS) + ifdef XPCSHELL_TESTS ifndef relativesrcdir $(error Must define relativesrcdir when defining XPCSHELL_TESTS.) diff --git a/js/src/config/rules.mk b/js/src/config/rules.mk index d1b969becd4..4b8ae1f9f7c 100644 --- a/js/src/config/rules.mk +++ b/js/src/config/rules.mk @@ -122,6 +122,19 @@ testxpcobjdir = $(DEPTH)/_tests/xpcshell ifdef ENABLE_TESTS +# Add test directories to the regular directories list. TEST_DIRS should +# arguably have the same status as TOOL_DIRS and other *_DIRS variables. It is +# coded this way until Makefiles stop using the "ifdef ENABLE_TESTS; DIRS +=" +# convention. +# +# The current developer workflow expects tests to be updated when processing +# the default target. If we ever change this implementation, the behavior +# should be preserved or the change should be widely communicated. A +# consequence of not processing test dir targets during the default target is +# that changes to tests may not be updated and code could assume to pass +# locally against non-current test code. +DIRS += $(TEST_DIRS) + ifdef XPCSHELL_TESTS ifndef relativesrcdir $(error Must define relativesrcdir when defining XPCSHELL_TESTS.) From 9db7f26ee49a1e0f6474a504ec5c7871e00297a6 Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Wed, 16 Nov 2011 10:58:09 -0800 Subject: [PATCH 4/7] Bug 702178 - Consolidate libxul-config.mk and libxul-rules.mk into Makefile; r=ted --- toolkit/library/Makefile.in | 406 ++++++++++++++++++++++++++++--- toolkit/library/libxul-config.mk | 367 ---------------------------- toolkit/library/libxul-rules.mk | 59 ----- 3 files changed, 376 insertions(+), 456 deletions(-) delete mode 100644 toolkit/library/libxul-config.mk delete mode 100644 toolkit/library/libxul-rules.mk diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index 10d9733d95a..a138b2d02b7 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -20,6 +20,7 @@ # the Initial Developer. All Rights Reserved. # # Contributor(s): +# Shawn Wilsher # # Alternatively, the contents of this file may be used under the terms of # either of the GNU General Public License Version 2 or later (the "GPL"), @@ -35,10 +36,10 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk @@ -76,19 +77,344 @@ DEFINES += -DMOZ_ENABLE_GTK2 endif SHARED_LIBRARY_LIBS += \ - $(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX) \ - $(NULL) + $(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX) \ + $(NULL) SHARED_LIBRARY_LIBS += \ - $(foreach component,$(COMPONENT_LIBS),$(DEPTH)/staticlib/components/$(LIB_PREFIX)$(component).$(LIB_SUFFIX)) \ - $(foreach lib,$(STATIC_LIBS),$(DEPTH)/staticlib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX)) \ - $(NULL) + $(foreach component,$(COMPONENT_LIBS),$(DEPTH)/staticlib/components/$(LIB_PREFIX)$(component).$(LIB_SUFFIX)) \ + $(foreach lib,$(STATIC_LIBS),$(DEPTH)/staticlib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX)) \ + $(NULL) -include $(srcdir)/libxul-config.mk +CPPSRCS += \ + nsStaticXULComponents.cpp \ + $(NULL) + +ifeq ($(OS_ARCH),WINNT) +REQUIRES += widget gfx +CPPSRCS += \ + nsDllMain.cpp \ + $(NULL) +endif + +ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_) +CPPSRCS += \ + nsGFXDeps.cpp \ + $(NULL) + +RCINCLUDE = xulrunner.rc + +ifndef MOZ_NATIVE_ZLIB +CPPSRCS += dlldeps-zlib.cpp +endif + +LOCAL_INCLUDES += -I$(topsrcdir)/widget/src/windows +LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base +endif + +ifneq (,$(filter WINNT OS2,$(OS_ARCH))) +REQUIRES += libreg +DEFINES += -DZLIB_DLL=1 +endif + +ifeq ($(OS_ARCH),OS2) +REQUIRES += widget gfx + +CPPSRCS += \ + nsGFXDeps.cpp \ + $(NULL) + +ifndef MOZ_NATIVE_ZLIB +CPPSRCS += dlldeps-zlib.cpp +endif + +RESFILE = xulrunos2.res +RCFLAGS += -i $(topsrcdir)/widget/src/os2 + +LOCAL_INCLUDES += -I$(topsrcdir)/widget/src/os2 +LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base +endif + +# dependent libraries +STATIC_LIBS += \ + jsipc_s \ + domipc_s \ + domplugins_s \ + mozipc_s \ + mozipdlgen_s \ + ipcshell_s \ + gfx2d \ + gfxipc_s \ + hal_s \ + $(NULL) + +ifdef MOZ_IPDL_TESTS +STATIC_LIBS += ipdlunittest_s +endif + +ifeq (Linux,$(OS_ARCH)) +ifneq (Android,$(OS_TARGET)) +OS_LIBS += -lrt +endif +endif + +STATIC_LIBS += \ + xpcom_core \ + ucvutil_s \ + chromium_s \ + mozreg_s \ + $(NULL) + +# component libraries +COMPONENT_LIBS += \ + necko \ + uconv \ + i18n \ + chardet \ + jar$(VERSION_NUMBER) \ + startupcache \ + pref \ + htmlpars \ + imglib2 \ + gkgfx \ + gklayout \ + docshell \ + embedcomponents \ + webbrwsr \ + nsappshell \ + txmgr \ + commandlines \ + toolkitcomps \ + pipboot \ + pipnss \ + appcomps \ + jsreflect \ + composer \ + jetpack_s \ + telemetry \ + jsdebugger \ + storagecomps \ + rdf \ + windowds \ + $(NULL) + +ifdef BUILD_CTYPES +COMPONENT_LIBS += \ + jsctypes \ + $(NULL) +endif + +COMPONENT_LIBS += \ + jsperf \ + gkplugin \ + $(NULL) + +ifdef MOZ_XUL +ifdef MOZ_ENABLE_GTK2 +COMPONENT_LIBS += \ + unixproxy \ + $(NULL) +endif +endif + +ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT))) +COMPONENT_LIBS += \ + osxproxy \ + $(NULL) +endif + +ifdef MOZ_XUL +ifeq (qt,$(MOZ_WIDGET_TOOLKIT)) +COMPONENT_LIBS += \ + unixproxy \ + $(NULL) +endif +endif + +ifneq (,$(filter windows,$(MOZ_WIDGET_TOOLKIT))) +COMPONENT_LIBS += \ + windowsproxy \ + $(NULL) +endif + +ifdef MOZ_JSDEBUGGER +DEFINES += -DMOZ_JSDEBUGGER +COMPONENT_LIBS += \ + jsd \ + $(NULL) +endif + +ifdef MOZ_PREF_EXTENSIONS +DEFINES += -DMOZ_PREF_EXTENSIONS +COMPONENT_LIBS += \ + autoconfig \ + $(NULL) +endif + +ifdef MOZ_AUTH_EXTENSION +COMPONENT_LIBS += auth +DEFINES += -DMOZ_AUTH_EXTENSION +endif + +ifdef MOZ_PERMISSIONS +COMPONENT_LIBS += cookie permissions +DEFINES += -DMOZ_PERMISSIONS +endif + +ifdef MOZ_UNIVERSALCHARDET +COMPONENT_LIBS += universalchardet +DEFINES += -DMOZ_UNIVERSALCHARDET +endif + +ifeq (,$(filter android qt os2 cocoa windows,$(MOZ_WIDGET_TOOLKIT))) +ifdef MOZ_XUL +COMPONENT_LIBS += fileview +DEFINES += -DMOZ_FILEVIEW +endif +endif + +ifdef MOZ_PLACES +COMPONENT_LIBS += \ + places \ + $(NULL) +endif + +ifdef MOZ_XUL +COMPONENT_LIBS += \ + tkautocomplete \ + satchel \ + pippki \ + $(NULL) +endif + +ifdef MOZ_ENABLE_GTK2 +COMPONENT_LIBS += widget_gtk2 +ifdef MOZ_PREF_EXTENSIONS +COMPONENT_LIBS += system-pref +endif +endif + +ifdef MOZ_ENABLE_GTK2 +ifdef MOZ_X11 +STATIC_LIBS += gtkxtbin +endif +endif + +# Platform-specific icon channel stuff - supported mostly-everywhere +ifneq (,$(filter windows os2 mac cocoa gtk2 qt android,$(MOZ_WIDGET_TOOLKIT))) +DEFINES += -DICON_DECODER +COMPONENT_LIBS += imgicon +endif + +ifeq ($(MOZ_WIDGET_TOOLKIT),android) +COMPONENT_LIBS += widget_android +endif + +STATIC_LIBS += thebes ycbcr + +ifeq ($(MOZ_WIDGET_TOOLKIT),android) +STATIC_LIBS += profiler +endif + +STATIC_LIBS += angle + +ifeq (windows,$(MOZ_WIDGET_TOOLKIT)) +COMPONENT_LIBS += gkwidget +endif +ifeq (os2,$(MOZ_WIDGET_TOOLKIT)) +COMPONENT_LIBS += wdgtos2 +endif +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) +COMPONENT_LIBS += widget_mac +endif +ifeq (qt,$(MOZ_WIDGET_TOOLKIT)) +COMPONENT_LIBS += widget_qt +endif + +ifdef ACCESSIBILITY +COMPONENT_LIBS += accessibility +endif + +ifdef MOZ_ENABLE_XREMOTE +COMPONENT_LIBS += remoteservice +endif + +ifdef MOZ_SPELLCHECK +DEFINES += -DMOZ_SPELLCHECK +COMPONENT_LIBS += spellchecker +endif + +ifdef MOZ_ZIPWRITER +DEFINES += -DMOZ_ZIPWRITER +COMPONENT_LIBS += zipwriter +endif + +COMPONENT_LIBS += services-crypto + +ifdef MOZ_DEBUG +ifdef ENABLE_TESTS +COMPONENT_LIBS += gkdebug +endif +endif + +ifdef MOZ_APP_COMPONENT_LIBS +COMPONENT_LIBS += $(MOZ_APP_COMPONENT_LIBS) +endif + +ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) +OS_LIBS += -framework OpenGL -lcups +endif + +EXTRA_DSO_LDOPTS += \ + $(LIBS_DIR) \ + $(JPEG_LIBS) \ + $(PNG_LIBS) \ + $(QCMS_LIBS) \ + $(MOZ_JS_LIBS) \ + $(NSS_LIBS) \ + $(MOZ_CAIRO_LIBS) \ + $(MOZ_HARFBUZZ_LIBS) \ + $(MOZ_OTS_LIBS) \ + $(MOZ_APP_EXTRA_LIBS) \ + $(SQLITE_LIBS) \ + $(NULL) + +ifdef MOZ_NATIVE_ZLIB +EXTRA_DSO_LDOPTS += $(ZLIB_LIBS) +else +EXTRA_DSO_LDOPTS += $(MOZ_ZLIB_LIBS) +endif + +ifdef MOZ_NATIVE_HUNSPELL +EXTRA_DSO_LDOPTS += $(MOZ_HUNSPELL_LIBS) +endif + +ifdef MOZ_NATIVE_LIBEVENT +EXTRA_DSO_LDOPTS += $(MOZ_LIBEVENT_LIBS) +endif + +ifdef MOZ_NATIVE_LIBVPX +EXTRA_DSO_LDOPTS += $(MOZ_LIBVPX_LIBS) +endif + +ifdef MOZ_SYDNEYAUDIO +ifeq ($(OS_ARCH),Linux) +EXTRA_DSO_LDOPTS += $(MOZ_ALSA_LIBS) +endif +endif + +ifdef HAVE_CLOCK_MONOTONIC +EXTRA_DSO_LDOPTS += $(REALTIME_LIBS) +endif + +ifeq (,$(filter-out cocoa android,$(MOZ_WIDGET_TOOLKIT))) +EXTRA_DSO_LDOPTS += $(MOZ_SKIA_LIBS) +endif + +ifeq (android,$(MOZ_WIDGET_TOOLKIT)) +OS_LIBS += -lGLESv2 +endif EXTRA_DEPS += \ - $(srcdir)/libxul-config.mk \ - $(srcdir)/libxul-rules.mk \ $(topsrcdir)/intl/unicharutil/util/objs.mk \ $(topsrcdir)/rdf/util/src/objs.mk \ $(NULL) @@ -98,7 +424,7 @@ CPPSRCS += \ $(RDF_UTIL_SRC_LCPPSRCS) \ $(NULL) -GARBAGE += \ +GARBAGE += \ $(INTL_UNICHARUTIL_UTIL_LCPPSRCS) \ $(wildcard *.$(OBJ_SUFFIX)) \ $(RDF_UTIL_SRC_LCPPSRCS) \ @@ -133,27 +459,27 @@ DEFINES += -DIMPL_XREAPI EXTRA_DSO_LDOPTS += $(NSPR_LIBS) $(MOZALLOC_LIB) ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) -CXXFLAGS += $(TK_CFLAGS) +CXXFLAGS += $(TK_CFLAGS) OS_LIBS += \ - -framework SystemConfiguration \ - -framework QuickTime \ - -framework IOKit \ - -F/System/Library/PrivateFrameworks -framework CoreUI \ - $(TK_LIBS) \ - $(NULL) + -framework SystemConfiguration \ + -framework QuickTime \ + -framework IOKit \ + -F/System/Library/PrivateFrameworks -framework CoreUI \ + $(TK_LIBS) \ + $(NULL) endif ifeq ($(OS_ARCH),Darwin) ifdef MOZ_SYDNEYAUDIO EXTRA_DSO_LDOPTS += \ - -framework Carbon \ - -framework CoreAudio \ - -framework AudioToolbox \ - -framework AudioUnit \ - -framework IOKit \ - -framework Foundation \ - -framework AppKit \ - $(NULL) + -framework Carbon \ + -framework CoreAudio \ + -framework AudioToolbox \ + -framework AudioUnit \ + -framework IOKit \ + -framework Foundation \ + -framework AppKit \ + $(NULL) endif endif @@ -165,7 +491,7 @@ endif ifdef MOZ_PLATFORM_MAEMO EXTRA_DSO_LDOPTS += $(MOZ_PLATFORM_MAEMO_LIBS) -endif +endif ifdef MOZ_ENABLE_LIBCONIC EXTRA_DSO_LDOPTS += $(LIBCONIC_LIBS) @@ -231,7 +557,27 @@ include $(topsrcdir)/config/rules.mk export:: $(RDF_UTIL_SRC_CPPSRCS) $(INTL_UNICHARUTIL_UTIL_CPPSRCS) $(INSTALL) $^ . -include $(srcdir)/libxul-rules.mk +# need widget/src/windows for resource.h (included from widget.rc) +LOCAL_INCLUDES += \ + -I$(topsrcdir)/config \ + -I$(topsrcdir)/widget/src/windows \ + -I$(topsrcdir)/widget/src/build \ + $(NULL) + +OS_LIBS += $(LIBICONV) + +DEFINES += \ + -D_IMPL_NS_COM \ + -D_IMPL_NS_STRINGAPI \ + -DEXPORT_XPT_API \ + -DEXPORT_XPTC_API \ + -D_IMPL_NS_GFX \ + -D_IMPL_NS_WIDGET \ + $(NULL) + +ifeq ($(MOZ_WIDGET_TOOLKIT),windows) +OS_LIBS += $(call EXPAND_LIBNAME,usp10 oleaut32) +endif ifeq ($(OS_ARCH),OpenBSD) # Needed by nsAuthGSSAPI diff --git a/toolkit/library/libxul-config.mk b/toolkit/library/libxul-config.mk deleted file mode 100644 index 13bb5cb0c2a..00000000000 --- a/toolkit/library/libxul-config.mk +++ /dev/null @@ -1,367 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla libxul -# -# The Initial Developer of the Original Code is -# Benjamin Smedberg -# -# Portions created by the Initial Developer are Copyright (C) 2005 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Shawn Wilsher -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -CPPSRCS += \ - nsStaticXULComponents.cpp \ - $(NULL) - -ifeq ($(OS_ARCH),WINNT) -REQUIRES += widget gfx -CPPSRCS += \ - nsDllMain.cpp \ - $(NULL) -endif - -ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_) -CPPSRCS += \ - nsGFXDeps.cpp \ - $(NULL) - -RCINCLUDE = xulrunner.rc - -ifndef MOZ_NATIVE_ZLIB -CPPSRCS += dlldeps-zlib.cpp -endif - -LOCAL_INCLUDES += -I$(topsrcdir)/widget/src/windows -LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base -endif - -ifneq (,$(filter WINNT OS2,$(OS_ARCH))) -REQUIRES += libreg -DEFINES += -DZLIB_DLL=1 -endif - -ifeq ($(OS_ARCH),OS2) -REQUIRES += widget gfx - -CPPSRCS += \ - nsGFXDeps.cpp \ - $(NULL) - -ifndef MOZ_NATIVE_ZLIB -CPPSRCS += dlldeps-zlib.cpp -endif - -RESFILE = xulrunos2.res -RCFLAGS += -i $(topsrcdir)/widget/src/os2 - -LOCAL_INCLUDES += -I$(topsrcdir)/widget/src/os2 -LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base -endif - -# dependent libraries -STATIC_LIBS += \ - jsipc_s \ - domipc_s \ - domplugins_s \ - mozipc_s \ - mozipdlgen_s \ - ipcshell_s \ - gfx2d \ - gfxipc_s \ - hal_s \ - $(NULL) - -ifdef MOZ_IPDL_TESTS -STATIC_LIBS += ipdlunittest_s -endif - -ifeq (Linux,$(OS_ARCH)) -ifneq (Android,$(OS_TARGET)) -OS_LIBS += -lrt -endif -endif - -STATIC_LIBS += \ - xpcom_core \ - ucvutil_s \ - chromium_s \ - mozreg_s \ - $(NULL) - -# component libraries -COMPONENT_LIBS += \ - necko \ - uconv \ - i18n \ - chardet \ - jar$(VERSION_NUMBER) \ - startupcache \ - pref \ - htmlpars \ - imglib2 \ - gkgfx \ - gklayout \ - docshell \ - embedcomponents \ - webbrwsr \ - nsappshell \ - txmgr \ - commandlines \ - toolkitcomps \ - pipboot \ - pipnss \ - appcomps \ - jsreflect \ - composer \ - jetpack_s \ - telemetry \ - jsdebugger \ - storagecomps \ - rdf \ - windowds \ - $(NULL) - -ifdef BUILD_CTYPES -COMPONENT_LIBS += \ - jsctypes \ - $(NULL) -endif - -COMPONENT_LIBS += \ - jsperf \ - gkplugin \ - $(NULL) - -ifdef MOZ_XUL -ifdef MOZ_ENABLE_GTK2 -COMPONENT_LIBS += \ - unixproxy \ - $(NULL) -endif -endif - -ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT))) -COMPONENT_LIBS += \ - osxproxy \ - $(NULL) -endif - -ifdef MOZ_XUL -ifeq (qt,$(MOZ_WIDGET_TOOLKIT)) -COMPONENT_LIBS += \ - unixproxy \ - $(NULL) -endif -endif - -ifneq (,$(filter windows,$(MOZ_WIDGET_TOOLKIT))) -COMPONENT_LIBS += \ - windowsproxy \ - $(NULL) -endif - -ifdef MOZ_JSDEBUGGER -DEFINES += -DMOZ_JSDEBUGGER -COMPONENT_LIBS += \ - jsd \ - $(NULL) -endif - -ifdef MOZ_PREF_EXTENSIONS -DEFINES += -DMOZ_PREF_EXTENSIONS -COMPONENT_LIBS += \ - autoconfig \ - $(NULL) -endif - -ifdef MOZ_AUTH_EXTENSION -COMPONENT_LIBS += auth -DEFINES += -DMOZ_AUTH_EXTENSION -endif - -ifdef MOZ_PERMISSIONS -COMPONENT_LIBS += cookie permissions -DEFINES += -DMOZ_PERMISSIONS -endif - -ifdef MOZ_UNIVERSALCHARDET -COMPONENT_LIBS += universalchardet -DEFINES += -DMOZ_UNIVERSALCHARDET -endif - -ifeq (,$(filter android qt os2 cocoa windows,$(MOZ_WIDGET_TOOLKIT))) -ifdef MOZ_XUL -COMPONENT_LIBS += fileview -DEFINES += -DMOZ_FILEVIEW -endif -endif - -ifdef MOZ_PLACES -COMPONENT_LIBS += \ - places \ - $(NULL) -endif - -ifdef MOZ_XUL -COMPONENT_LIBS += \ - tkautocomplete \ - satchel \ - pippki \ - $(NULL) -endif - -ifdef MOZ_ENABLE_GTK2 -COMPONENT_LIBS += widget_gtk2 -ifdef MOZ_PREF_EXTENSIONS -COMPONENT_LIBS += system-pref -endif -endif - -ifdef MOZ_ENABLE_GTK2 -ifdef MOZ_X11 -STATIC_LIBS += gtkxtbin -endif -endif - -# Platform-specific icon channel stuff - supported mostly-everywhere -ifneq (,$(filter windows os2 mac cocoa gtk2 qt android,$(MOZ_WIDGET_TOOLKIT))) -DEFINES += -DICON_DECODER -COMPONENT_LIBS += imgicon -endif - -ifeq ($(MOZ_WIDGET_TOOLKIT),android) -COMPONENT_LIBS += widget_android -endif - -STATIC_LIBS += thebes ycbcr - -ifeq ($(MOZ_WIDGET_TOOLKIT),android) -STATIC_LIBS += profiler -endif - -STATIC_LIBS += angle - -ifeq (windows,$(MOZ_WIDGET_TOOLKIT)) -COMPONENT_LIBS += gkwidget -endif -ifeq (os2,$(MOZ_WIDGET_TOOLKIT)) -COMPONENT_LIBS += wdgtos2 -endif -ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) -COMPONENT_LIBS += widget_mac -endif -ifeq (qt,$(MOZ_WIDGET_TOOLKIT)) -COMPONENT_LIBS += widget_qt -endif - -ifdef ACCESSIBILITY -COMPONENT_LIBS += accessibility -endif - -ifdef MOZ_ENABLE_XREMOTE -COMPONENT_LIBS += remoteservice -endif - -ifdef MOZ_SPELLCHECK -DEFINES += -DMOZ_SPELLCHECK -COMPONENT_LIBS += spellchecker -endif - -ifdef MOZ_ZIPWRITER -DEFINES += -DMOZ_ZIPWRITER -COMPONENT_LIBS += zipwriter -endif - -COMPONENT_LIBS += services-crypto - -ifdef MOZ_DEBUG -ifdef ENABLE_TESTS -COMPONENT_LIBS += gkdebug -endif -endif - -ifdef MOZ_APP_COMPONENT_LIBS -COMPONENT_LIBS += $(MOZ_APP_COMPONENT_LIBS) -endif - -ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) -OS_LIBS += -framework OpenGL -lcups -endif - -EXTRA_DSO_LDOPTS += \ - $(LIBS_DIR) \ - $(JPEG_LIBS) \ - $(PNG_LIBS) \ - $(QCMS_LIBS) \ - $(MOZ_JS_LIBS) \ - $(NSS_LIBS) \ - $(MOZ_CAIRO_LIBS) \ - $(MOZ_HARFBUZZ_LIBS) \ - $(MOZ_OTS_LIBS) \ - $(MOZ_APP_EXTRA_LIBS) \ - $(SQLITE_LIBS) \ - $(NULL) - -ifdef MOZ_NATIVE_ZLIB -EXTRA_DSO_LDOPTS += $(ZLIB_LIBS) -else -EXTRA_DSO_LDOPTS += $(MOZ_ZLIB_LIBS) -endif - -ifdef MOZ_NATIVE_HUNSPELL -EXTRA_DSO_LDOPTS += $(MOZ_HUNSPELL_LIBS) -endif - -ifdef MOZ_NATIVE_LIBEVENT -EXTRA_DSO_LDOPTS += $(MOZ_LIBEVENT_LIBS) -endif - -ifdef MOZ_NATIVE_LIBVPX -EXTRA_DSO_LDOPTS += $(MOZ_LIBVPX_LIBS) -endif - -ifdef MOZ_SYDNEYAUDIO -ifeq ($(OS_ARCH),Linux) -EXTRA_DSO_LDOPTS += $(MOZ_ALSA_LIBS) -endif -endif - -ifdef HAVE_CLOCK_MONOTONIC -EXTRA_DSO_LDOPTS += $(REALTIME_LIBS) -endif - -ifeq (,$(filter-out cocoa android,$(MOZ_WIDGET_TOOLKIT))) -EXTRA_DSO_LDOPTS += $(MOZ_SKIA_LIBS) -endif - -ifeq (android,$(MOZ_WIDGET_TOOLKIT)) -OS_LIBS += -lGLESv2 -endif diff --git a/toolkit/library/libxul-rules.mk b/toolkit/library/libxul-rules.mk deleted file mode 100644 index e4517595f0c..00000000000 --- a/toolkit/library/libxul-rules.mk +++ /dev/null @@ -1,59 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla libxul -# -# The Initial Developer of the Original Code is -# Benjamin Smedberg -# -# Portions created by the Initial Developer are Copyright (C) 2005 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -# need widget/src/windows for resource.h (included from widget.rc) -LOCAL_INCLUDES += \ - -I$(topsrcdir)/config \ - -I$(topsrcdir)/widget/src/windows \ - -I$(topsrcdir)/widget/src/build \ - $(NULL) - -OS_LIBS += $(LIBICONV) - -DEFINES += \ - -D_IMPL_NS_COM \ - -D_IMPL_NS_STRINGAPI \ - -DEXPORT_XPT_API \ - -DEXPORT_XPTC_API \ - -D_IMPL_NS_GFX \ - -D_IMPL_NS_WIDGET \ - $(NULL) - -ifeq ($(MOZ_WIDGET_TOOLKIT),windows) -OS_LIBS += $(call EXPAND_LIBNAME,usp10 oleaut32) -endif From 10680e91633220d438359974a26289e078c4df53 Mon Sep 17 00:00:00 2001 From: Doug Turner Date: Fri, 18 Nov 2011 13:17:40 -0800 Subject: [PATCH 5/7] Bug 703680 - support both embedding/android and mobile/android/base. r=khuey --- embedding/Makefile.in | 2 ++ toolkit/mozapps/installer/packager.mk | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/embedding/Makefile.in b/embedding/Makefile.in index d1329b2a106..b6f74b1d8c1 100644 --- a/embedding/Makefile.in +++ b/embedding/Makefile.in @@ -54,7 +54,9 @@ DIRS += test endif ifeq ($(MOZ_WIDGET_TOOLKIT),android) +ifeq ($(MOZ_BUILD_APP),mobile/xul) DIRS += android endif +endif include $(topsrcdir)/config/rules.mk diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk index baeb0cbe785..33ab1345503 100644 --- a/toolkit/mozapps/installer/packager.mk +++ b/toolkit/mozapps/installer/packager.mk @@ -319,10 +319,16 @@ ABI_DIR = armeabi endif endif +ifeq ($(MOZ_BUILD_APP),mobile/xul) +GECKO_APP_AP_PATH = ../embedding/android +else +GECKO_APP_AP_PATH = ../mobile/android/base +endif + PKG_SUFFIX = .apk INNER_MAKE_PACKAGE = \ - make -C ../embedding/android gecko.ap_ && \ - cp ../embedding/android/gecko.ap_ $(_ABS_DIST) && \ + make -C $(GECKO_APP_AP_PATH) gecko.ap_ && \ + cp $(GECKO_APP_AP_PATH)/gecko.ap_ $(_ABS_DIST) && \ ( cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && \ mkdir -p lib/$(ABI_DIR) && \ mv libmozutils.so $(MOZ_CHILD_PROCESS_NAME) lib/$(ABI_DIR) && \ From c836049acaf9c9cb1925eec1c3febbd38688f02e Mon Sep 17 00:00:00 2001 From: Sriram Ramasubramanian Date: Fri, 18 Nov 2011 13:18:24 -0800 Subject: [PATCH 6/7] Bug 703305 - Fix elfhack bustage. r=gladium --- toolkit/mozapps/installer/packager.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk index 33ab1345503..655c9491ed4 100644 --- a/toolkit/mozapps/installer/packager.mk +++ b/toolkit/mozapps/installer/packager.mk @@ -667,7 +667,7 @@ ifdef USE_ELF_HACK @echo === and your environment \(compiler and linker versions\), and use @echo === --disable-elf-hack until this is fixed. @echo === - cd $(DIST)/bin; find . -name "*$(DLL_SUFFIX)" | xargs $(DEPTH)/build/unix/elfhack/elfhack + cd $(DIST)/bin; find . -name "*$(DLL_SUFFIX)" | xargs ../../build/unix/elfhack/elfhack endif stage-package: $(MOZ_PKG_MANIFEST) $(MOZ_PKG_REMOVALS_GEN) elfhack From 9a38269ada3a5de6eceab8eb17d3ee010b9a12e5 Mon Sep 17 00:00:00 2001 From: Doug Turner Date: Fri, 18 Nov 2011 14:42:52 -0800 Subject: [PATCH 7/7] Bug 702037 - Merge Android History into mozilla-central. r=marco --- config/autoconf.mk.in | 1 + configure.in | 3 +- toolkit/components/places/Database.cpp | 6 + toolkit/components/places/Makefile.in | 8 + .../components/places/nsAndroidHistory.cpp | 168 ++++++++++++++++++ toolkit/components/places/nsAndroidHistory.h | 72 ++++++++ toolkit/components/places/nsPlacesModule.cpp | 25 ++- 7 files changed, 280 insertions(+), 3 deletions(-) create mode 100644 toolkit/components/places/nsAndroidHistory.cpp create mode 100644 toolkit/components/places/nsAndroidHistory.h diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 555cfd323a6..9a4489a4013 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -140,6 +140,7 @@ MOZ_UPDATE_PACKAGING = @MOZ_UPDATE_PACKAGING@ MOZ_DISABLE_PARENTAL_CONTROLS = @MOZ_DISABLE_PARENTAL_CONTROLS@ NS_ENABLE_TSF = @NS_ENABLE_TSF@ MOZ_SPELLCHECK = @MOZ_SPELLCHECK@ +MOZ_ANDROID_HISTORY = @MOZ_ANDROID_HISTORY@ MOZ_JAVA_COMPOSITOR = @MOZ_JAVA_COMPOSITOR@ MOZ_PROFILELOCKING = @MOZ_PROFILELOCKING@ MOZ_FEEDS = @MOZ_FEEDS@ diff --git a/configure.in b/configure.in index bc728678faa..2e1bea24ff4 100644 --- a/configure.in +++ b/configure.in @@ -4681,7 +4681,7 @@ NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciw USE_ARM_KUSER= BUILD_CTYPES=1 MOZ_USE_NATIVE_POPUP_WINDOWS= - +MOZ_ANDROID_HISTORY= case "${target}" in *android*|*darwin*) @@ -8464,6 +8464,7 @@ AC_SUBST(MOZ_D3DCOMPILER_CAB) AC_SUBST(MOZ_D3DX9_DLL) AC_SUBST(MOZ_D3DCOMPILER_DLL) +AC_SUBST(MOZ_ANDROID_HISTORY) AC_SUBST(ENABLE_STRIP) AC_SUBST(PKG_SKIP_STRIP) AC_SUBST(USE_ELF_DYNSTR_GC) diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp index 9b8b4bc3f65..8ec74099726 100644 --- a/toolkit/components/places/Database.cpp +++ b/toolkit/components/places/Database.cpp @@ -297,6 +297,12 @@ Database::~Database() nsresult Database::Init() { +#ifdef MOZ_ANDROID_HISTORY + // Currently places has deeply weaved it way throughout the gecko codebase. + // Here we disable all database creation and loading of places. + return NS_ERROR_NOT_IMPLEMENTED; +#endif + MOZ_ASSERT(NS_IsMainThread()); nsCOMPtr storage = diff --git a/toolkit/components/places/Makefile.in b/toolkit/components/places/Makefile.in index e75890dd902..8534eb83986 100644 --- a/toolkit/components/places/Makefile.in +++ b/toolkit/components/places/Makefile.in @@ -101,6 +101,14 @@ CPPSRCS = \ LOCAL_INCLUDES += -I$(srcdir)/../build +ifdef MOZ_ANDROID_HISTORY +CPPSRCS += nsAndroidHistory.cpp +LOCAL_INCLUDES += \ + -I$(topsrcdir)/docshell/base \ + -I$(topsrcdir)/content/base/src \ + $(NULL) +endif + EXTRA_COMPONENTS = \ toolkitplaces.manifest \ nsLivemarkService.js \ diff --git a/toolkit/components/places/nsAndroidHistory.cpp b/toolkit/components/places/nsAndroidHistory.cpp new file mode 100644 index 00000000000..5faccde4541 --- /dev/null +++ b/toolkit/components/places/nsAndroidHistory.cpp @@ -0,0 +1,168 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Android code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Kartikaya Gupta + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsAndroidHistory.h" +#include "AndroidBridge.h" +#include "Link.h" + +using namespace mozilla; +using mozilla::dom::Link; + +NS_IMPL_ISUPPORTS1(nsAndroidHistory, IHistory) + +nsAndroidHistory* nsAndroidHistory::sHistory = NULL; + +/*static*/ +nsAndroidHistory* +nsAndroidHistory::GetSingleton() +{ + if (!sHistory) { + sHistory = new nsAndroidHistory(); + NS_ENSURE_TRUE(sHistory, nsnull); + } + + NS_ADDREF(sHistory); + return sHistory; +} + +nsAndroidHistory::nsAndroidHistory() +{ + mListeners.Init(); +} + +NS_IMETHODIMP +nsAndroidHistory::RegisterVisitedCallback(nsIURI *aURI, Link *aContent) +{ + if (!aContent || !aURI) + return NS_OK; + + nsCAutoString uri; + nsresult rv = aURI->GetSpec(uri); + if (NS_FAILED(rv)) return rv; + nsString uriString = NS_ConvertUTF8toUTF16(uri); + + nsTArray* list = mListeners.Get(uriString); + if (! list) { + list = new nsTArray(); + mListeners.Put(uriString, list); + } + list->AppendElement(aContent); + + AndroidBridge *bridge = AndroidBridge::Bridge(); + if (bridge) { + bridge->CheckURIVisited(uriString); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsAndroidHistory::UnregisterVisitedCallback(nsIURI *aURI, Link *aContent) +{ + if (!aContent || !aURI) + return NS_OK; + + nsCAutoString uri; + nsresult rv = aURI->GetSpec(uri); + if (NS_FAILED(rv)) return rv; + nsString uriString = NS_ConvertUTF8toUTF16(uri); + + nsTArray* list = mListeners.Get(uriString); + if (! list) + return NS_OK; + + list->RemoveElement(aContent); + if (list->IsEmpty()) { + mListeners.Remove(uriString); + delete list; + } + return NS_OK; +} + +NS_IMETHODIMP +nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, PRUint32 aFlags) +{ + if (!aURI) + return NS_OK; + + if (!(aFlags & VisitFlags::TOP_LEVEL)) + return NS_OK; + + AndroidBridge *bridge = AndroidBridge::Bridge(); + if (bridge) { + nsCAutoString uri; + nsresult rv = aURI->GetSpec(uri); + if (NS_FAILED(rv)) return rv; + nsString uriString = NS_ConvertUTF8toUTF16(uri); + bridge->MarkURIVisited(uriString); + } + return NS_OK; +} + +NS_IMETHODIMP +nsAndroidHistory::SetURITitle(nsIURI *aURI, const nsAString& aTitle) +{ + // we don't do anything with this right now + return NS_OK; +} + +void /*static*/ +nsAndroidHistory::NotifyURIVisited(const nsString& aUriString) +{ + if (! sHistory) + return; + sHistory->mPendingURIs.Push(aUriString); + NS_DispatchToMainThread(sHistory); +} + +NS_IMETHODIMP +nsAndroidHistory::Run() +{ + while (! mPendingURIs.IsEmpty()) { + nsString uriString = mPendingURIs.Pop(); + nsTArray* list = sHistory->mListeners.Get(uriString); + if (list) { + for (unsigned int i = 0; i < list->Length(); i++) { + list->ElementAt(i)->SetLinkState(eLinkState_Visited); + } + // as per the IHistory interface contract, remove the + // Link pointers once they have been notified + mListeners.Remove(uriString); + delete list; + } + } + return NS_OK; +} diff --git a/toolkit/components/places/nsAndroidHistory.h b/toolkit/components/places/nsAndroidHistory.h new file mode 100644 index 00000000000..50467e4e124 --- /dev/null +++ b/toolkit/components/places/nsAndroidHistory.h @@ -0,0 +1,72 @@ +/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Android code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Kartikaya Gupta + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef NS_ANDROIDHISTORY_H +#define NS_ANDROIDHISTORY_H + +#include "IHistory.h" +#include "nsDataHashtable.h" +#include "nsTPriorityQueue.h" +#include "nsThreadUtils.h" + +#define NS_ANDROIDHISTORY_CID \ + {0xCCAA4880, 0x44DD, 0x40A7, {0xA1, 0x3F, 0x61, 0x56, 0xFC, 0x88, 0x2C, 0x0B}} + +class nsAndroidHistory : public mozilla::IHistory, public nsIRunnable +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_IHISTORY + NS_DECL_NSIRUNNABLE + + /** + * Obtains a pointer that has had AddRef called on it. Used by the service + * manager only. + */ + static nsAndroidHistory* GetSingleton(); + + nsAndroidHistory(); + static void NotifyURIVisited(const nsString& str); + +private: + static nsAndroidHistory* sHistory; + + nsDataHashtable *> mListeners; + nsTPriorityQueue mPendingURIs; +}; + +#endif diff --git a/toolkit/components/places/nsPlacesModule.cpp b/toolkit/components/places/nsPlacesModule.cpp index 559f0f3486f..e47c6c2d0ed 100644 --- a/toolkit/components/places/nsPlacesModule.cpp +++ b/toolkit/components/places/nsPlacesModule.cpp @@ -10,6 +10,10 @@ #include "History.h" #include "nsDocShellCID.h" +#ifdef MOZ_ANDROID_HISTORY +#include "nsAndroidHistory.h" +#endif + using namespace mozilla::places; NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsNavHistory, @@ -20,9 +24,13 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsNavBookmarks, nsNavBookmarks::GetSingleton) NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsFaviconService, nsFaviconService::GetSingleton) -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(History, History::GetSingleton) NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsPlacesImportExportService, nsPlacesImportExportService::GetSingleton) +#ifdef MOZ_ANDROID_HISTORY +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsAndroidHistory, nsAndroidHistory::GetSingleton) +#else +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(History, History::GetSingleton) +#endif NS_GENERIC_FACTORY_CONSTRUCTOR(nsAnnoProtocolHandler) NS_DEFINE_NAMED_CID(NS_NAVHISTORYSERVICE_CID); @@ -30,16 +38,25 @@ NS_DEFINE_NAMED_CID(NS_ANNOTATIONSERVICE_CID); NS_DEFINE_NAMED_CID(NS_ANNOPROTOCOLHANDLER_CID); NS_DEFINE_NAMED_CID(NS_NAVBOOKMARKSSERVICE_CID); NS_DEFINE_NAMED_CID(NS_FAVICONSERVICE_CID); -NS_DEFINE_NAMED_CID(NS_HISTORYSERVICE_CID); NS_DEFINE_NAMED_CID(NS_PLACESIMPORTEXPORTSERVICE_CID); +#ifdef MOZ_ANDROID_HISTORY +NS_DEFINE_NAMED_CID(NS_ANDROIDHISTORY_CID); +#else +NS_DEFINE_NAMED_CID(NS_HISTORYSERVICE_CID); +#endif + const mozilla::Module::CIDEntry kPlacesCIDs[] = { { &kNS_NAVHISTORYSERVICE_CID, false, NULL, nsNavHistoryConstructor }, { &kNS_ANNOTATIONSERVICE_CID, false, NULL, nsAnnotationServiceConstructor }, { &kNS_ANNOPROTOCOLHANDLER_CID, false, NULL, nsAnnoProtocolHandlerConstructor }, { &kNS_NAVBOOKMARKSSERVICE_CID, false, NULL, nsNavBookmarksConstructor }, { &kNS_FAVICONSERVICE_CID, false, NULL, nsFaviconServiceConstructor }, +#ifdef MOZ_ANDROID_HISTORY + { &kNS_ANDROIDHISTORY_CID, false, NULL, nsAndroidHistoryConstructor }, +#else { &kNS_HISTORYSERVICE_CID, false, NULL, HistoryConstructor }, +#endif { &kNS_PLACESIMPORTEXPORTSERVICE_CID, false, NULL, nsPlacesImportExportServiceConstructor }, { NULL } }; @@ -53,7 +70,11 @@ const mozilla::Module::ContractIDEntry kPlacesContracts[] = { { NS_NAVBOOKMARKSSERVICE_CONTRACTID, &kNS_NAVBOOKMARKSSERVICE_CID }, { NS_FAVICONSERVICE_CONTRACTID, &kNS_FAVICONSERVICE_CID }, { "@mozilla.org/embeddor.implemented/bookmark-charset-resolver;1", &kNS_NAVHISTORYSERVICE_CID }, +#ifdef MOZ_ANDROID_HISTORY + { NS_IHISTORY_CONTRACTID, &kNS_ANDROIDHISTORY_CID }, +#else { NS_IHISTORY_CONTRACTID, &kNS_HISTORYSERVICE_CID }, +#endif { NS_PLACESIMPORTEXPORTSERVICE_CONTRACTID, &kNS_PLACESIMPORTEXPORTSERVICE_CID }, { NULL } };