bool
GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts, base::ProcessArchitecture arch)
{
  // If NSPR log files are not requested, we're done.
  const char* origNSPRLogName = PR_GetEnv("NSPR_LOG_FILE");
  const char* origMozLogName = PR_GetEnv("MOZ_LOG_FILE");
  if (!origNSPRLogName && !origMozLogName) {
    return PerformAsyncLaunchInternal(aExtraOpts, arch);
  }

  ++mChildCounter;

  // remember original value so we can restore it.
  // - Note: this code is not called re-entrantly, nor are restoreOrig*LogName
  //   or mChildCounter touched by any other thread, so this is safe.
  static nsAutoCString restoreOrigNSPRLogName;
  static nsAutoCString restoreOrigMozLogName;

  if (origNSPRLogName) {
    if (restoreOrigNSPRLogName.IsEmpty()) {
      restoreOrigNSPRLogName.AssignLiteral("NSPR_LOG_FILE=");
      restoreOrigNSPRLogName.Append(origNSPRLogName);
    }
    SetChildLogName("NSPR_LOG_FILE=", origNSPRLogName);
  }
  if (origMozLogName) {
    if (restoreOrigMozLogName.IsEmpty()) {
      restoreOrigMozLogName.AssignLiteral("MOZ_LOG_FILE=");
      restoreOrigMozLogName.Append(origMozLogName);
    }
    SetChildLogName("MOZ_LOG_FILE=", origMozLogName);
  }

  bool retval = PerformAsyncLaunchInternal(aExtraOpts, arch);

  // Revert to original value
  if (origNSPRLogName) {
    PR_SetEnv(restoreOrigNSPRLogName.get());
  }
  if (origMozLogName) {
    PR_SetEnv(restoreOrigMozLogName.get());
  }

  return retval;
}
Esempio n. 2
0
static nsresult
GetHostPortKey(TransportSecurityInfo* infoObject, nsAutoCString &result)
{
    nsresult rv;

    result.Truncate();

    nsXPIDLCString hostName;
    rv = infoObject->GetHostName(getter_Copies(hostName));
    NS_ENSURE_SUCCESS(rv, rv);

    int32_t port;
    rv = infoObject->GetPort(&port);
    NS_ENSURE_SUCCESS(rv, rv);

    result.Assign(hostName);
    result.Append(':');
    result.AppendInt(port);

    return NS_OK;
}
Esempio n. 3
0
void nsTestLog::AddTrace(const char * aTrace)
{
  mTrace.Append(aTrace);
  mTrace.Append(kTraceDelimiter);
}