Skip to content

Commit

Permalink
Bug 568691 part A - register static and binary components using data …
Browse files Browse the repository at this point in the history
…tables rather than programmatic nsIComponentRegistrar methods. This part contains the important needs-review bits of the change: part B contains the mechanical changes to each module in order to actually get a working build. Part C will contain changes necessary to register JS components from .manifest files
  • Loading branch information
bsmedberg committed Jun 10, 2010
1 parent 8ce4ecd commit c611ebc
Show file tree
Hide file tree
Showing 150 changed files with 2,890 additions and 9,722 deletions.
5 changes: 3 additions & 2 deletions config/nsStaticComponents.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@
#ifndef nsStaticComponents_h__
#define nsStaticComponents_h__

#include "mozilla/Module.h"

// These symbols are provided by nsStaticComponents.cpp, and also by other
// static component providers such as nsStaticXULComponents (libxul).

extern nsStaticModuleInfo const *const kPStaticModules;
extern PRUint32 const kStaticModuleCount;
extern mozilla::Module const *const *const kPStaticModules;

#endif
14 changes: 14 additions & 0 deletions content/base/src/nsContentUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsChannelPolicy.h"
#include "nsIContentSecurityPolicy.h"
#include "nsContentDLF.h"
#include "nsHTMLMediaElement.h"

using namespace mozilla::dom;

Expand Down Expand Up @@ -6084,6 +6085,19 @@ nsIContentUtils::FindInternalContentViewer(const char* aType,
return docFactory.forget();
}

if (nsHTMLMediaElement::IsOggEnabled()) {
for (int i = 0; i < NS_ARRAY_LENGTH(nsHTMLMediaElement::gOggTypes); ++i) {
const char* type = nsHTMLMediaElement::gOggTypes[i];
if (!strcmp(aType, type)) {
docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
if (docFactory && aLoaderType) {
*aLoaderType = TYPE_CONTENT;
}
return docFactory.forget();
}
}
}

if (AVAILABLE == pluginEnabled) {
docFactory = do_GetService(PLUGIN_DLF_CONTRACTID);
if (docFactory && aLoaderType) {
Expand Down
24 changes: 15 additions & 9 deletions content/html/content/public/nsHTMLMediaElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class nsHTMLMediaElement : public nsGenericHTMLElement,
// returns a null-terminated list of supported codecs
// in *aSupportedCodecs. This list should not be freed, it is static data.
static CanPlayStatus CanHandleMediaType(const char* aMIMEType,
const char*** aSupportedCodecs);
char const *const ** aSupportedCodecs);

// Returns the CanPlayStatus indicating if we can handle the
// full MIME type including the optional codecs parameter.
Expand All @@ -250,14 +250,20 @@ class nsHTMLMediaElement : public nsGenericHTMLElement,
// false here even if CanHandleMediaType would return true.
static PRBool ShouldHandleMediaType(const char* aMIMEType);

/**
* Initialize data for available media types
*/
static void InitMediaTypes();
/**
* Shutdown data for available media types
*/
static void ShutdownMediaTypes();
static bool IsOggEnabled();
static bool IsOggType(const nsACString& aType);
static const char gOggTypes[3][16];
static char const *const gOggCodecs[3];

static bool IsWaveEnabled();
static bool IsWaveType(const nsACString& aType);
static const char gWaveTypes[4][16];
static char const *const gWaveCodecs[2];

static bool IsWebMEnabled();
static bool IsWebMType(const nsACString& aType);
static const char gWebMTypes[2][17];
static char const *const gWebMCodecs[4];

/**
* Called when a child source element is added to this media element. This
Expand Down
87 changes: 21 additions & 66 deletions content/html/content/src/nsHTMLMediaElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1188,24 +1188,26 @@ void nsHTMLMediaElement::UnbindFromTree(PRBool aDeep,
#ifdef MOZ_OGG
// See http://www.rfc-editor.org/rfc/rfc5334.txt for the definitions
// of Ogg media types and codec types
static const char gOggTypes[][16] = {
const char nsHTMLMediaElement::gOggTypes[3][16] = {
"video/ogg",
"audio/ogg",
"application/ogg"
};

static const char* gOggCodecs[] = {
char const *const nsHTMLMediaElement::gOggCodecs[3] = {
"vorbis",
"theora",
nsnull
};

static PRBool IsOggEnabled()
bool
nsHTMLMediaElement::IsOggEnabled()
{
return nsContentUtils::GetBoolPref("media.ogg.enabled");
}

static PRBool IsOggType(const nsACString& aType)
bool
nsHTMLMediaElement::IsOggType(const nsACString& aType)
{
if (!IsOggEnabled())
return PR_FALSE;
Expand All @@ -1221,24 +1223,26 @@ static PRBool IsOggType(const nsACString& aType)
// See http://www.rfc-editor.org/rfc/rfc2361.txt for the definitions
// of WAVE media types and codec types. However, the audio/vnd.wave
// MIME type described there is not used.
static const char gWaveTypes[][16] = {
const char nsHTMLMediaElement::gWaveTypes[4][16] = {
"audio/x-wav",
"audio/wav",
"audio/wave",
"audio/x-pn-wav"
};

static const char* gWaveCodecs[] = {
char const *const nsHTMLMediaElement::gWaveCodecs[2] = {
"1", // Microsoft PCM Format
nsnull
};

static PRBool IsWaveEnabled()
bool
nsHTMLMediaElement::IsWaveEnabled()
{
return nsContentUtils::GetBoolPref("media.wave.enabled");
}

static PRBool IsWaveType(const nsACString& aType)
bool
nsHTMLMediaElement::IsWaveType(const nsACString& aType)
{
if (!IsWaveEnabled())
return PR_FALSE;
Expand All @@ -1251,24 +1255,26 @@ static PRBool IsWaveType(const nsACString& aType)
#endif

#ifdef MOZ_WEBM
static const char gWebMTypes[][17] = {
const char nsHTMLMediaElement::gWebMTypes[2][17] = {
"video/webm",
"audio/webm"
};

static const char* gWebMCodecs[] = {
char const *const nsHTMLMediaElement::gWebMCodecs[4] = {
"vp8",
"vp8.0",
"vorbis",
nsnull
};

static PRBool IsWebMEnabled()
bool
nsHTMLMediaElement::IsWebMEnabled()
{
return nsContentUtils::GetBoolPref("media.webm.enabled");
}

static PRBool IsWebMType(const nsACString& aType)
bool
nsHTMLMediaElement::IsWebMType(const nsACString& aType)
{
if (!IsWebMEnabled())
return PR_FALSE;
Expand All @@ -1283,7 +1289,7 @@ static PRBool IsWebMType(const nsACString& aType)
/* static */
nsHTMLMediaElement::CanPlayStatus
nsHTMLMediaElement::CanHandleMediaType(const char* aMIMEType,
const char*** aCodecList)
char const *const ** aCodecList)
{
#ifdef MOZ_OGG
if (IsOggType(nsDependentCString(aMIMEType))) {
Expand Down Expand Up @@ -1326,7 +1332,7 @@ PRBool nsHTMLMediaElement::ShouldHandleMediaType(const char* aMIMEType)
}

static PRBool
CodecListContains(const char** aCodecs, const nsAString& aCodec)
CodecListContains(char const *const * aCodecs, const nsAString& aCodec)
{
for (PRInt32 i = 0; aCodecs[i]; ++i) {
if (aCodec.EqualsASCII(aCodecs[i]))
Expand All @@ -1346,7 +1352,7 @@ nsHTMLMediaElement::GetCanPlay(const nsAString& aType)
return CANPLAY_NO;

NS_ConvertUTF16toUTF8 mimeTypeUTF8(mimeType);
const char** supportedCodecs;
char const *const * supportedCodecs;
CanPlayStatus status = CanHandleMediaType(mimeTypeUTF8.get(),
&supportedCodecs);
if (status == CANPLAY_NO)
Expand Down Expand Up @@ -1392,57 +1398,6 @@ nsHTMLMediaElement::CanPlayType(const nsAString& aType, nsAString& aResult)
return NS_OK;
}

/* static */
void nsHTMLMediaElement::InitMediaTypes()
{
nsresult rv;
nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv)) {
#ifdef MOZ_OGG
if (IsOggEnabled()) {
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gOggTypes); i++) {
catMan->AddCategoryEntry("Gecko-Content-Viewers", gOggTypes[i],
"@mozilla.org/content/document-loader-factory;1",
PR_FALSE, PR_TRUE, nsnull);
}
}
#endif
#ifdef MOZ_WEBM
if (IsWebMEnabled()) {
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gWebMTypes); i++) {
catMan->AddCategoryEntry("Gecko-Content-Viewers", gWebMTypes[i],
"@mozilla.org/content/document-loader-factory;1",
PR_FALSE, PR_TRUE, nsnull);
}
}
#endif
}
}

/* static */
void nsHTMLMediaElement::ShutdownMediaTypes()
{
nsresult rv;
nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv)) {
#ifdef MOZ_OGG
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gOggTypes); i++) {
catMan->DeleteCategoryEntry("Gecko-Content-Viewers", gOggTypes[i], PR_FALSE);
}
#endif
#ifdef MOZ_WAVE
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gWaveTypes); i++) {
catMan->DeleteCategoryEntry("Gecko-Content-Viewers", gWaveTypes[i], PR_FALSE);
}
#endif
#ifdef MOZ_WEBM
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gWebMTypes); i++) {
catMan->DeleteCategoryEntry("Gecko-Content-Viewers", gWebMTypes[i], PR_FALSE);
}
#endif
}
}

already_AddRefed<nsMediaDecoder>
nsHTMLMediaElement::CreateDecoder(const nsACString& aType)
{
Expand Down
2 changes: 1 addition & 1 deletion dom/src/json/nsJSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ nsJSON::DecodeInternal(nsIInputStream *aStream,
return NS_OK;
}

NS_IMETHODIMP
nsresult
NS_NewJSON(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
nsJSON* json = new nsJSON();
Expand Down
2 changes: 1 addition & 1 deletion dom/src/json/nsJSON.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class nsJSON : public nsIJSON
nsCOMPtr<nsIURI> mURI;
};

NS_IMETHODIMP
nsresult
NS_NewJSON(nsISupports* aOuter, REFNSIID aIID, void** aResult);

class nsJSONListener : public nsIStreamListener
Expand Down
3 changes: 1 addition & 2 deletions dom/src/jsurl/nsJSProtocolHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
#include "nsNetUtil.h"

#include "nsIComponentManager.h"
#include "nsIGenericFactory.h"
#include "nsIServiceManager.h"
#include "nsIURI.h"
#include "nsIScriptContext.h"
Expand Down Expand Up @@ -1128,7 +1127,7 @@ nsJSProtocolHandler::~nsJSProtocolHandler()

NS_IMPL_ISUPPORTS1(nsJSProtocolHandler, nsIProtocolHandler)

NS_METHOD
nsresult
nsJSProtocolHandler::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
if (aOuter)
Expand Down
2 changes: 1 addition & 1 deletion dom/src/jsurl/nsJSProtocolHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class nsJSProtocolHandler : public nsIProtocolHandler
nsJSProtocolHandler();
virtual ~nsJSProtocolHandler();

static NS_METHOD
static nsresult
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);

nsresult Init();
Expand Down
4 changes: 2 additions & 2 deletions dom/src/storage/nsDOMStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMStorage)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(StorageObsolete)
NS_INTERFACE_MAP_END

NS_IMETHODIMP
nsresult
NS_NewDOMStorage(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
nsDOMStorage* storage = new nsDOMStorage();
Expand All @@ -540,7 +540,7 @@ NS_NewDOMStorage(nsISupports* aOuter, REFNSIID aIID, void** aResult)
return storage->QueryInterface(aIID, aResult);
}

NS_IMETHODIMP
nsresult
NS_NewDOMStorage2(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
nsDOMStorage2* storage = new nsDOMStorage2();
Expand Down
4 changes: 2 additions & 2 deletions dom/src/storage/nsDOMStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,10 @@ class nsDOMStorageEventObsolete : public nsDOMEvent,
nsString mDomain;
};

NS_IMETHODIMP
nsresult
NS_NewDOMStorage(nsISupports* aOuter, REFNSIID aIID, void** aResult);

NS_IMETHODIMP
nsresult
NS_NewDOMStorage2(nsISupports* aOuter, REFNSIID aIID, void** aResult);

nsresult
Expand Down
1 change: 0 additions & 1 deletion dom/src/threads/nsDOMThreadService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#include "nsIDOMNavigator.h"
#include "nsIDOMWindowInternal.h"
#include "nsIEventTarget.h"
#include "nsIGenericFactory.h"
#include "nsIJSContextStack.h"
#include "nsIJSRuntimeService.h"
#include "nsIObserverService.h"
Expand Down
2 changes: 1 addition & 1 deletion ipc/glue/ScopedXREEmbed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ScopedXREEmbed::Start()
localFile = do_QueryInterface(parent);
NS_ENSURE_TRUE(localFile,);

rv = XRE_InitEmbedding(localFile, localFile, nsnull, nsnull, 0);
rv = XRE_InitEmbedding2(localFile, localFile, nsnull);
if (NS_FAILED(rv))
return;

Expand Down
1 change: 1 addition & 0 deletions js/src/xpconnect/idl/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ XPIDLSRCS = \
nsIScriptableInterfaces.idl \
XPCIDispatch.idl \
xpcIJSWeakReference.idl \
xpcIJSGetFactory.idl \
$(NULL)

ifdef XPC_IDISPATCH_SUPPORT
Expand Down
Loading

0 comments on commit c611ebc

Please sign in to comment.