Bug 534764. Allow separate NSPR logs if requested, in case of interleaving issues; r=mayhemer,wtc

This commit is contained in:
Jason Duell 2011-03-25 19:40:50 -04:00
Родитель b3b6792215
Коммит ab55c48ea0
6 изменённых файлов: 53 добавлений и 0 удалений

Просмотреть файл

@ -50,6 +50,7 @@
#endif
#include "prprf.h"
#include "prenv.h"
#if defined(OS_LINUX)
# define XP_LINUX 1
@ -344,8 +345,54 @@ GeckoChildProcessHost::InitializeChannel()
mon.Notify();
}
PRInt32 GeckoChildProcessHost::mChildCounter = 0;
//
// Wrapper function for handling GECKO_SEPARATE_NSPR_LOGS
//
bool
GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts, base::ProcessArchitecture arch)
{
// If separate NSPR log files are not requested, we're done.
const char* origLogName = PR_GetEnv("NSPR_LOG_FILE");
const char* separateLogs = PR_GetEnv("GECKO_SEPARATE_NSPR_LOGS");
if (!origLogName || !separateLogs || !*separateLogs ||
*separateLogs == '0' || *separateLogs == 'N' || *separateLogs == 'n') {
return PerformAsyncLaunchInternal(aExtraOpts, arch);
}
// We currently have no portable way to launch child with environment
// different than parent. So temporarily change NSPR_LOG_FILE so child
// inherits value we want it to have. (NSPR only looks at NSPR_LOG_FILE at
// startup, so it's 'safe' to play with the parent's environment this way.)
nsCAutoString setChildLogName("NSPR_LOG_FILE=");
setChildLogName.Append(origLogName);
// remember original value so we can restore it.
// - buffer needs to be permanently allocated for PR_SetEnv()
// - Note: this code is not called re-entrantly, nor are restoreOrigLogName
// or mChildCounter touched by any other thread, so this is safe.
static char* restoreOrigLogName = 0;
if (!restoreOrigLogName)
restoreOrigLogName = strdup(PromiseFlatCString(setChildLogName).get());
// Append child-specific postfix to name
setChildLogName.AppendLiteral(".child-");
setChildLogName.AppendInt(++mChildCounter);
// Passing temporary to PR_SetEnv is ok here because env gets copied
// by exec, etc., to permanent storage in child when process launched.
PR_SetEnv(PromiseFlatCString(setChildLogName).get());
bool retval = PerformAsyncLaunchInternal(aExtraOpts, arch);
// Revert to original value
PR_SetEnv(restoreOrigLogName);
return retval;
}
bool
GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExtraOpts, base::ProcessArchitecture arch)
{
// FIXME/cjones: make this work from non-IO threads, too

Просмотреть файл

@ -111,6 +111,8 @@ protected:
bool mChannelInitialized;
FilePath mProcessPath;
static PRInt32 mChildCounter;
#ifdef XP_WIN
void InitWindowsGroupID();
nsString mGroupId;
@ -129,6 +131,10 @@ protected:
private:
DISALLOW_EVIL_CONSTRUCTORS(GeckoChildProcessHost);
// Does the actual work for AsyncLaunch, on the IO thread.
bool PerformAsyncLaunchInternal(std::vector<std::string>& aExtraOpts,
base::ProcessArchitecture arch);
};
} /* namespace ipc */

Двоичный файл не отображается.

Двоичные данные
toolkit/crashreporter/google-breakpad/src/third_party/linux/lib/gflags/libgflags.a поставляемый

Двоичный файл не отображается.

Двоичные данные
toolkit/crashreporter/google-breakpad/src/third_party/linux/lib/glog/libglog.a поставляемый

Двоичный файл не отображается.

Двоичный файл не отображается.