Bug 797664 - Don't spew wwhen optional functions aren't found - r=vlad

This commit is contained in:
Jeff Gilbert 2012-12-18 23:16:02 -08:00
parent b6b3f09d5e
commit dbfe12439b
3 changed files with 29 additions and 14 deletions

View File

@ -525,7 +525,8 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
{ (PRFuncPtr*) &mSymbols.fGetTexLevelParameteriv, { "GetTexLevelParameteriv", nullptr } },
{ nullptr, { nullptr } },
};
LoadSymbols(&auxSymbols[0], trygl, prefix);
bool warnOnFailures = DebugMode();
LoadSymbols(&auxSymbols[0], trygl, prefix, warnOnFailures);
}
if (mInitialized) {

View File

@ -4,6 +4,8 @@
#include "GLLibraryLoader.h"
#include "nsDebug.h"
namespace mozilla {
namespace gl {
@ -22,15 +24,22 @@ GLLibraryLoader::OpenLibrary(const char *library)
}
bool
GLLibraryLoader::LoadSymbols(SymLoadStruct *firstStruct, bool tryplatform, const char *prefix)
GLLibraryLoader::LoadSymbols(SymLoadStruct *firstStruct,
bool tryplatform,
const char *prefix,
bool warnOnFailure)
{
return LoadSymbols(mLibrary, firstStruct, tryplatform ? mLookupFunc : nullptr, prefix);
return LoadSymbols(mLibrary,
firstStruct,
tryplatform ? mLookupFunc : nullptr,
prefix,
warnOnFailure);
}
PRFuncPtr
GLLibraryLoader::LookupSymbol(PRLibrary *lib,
const char *sym,
PlatformLookupFunction lookupFunction)
const char *sym,
PlatformLookupFunction lookupFunction)
{
PRFuncPtr res = 0;
@ -55,9 +64,10 @@ GLLibraryLoader::LookupSymbol(PRLibrary *lib,
bool
GLLibraryLoader::LoadSymbols(PRLibrary *lib,
SymLoadStruct *firstStruct,
PlatformLookupFunction lookupFunction,
const char *prefix)
SymLoadStruct *firstStruct,
PlatformLookupFunction lookupFunction,
const char *prefix,
bool warnOnFailure)
{
char sbuf[MAX_SYMBOL_LENGTH * 2];
int failCount = 0;
@ -85,7 +95,9 @@ GLLibraryLoader::LoadSymbols(PRLibrary *lib,
}
if (*ss->symPointer == 0) {
fprintf (stderr, "Can't find symbol '%s'\n", ss->symNames[0]);
if (warnOnFailure)
printf_stderr("Can't find symbol '%s'.\n", ss->symNames[0]);
failCount++;
}

View File

@ -37,8 +37,9 @@ public:
} SymLoadStruct;
bool LoadSymbols(SymLoadStruct *firstStruct,
bool tryplatform = false,
const char *prefix = nullptr);
bool tryplatform = false,
const char *prefix = nullptr,
bool warnOnFailure = true);
/*
* Static version of the functions in this class
@ -47,9 +48,10 @@ public:
const char *symname,
PlatformLookupFunction lookupFunction = nullptr);
static bool LoadSymbols(PRLibrary *lib,
SymLoadStruct *firstStruct,
PlatformLookupFunction lookupFunction = nullptr,
const char *prefix = nullptr);
SymLoadStruct *firstStruct,
PlatformLookupFunction lookupFunction = nullptr,
const char *prefix = nullptr,
bool warnOnFailure = true);
protected:
GLLibraryLoader() {
mLibrary = nullptr;