Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
// Charset used by the file system.
const char * nsMsgI18NFileSystemCharset()
{
  /* Get a charset used for the file. */
  static nsAutoCString fileSystemCharset;

  if (fileSystemCharset.IsEmpty()) 
  {
    nsresult rv;
    nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv);
        if (NS_SUCCEEDED(rv)) {
          rv = platformCharset->GetCharset(kPlatformCharsetSel_FileName,
                                           fileSystemCharset);
        }

    if (NS_FAILED(rv)) 
      fileSystemCharset.Assign("ISO-8859-1");
  }
  return fileSystemCharset.get();
}