コード例 #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;
}
コード例 #2
0
//-------------------------------------------------------------------------
void nsFilePicker::GetFileSystemCharset(nsCString & fileSystemCharset)
{
  static nsAutoCString aCharset;
  nsresult rv;

  if (aCharset.Length() < 1) {
    nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv);
    if (NS_SUCCEEDED(rv))
     rv = platformCharset->GetCharset(kPlatformCharsetSel_FileName, aCharset);

    NS_ASSERTION(NS_SUCCEEDED(rv), "error getting platform charset");
    if (NS_FAILED(rv))
      aCharset.AssignLiteral("IBM850");
  }
  fileSystemCharset = aCharset;
}