patch for bug 191970 "necko configuration options for footprint reduction" r=seawood sr=dbaron
git-svn-id: svn://10.0.0.236/trunk@141664 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -124,6 +124,10 @@ MOZ_BUILD_ROOT = @MOZ_BUILD_ROOT@
|
||||
|
||||
MOZ_XUL = @MOZ_XUL@
|
||||
|
||||
NECKO_PROTOCOLS = @NECKO_PROTOCOLS@
|
||||
NECKO_DISK_CACHE = @NECKO_DISK_CACHE@
|
||||
NECKO_SMALL_BUFFERS = @NECKO_SMALL_BUFFERS@
|
||||
|
||||
MOZ_NATIVE_ZLIB = @SYSTEM_ZLIB@
|
||||
MOZ_NATIVE_JPEG = @SYSTEM_JPEG@
|
||||
MOZ_NATIVE_PNG = @SYSTEM_PNG@
|
||||
|
||||
@@ -4850,6 +4850,74 @@ fi
|
||||
|
||||
AC_SUBST(MOZ_XUL)
|
||||
|
||||
dnl ========================================================
|
||||
dnl necko configuration options
|
||||
dnl ========================================================
|
||||
|
||||
dnl
|
||||
dnl option to disable various necko protocols
|
||||
dnl
|
||||
NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http jar keyword res viewsource"
|
||||
MOZ_ARG_ENABLE_STRING(necko-protocols,
|
||||
[ --enable-necko-protocols[={http,ftp,default,all,none}]
|
||||
Enable/disable specific protocol handlers],
|
||||
[ for option in `echo $enableval | sed 's/,/ /g'`; do
|
||||
if test "$option" = "yes" || test "$option" = "all"; then
|
||||
NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
|
||||
elif test "$option" = "no" || test "$option" = "none"; then
|
||||
NECKO_PROTOCOLS=""
|
||||
elif test "$option" = "default"; then
|
||||
NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
|
||||
elif test `echo "$option" | grep -c \^-` != 0; then
|
||||
option=`echo $option | sed 's/^-//'`
|
||||
NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
|
||||
else
|
||||
NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
|
||||
fi
|
||||
done],
|
||||
NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
|
||||
dnl Remove dupes
|
||||
if test -n "${_CYGWIN_PERL}"; then
|
||||
NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
|
||||
else
|
||||
NECKO_PROTOCOLS=`${CYGWIN_WRAPPER} ${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
|
||||
fi
|
||||
AC_SUBST(NECKO_PROTOCOLS)
|
||||
for p in $NECKO_PROTOCOLS; do
|
||||
AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
|
||||
done
|
||||
|
||||
dnl
|
||||
dnl option to disable necko's disk cache
|
||||
dnl
|
||||
NECKO_DISK_CACHE=1
|
||||
MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
|
||||
[ --disable-necko-disk-cache
|
||||
Disable necko disk cache],
|
||||
NECKO_DISK_CACHE=,
|
||||
NECKO_DISK_CACHE=1)
|
||||
AC_SUBST(NECKO_DISK_CACHE)
|
||||
if test "$NECKO_DISK_CACHE"; then
|
||||
AC_DEFINE(NECKO_DISK_CACHE)
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl option to minimize size of necko's i/o buffers
|
||||
dnl
|
||||
NECKO_SMALL_BUFFERS=
|
||||
MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
|
||||
[ --enable-necko-small-buffers
|
||||
Minimize size of necko's i/o buffers],
|
||||
NECKO_SMALL_BUFFERS=1,
|
||||
NECKO_SMALL_BUFFERS=)
|
||||
AC_SUBST(NECKO_SMALL_BUFFERS)
|
||||
if test "$NECKO_SMALL_BUFFERS"; then
|
||||
AC_DEFINE(NECKO_SMALL_BUFFERS)
|
||||
fi
|
||||
|
||||
dnl NECKO_ configuration options are not global
|
||||
_NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
|
||||
|
||||
dnl ========================================================
|
||||
dnl =
|
||||
dnl = Cleanup section for misc ordering snafus
|
||||
@@ -5232,7 +5300,7 @@ AC_SUBST(ac_configure_args)
|
||||
dnl Spit out some output
|
||||
dnl ========================================================
|
||||
|
||||
AC_CONFIG_HEADER(gfx/gfx-config.h)
|
||||
AC_CONFIG_HEADER(gfx/gfx-config.h netwerk/necko-config.h)
|
||||
|
||||
# Save the defines header file before autoconf removes it.
|
||||
# (Do not add AC_DEFINE calls after this line.)
|
||||
|
||||
@@ -26,6 +26,8 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = necko
|
||||
|
||||
DIRS = \
|
||||
base \
|
||||
cookie \
|
||||
@@ -44,5 +46,6 @@ ifdef ENABLE_TESTS
|
||||
DIRS += test
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
EXPORTS = necko-config.h
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#ifndef nsIOService_h__
|
||||
#define nsIOService_h__
|
||||
|
||||
#include "necko-config.h"
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsVoidArray.h"
|
||||
@@ -55,7 +57,12 @@
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
#define NS_N(x) (sizeof(x)/sizeof(*x))
|
||||
|
||||
#ifdef NECKO_SMALL_BUFFERS
|
||||
#define NS_NECKO_BUFFER_CACHE_COUNT (10) // Max holdings: 10 * 2k = 20k
|
||||
#else
|
||||
#define NS_NECKO_BUFFER_CACHE_COUNT (24) // Max holdings: 24 * 4k = 96k
|
||||
#endif
|
||||
#define NS_NECKO_15_MINS (15 * 60)
|
||||
|
||||
static const char *gScheme[] = {"chrome", "file", "http", "jar", "resource"};
|
||||
|
||||
@@ -38,10 +38,16 @@
|
||||
#ifndef nsNetSegmentUtils_h__
|
||||
#define nsNetSegmentUtils_h__
|
||||
|
||||
#include "necko-config.h"
|
||||
#include "nsIOService.h"
|
||||
|
||||
#ifdef NECKO_SMALL_BUFFERS
|
||||
#define NET_DEFAULT_SEGMENT_SIZE 2048
|
||||
#define NET_DEFAULT_SEGMENT_COUNT 4
|
||||
#else
|
||||
#define NET_DEFAULT_SEGMENT_SIZE 4096
|
||||
#define NET_DEFAULT_SEGMENT_COUNT 16
|
||||
#endif
|
||||
|
||||
/**
|
||||
* returns preferred allocator for given segment size. NULL implies
|
||||
|
||||
@@ -51,6 +51,9 @@ REQUIRES = xpcom \
|
||||
CPPSRCS = nsNetModule.cpp
|
||||
EXPORTS = nsNetCID.h
|
||||
|
||||
# core necko protocols (about:blank is mandatory)
|
||||
PROTOCOLS = $(filter file ftp http jar res,$(NECKO_PROTOCOLS))
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)neckobase_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)neckodns_s.$(LIB_SUFFIX) \
|
||||
@@ -58,13 +61,10 @@ SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkconv_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkcnvts_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkmime_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkhttp_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkfile_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkftp_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkjar_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkres_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkabout_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkcache_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkabout_s.$(LIB_SUFFIX) \
|
||||
$(foreach d,$(PROTOCOLS), \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nk${d}_s.$(LIB_SUFFIX)) \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
@@ -75,12 +75,9 @@ LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../streamconv/converters \
|
||||
-I$(srcdir)/../mime/src \
|
||||
-I$(srcdir)/../cache/src \
|
||||
-I$(srcdir)/../protocol/http/src \
|
||||
-I$(srcdir)/../protocol/file/src \
|
||||
-I$(srcdir)/../protocol/ftp/src \
|
||||
-I$(srcdir)/../protocol/jar/src \
|
||||
-I$(srcdir)/../protocol/res/src \
|
||||
-I$(srcdir)/../protocol/about/src \
|
||||
$(foreach d,$(PROTOCOLS), \
|
||||
-I$(srcdir)/../protocol/${d}/src) \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_PERF_METRICS
|
||||
@@ -108,4 +105,3 @@ ifdef GNU_CC
|
||||
OS_LIBS += -lws2_32
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "necko-config.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIModule.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
@@ -125,8 +127,37 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDirIndex)
|
||||
#include "nsStreamListenerTee.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStreamListenerTee)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// protocols
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// about:blank is mandatory
|
||||
#include "nsAboutProtocolHandler.h"
|
||||
#include "nsAboutBlank.h"
|
||||
|
||||
#ifdef NECKO_PROTOCOL_about
|
||||
// about
|
||||
#include "nsAboutBloat.h"
|
||||
#include "nsAboutCache.h"
|
||||
#include "nsAboutRedirector.h"
|
||||
#include "nsAboutCacheEntry.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAboutCacheEntry)
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_file
|
||||
// file
|
||||
#include "nsFileProtocolHandler.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFileProtocolHandler, Init)
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_ftp
|
||||
// ftp
|
||||
#include "nsFtpProtocolHandler.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFtpProtocolHandler, Init);
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_http
|
||||
// http/https
|
||||
#include "nsHttpHandler.h"
|
||||
#include "nsHttpAuthManager.h"
|
||||
#include "nsHttpBasicAuth.h"
|
||||
@@ -137,17 +168,24 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpNTLMAuth, Init)
|
||||
#endif
|
||||
#undef LOG
|
||||
#undef LOG_ENABLED
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpHandler, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpsHandler, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpAuthManager, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpBasicAuth)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpDigestAuth)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // !NECKO_PROTOCOL_http
|
||||
|
||||
#ifdef NECKO_PROTOCOL_jar
|
||||
// jar
|
||||
#include "nsJARProtocolHandler.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsJARProtocolHandler, Init)
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_res
|
||||
// resource
|
||||
#include "nsResProtocolHandler.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsResProtocolHandler, Init)
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -176,25 +214,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsIDNService, Init)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "nsFileProtocolHandler.h"
|
||||
#include "nsJARProtocolHandler.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFileProtocolHandler, Init)
|
||||
|
||||
#include "nsJARProtocolHandler.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsJARProtocolHandler, Init)
|
||||
|
||||
#include "nsAboutProtocolHandler.h"
|
||||
#include "nsAboutBlank.h"
|
||||
#include "nsAboutBloat.h"
|
||||
#include "nsAboutCache.h"
|
||||
#include "nsAboutRedirector.h"
|
||||
|
||||
#include "nsAboutCacheEntry.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAboutCacheEntry)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "nsFtpProtocolHandler.h"
|
||||
#include "nsFTPDirListingConv.h"
|
||||
#include "nsGopherDirListingConv.h"
|
||||
#include "nsMultiMixedConv.h"
|
||||
@@ -207,8 +226,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAboutCacheEntry)
|
||||
#include "nsBinHexDecoder.h"
|
||||
#endif
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFtpProtocolHandler, Init);
|
||||
|
||||
nsresult NS_NewFTPDirListingConv(nsFTPDirListingConv** result);
|
||||
nsresult NS_NewGopherDirListingConv(nsGopherDirListingConv** result);
|
||||
nsresult NS_NewMultiMixedConv (nsMultiMixedConv** result);
|
||||
@@ -794,13 +811,16 @@ static const nsModuleComponentInfo gNetModuleInfo[] = {
|
||||
nsMIMEInfoImplConstructor
|
||||
},
|
||||
|
||||
#ifdef NECKO_PROTOCOL_file
|
||||
// from netwerk/protocol/file:
|
||||
{ NS_FILEPROTOCOLHANDLER_CLASSNAME,
|
||||
NS_FILEPROTOCOLHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "file",
|
||||
nsFileProtocolHandlerConstructor
|
||||
},
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_http
|
||||
{ "HTTP Handler",
|
||||
NS_HTTPPROTOCOLHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http",
|
||||
@@ -832,29 +852,36 @@ static const nsModuleComponentInfo gNetModuleInfo[] = {
|
||||
NS_HTTPAUTHMANAGER_CID,
|
||||
NS_HTTPAUTHMANAGER_CONTRACTID,
|
||||
nsHttpAuthManagerConstructor },
|
||||
#endif // !NECKO_PROTOCOL_http
|
||||
|
||||
#ifdef NECKO_PROTOCOL_ftp
|
||||
// from netwerk/protocol/ftp:
|
||||
{ NS_FTPPROTOCOLHANDLER_CLASSNAME,
|
||||
NS_FTPPROTOCOLHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ftp",
|
||||
nsFtpProtocolHandlerConstructor
|
||||
},
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_jar
|
||||
// from netwerk/protocol/jar:
|
||||
{ NS_JARPROTOCOLHANDLER_CLASSNAME,
|
||||
NS_JARPROTOCOLHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "jar",
|
||||
nsJARProtocolHandlerConstructor
|
||||
},
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_res
|
||||
// from netwerk/protocol/res:
|
||||
{ NS_RESPROTOCOLHANDLER_CLASSNAME,
|
||||
NS_RESPROTOCOLHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "resource",
|
||||
nsResProtocolHandlerConstructor
|
||||
},
|
||||
#endif
|
||||
|
||||
// from netwerk/protocol/about:
|
||||
// from netwerk/protocol/about (about:blank is mandatory):
|
||||
{ "About Protocol Handler",
|
||||
NS_ABOUTPROTOCOLHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "about",
|
||||
@@ -865,6 +892,7 @@ static const nsModuleComponentInfo gNetModuleInfo[] = {
|
||||
NS_ABOUT_MODULE_CONTRACTID_PREFIX "blank",
|
||||
nsAboutBlank::Create
|
||||
},
|
||||
#ifdef NECKO_PROTOCOL_about
|
||||
{ "about:bloat",
|
||||
NS_ABOUT_BLOAT_MODULE_CID,
|
||||
NS_ABOUT_MODULE_CONTRACTID_PREFIX "bloat",
|
||||
@@ -911,6 +939,7 @@ static const nsModuleComponentInfo gNetModuleInfo[] = {
|
||||
NS_ABOUT_MODULE_CONTRACTID_PREFIX "cache-entry",
|
||||
nsAboutCacheEntryConstructor
|
||||
},
|
||||
#endif
|
||||
|
||||
{ NS_ISOCKSSOCKETPROVIDER_CLASSNAME,
|
||||
NS_SOCKSSOCKETPROVIDER_CID,
|
||||
|
||||
@@ -26,6 +26,12 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
# secondary necko protocols
|
||||
PROTOCOLS = $(filter data keyword gopher viewsource,$(NECKO_PROTOCOLS))
|
||||
|
||||
# we don't need to build anything here at all if there are no protocols
|
||||
ifdef PROTOCOLS
|
||||
|
||||
MODULE = necko2
|
||||
LIBRARY_NAME = necko2
|
||||
EXPORT_LIBRARY = 1
|
||||
@@ -41,22 +47,21 @@ REQUIRES = xpcom \
|
||||
|
||||
CPPSRCS = nsNetModule2.cpp
|
||||
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkgopher_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkviewsource_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkdata_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nkkwd_s.$(LIB_SUFFIX) \
|
||||
$(foreach d,$(PROTOCOLS), \
|
||||
$(DIST)/lib/$(LIB_PREFIX)nk${d}_s.$(LIB_SUFFIX)) \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../protocol/gopher/src \
|
||||
-I$(srcdir)/../protocol/viewsource/src \
|
||||
-I$(srcdir)/../protocol/keyword/src \
|
||||
-I$(srcdir)/../protocol/data/src \
|
||||
$(foreach d,$(PROTOCOLS), \
|
||||
-I$(srcdir)/../protocol/${d}/src) \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
endif # !PROTOCOLS
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -35,44 +35,65 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "necko-config.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#ifdef NECKO_PROTOCOL_gopher
|
||||
#include "nsGopherHandler.h"
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_viewsource
|
||||
#include "nsViewSourceHandler.h"
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_data
|
||||
#include "nsDataHandler.h"
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_keyword
|
||||
#include "nsKeywordProtocolHandler.h"
|
||||
#endif
|
||||
|
||||
#include "nsNetCID.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Module implementation for the net library
|
||||
|
||||
static const nsModuleComponentInfo gNetModuleInfo[] = {
|
||||
#ifdef NECKO_PROTOCOL_gopher
|
||||
//gopher:
|
||||
{ "The Gopher Protocol Handler",
|
||||
NS_GOPHERHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "gopher",
|
||||
nsGopherHandler::Create
|
||||
},
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_data
|
||||
// from netwerk/protocol/data:
|
||||
{ "Data Protocol Handler",
|
||||
NS_DATAPROTOCOLHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "data",
|
||||
nsDataHandler::Create},
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_keyword
|
||||
// from netwerk/protocol/keyword:
|
||||
{ "The Keyword Protocol Handler",
|
||||
NS_KEYWORDPROTOCOLHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "keyword",
|
||||
nsKeywordProtocolHandler::Create
|
||||
},
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_viewsource
|
||||
// from netwerk/protocol/viewsource:
|
||||
{ "The ViewSource Protocol Handler",
|
||||
NS_VIEWSOURCEHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "view-source",
|
||||
nsViewSourceHandler::Create
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE(necko_secondary_protocols, gNetModuleInfo)
|
||||
|
||||
5
mozilla/netwerk/cache/src/Makefile.in
vendored
5
mozilla/netwerk/cache/src/Makefile.in
vendored
@@ -49,6 +49,10 @@ CPPSRCS = \
|
||||
nsCacheService.cpp \
|
||||
nsCacheSession.cpp \
|
||||
nsMemoryCacheDevice.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef NECKO_DISK_CACHE
|
||||
CPPSRCS += \
|
||||
nsDiskCacheBinding.cpp \
|
||||
nsDiskCacheBlockFile.cpp \
|
||||
nsDiskCacheDevice.cpp \
|
||||
@@ -56,6 +60,7 @@ CPPSRCS = \
|
||||
nsDiskCacheMap.cpp \
|
||||
nsDiskCacheStreams.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
|
||||
30
mozilla/netwerk/cache/src/nsCacheService.cpp
vendored
30
mozilla/netwerk/cache/src/nsCacheService.cpp
vendored
@@ -21,6 +21,7 @@
|
||||
* Gordon Sheridan, 10-February-2001
|
||||
*/
|
||||
|
||||
#include "necko-config.h"
|
||||
|
||||
#include "nsCache.h"
|
||||
#include "nsCacheService.h"
|
||||
@@ -248,6 +249,7 @@ nsCacheProfilePrefObserver::Observe(nsISupports * subject,
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
#ifdef NECKO_DISK_CACHE
|
||||
// which preference changed?
|
||||
if (!nsCRT::strcmp(DISK_CACHE_ENABLE_PREF, NS_ConvertUCS2toUTF8(data).get())) {
|
||||
|
||||
@@ -269,7 +271,10 @@ nsCacheProfilePrefObserver::Observe(nsISupports * subject,
|
||||
// XXX ideally, there should be somekind of user notification that the pref change
|
||||
// XXX won't take effect until the next time the profile changes (browser launch)
|
||||
#endif
|
||||
} else if (!nsCRT::strcmp(MEMORY_CACHE_ENABLE_PREF, NS_ConvertUCS2toUTF8(data).get())) {
|
||||
} else
|
||||
#endif // !NECKO_DISK_CACHE
|
||||
|
||||
if (!nsCRT::strcmp(MEMORY_CACHE_ENABLE_PREF, NS_ConvertUCS2toUTF8(data).get())) {
|
||||
|
||||
rv = prefBranch->GetBoolPref(MEMORY_CACHE_ENABLE_PREF, &mMemoryCacheEnabled);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
@@ -301,6 +306,7 @@ nsCacheProfilePrefObserver::ReadPrefs()
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(prefService, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#ifdef NECKO_DISK_CACHE
|
||||
// read disk cache device prefs
|
||||
rv = prefBranch->GetBoolPref(DISK_CACHE_ENABLE_PREF, &mDiskCacheEnabled);
|
||||
if (NS_FAILED(rv)) rv2 = rv;
|
||||
@@ -326,6 +332,7 @@ nsCacheProfilePrefObserver::ReadPrefs()
|
||||
if (directory)
|
||||
mDiskCacheParentDirectory = do_QueryInterface(directory, &rv);
|
||||
}
|
||||
#endif // !NECKO_DISK_CACHE
|
||||
|
||||
// read memory cache device prefs
|
||||
rv = prefBranch->GetBoolPref(MEMORY_CACHE_ENABLE_PREF, &mMemoryCacheEnabled);
|
||||
@@ -472,8 +479,10 @@ nsCacheService::Shutdown()
|
||||
delete mMemoryDevice;
|
||||
mMemoryDevice = nsnull;
|
||||
|
||||
#ifdef NECKO_DISK_CACHE
|
||||
delete mDiskDevice;
|
||||
mDiskDevice = nsnull;
|
||||
#endif
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -537,6 +546,7 @@ nsCacheService::EvictEntriesForClient(const char * clientID,
|
||||
nsAutoLock lock(mCacheServiceLock);
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
#ifdef NECKO_DISK_CACHE
|
||||
if (storagePolicy == nsICache::STORE_ANYWHERE ||
|
||||
storagePolicy == nsICache::STORE_ON_DISK) {
|
||||
|
||||
@@ -549,6 +559,7 @@ nsCacheService::EvictEntriesForClient(const char * clientID,
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
#endif // !NECKO_DISK_CACHE
|
||||
|
||||
if (storagePolicy == nsICache::STORE_ANYWHERE ||
|
||||
storagePolicy == nsICache::STORE_IN_MEMORY) {
|
||||
@@ -610,6 +621,7 @@ NS_IMETHODIMP nsCacheService::VisitEntries(nsICacheVisitor *visitor)
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
#ifdef NECKO_DISK_CACHE
|
||||
if (mEnableDiskDevice) {
|
||||
if (!mDiskDevice) {
|
||||
rv = CreateDiskDevice();
|
||||
@@ -618,6 +630,7 @@ NS_IMETHODIMP nsCacheService::VisitEntries(nsICacheVisitor *visitor)
|
||||
rv = mDiskDevice->Visit(visitor);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
#endif // !NECKO_DISK_CACHE
|
||||
|
||||
// XXX notify any shutdown process that visitation is complete for THIS visitor.
|
||||
// XXX keep queue of visitors
|
||||
@@ -638,6 +651,7 @@ NS_IMETHODIMP nsCacheService::EvictEntries(nsCacheStoragePolicy storagePolicy)
|
||||
nsresult
|
||||
nsCacheService::CreateDiskDevice()
|
||||
{
|
||||
#ifdef NECKO_DISK_CACHE
|
||||
if (!mEnableDiskDevice) return NS_ERROR_NOT_AVAILABLE;
|
||||
if (mDiskDevice) return NS_OK;
|
||||
|
||||
@@ -661,6 +675,10 @@ nsCacheService::CreateDiskDevice()
|
||||
mDiskDevice = nsnull;
|
||||
}
|
||||
return rv;
|
||||
#else // !NECKO_DISK_CACHE
|
||||
NS_NOTREACHED("nsCacheService::CreateDiskDevice");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -936,6 +954,7 @@ nsCacheService::SearchCacheDevices(nsCString * key, nsCacheStoragePolicy policy)
|
||||
if (!entry &&
|
||||
((policy == nsICache::STORE_ANYWHERE) || (policy == nsICache::STORE_ON_DISK))) {
|
||||
|
||||
#ifdef NECKO_DISK_CACHE
|
||||
if (mEnableDiskDevice) {
|
||||
if (!mDiskDevice) {
|
||||
nsresult rv = CreateDiskDevice();
|
||||
@@ -945,6 +964,7 @@ nsCacheService::SearchCacheDevices(nsCString * key, nsCacheStoragePolicy policy)
|
||||
|
||||
entry = mDiskDevice->FindEntry(key);
|
||||
}
|
||||
#endif // !NECKO_DISK_CACHE
|
||||
}
|
||||
|
||||
return entry;
|
||||
@@ -958,6 +978,7 @@ nsCacheService::EnsureEntryHasDevice(nsCacheEntry * entry)
|
||||
if (device) return device;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
#ifdef NECKO_DISK_CACHE
|
||||
if (entry->IsStreamData() && entry->IsAllowedOnDisk() && mEnableDiskDevice) {
|
||||
// this is the default
|
||||
if (!mDiskDevice) {
|
||||
@@ -972,6 +993,7 @@ nsCacheService::EnsureEntryHasDevice(nsCacheEntry * entry)
|
||||
device = mDiskDevice;
|
||||
}
|
||||
}
|
||||
#endif // !NECKO_DISK_CACHE
|
||||
|
||||
// if we can't use mDiskDevice, try mMemoryDevice
|
||||
if (!device && mEnableMemoryDevice && entry->IsAllowedInMemory()) {
|
||||
@@ -1074,6 +1096,7 @@ nsCacheService::OnProfileShutdown(PRBool cleanse)
|
||||
if (!gService) return;
|
||||
nsAutoLock lock(gService->mCacheServiceLock);
|
||||
|
||||
#ifdef NECKO_DISK_CACHE
|
||||
if (gService->mDiskDevice) {
|
||||
if (cleanse)
|
||||
gService->mDiskDevice->EvictEntries(nsnull);
|
||||
@@ -1084,6 +1107,7 @@ nsCacheService::OnProfileShutdown(PRBool cleanse)
|
||||
gService->mDiskDevice->Shutdown();
|
||||
gService->mEnableDiskDevice = PR_FALSE;
|
||||
}
|
||||
#endif // !NECKO_DISK_CACHE
|
||||
#if 0
|
||||
if (gService->mMemoryDevice) {
|
||||
gService->mMemoryDevice->Shutdown();
|
||||
@@ -1104,6 +1128,7 @@ nsCacheService::OnProfileChanged()
|
||||
gService->mEnableDiskDevice = gService->mObserver->DiskCacheEnabled();
|
||||
gService->mEnableMemoryDevice = gService->mObserver->MemoryCacheEnabled();
|
||||
|
||||
#ifdef NECKO_DISK_CACHE
|
||||
if (gService->mDiskDevice) {
|
||||
gService->mDiskDevice->SetCacheParentDirectory(gService->mObserver->DiskCacheParentDirectory());
|
||||
gService->mDiskDevice->SetCapacity(gService->mObserver->DiskCacheCapacity());
|
||||
@@ -1116,6 +1141,7 @@ nsCacheService::OnProfileChanged()
|
||||
// XXX delete mDiskDevice?
|
||||
}
|
||||
}
|
||||
#endif // !NECKO_DISK_CACHE
|
||||
|
||||
if (gService->mMemoryDevice) {
|
||||
gService->mMemoryDevice->SetCapacity(gService->mObserver->MemoryCacheCapacity());
|
||||
@@ -1144,9 +1170,11 @@ nsCacheService::SetDiskCacheCapacity(PRInt32 capacity)
|
||||
if (!gService) return;
|
||||
nsAutoLock lock(gService->mCacheServiceLock);
|
||||
|
||||
#ifdef NECKO_DISK_CACHE
|
||||
if (gService->mDiskDevice) {
|
||||
gService->mDiskDevice->SetCapacity(capacity);
|
||||
}
|
||||
#endif // !NECKO_DISK_CACHE
|
||||
|
||||
gService->mEnableDiskDevice = gService->mObserver->DiskCacheEnabled();
|
||||
}
|
||||
|
||||
55
mozilla/netwerk/necko-config.h.in
Normal file
55
mozilla/netwerk/necko-config.h.in
Normal file
@@ -0,0 +1,55 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* 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 NPL, 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 NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _NECKO_CONFIG_H_
|
||||
#define _NECKO_CONFIG_H_
|
||||
|
||||
#undef NECKO_DISK_CACHE
|
||||
|
||||
#undef NECKO_SMALL_BUFFERS
|
||||
|
||||
#undef NECKO_PROTOCOL_about
|
||||
#undef NECKO_PROTOCOL_data
|
||||
#undef NECKO_PROTOCOL_file
|
||||
#undef NECKO_PROTOCOL_ftp
|
||||
#undef NECKO_PROTOCOL_gopher
|
||||
#undef NECKO_PROTOCOL_http
|
||||
#undef NECKO_PROTOCOL_jar
|
||||
#undef NECKO_PROTOCOL_keyword
|
||||
#undef NECKO_PROTOCOL_res
|
||||
#undef NECKO_PROTOCOL_viewsource
|
||||
|
||||
#endif
|
||||
@@ -27,7 +27,7 @@ VPATH = @srcdir@
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = necko
|
||||
LIBRARY_NAME = nkkwd_s
|
||||
LIBRARY_NAME = nkkeyword_s
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
pref \
|
||||
|
||||
Reference in New Issue
Block a user