Bug 1189967 - Be slightly more explicit about some conversions to std::wstring. r=nfroyd
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 21 Aug 2015 16:01:47 +0900
changeset 258864 73bd8b894c6bf6b07b4a94afb87af187d013c5aa
parent 258863 ff478557098fff77c343431da173edafc6c04be4
child 258865 6fa4f576849106db60b470ba3fe87cbe0c22d161
push id64082
push usermh@glandium.org
push dateSun, 23 Aug 2015 13:24:24 +0000
treeherdermozilla-inbound@187097ffcdc6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnfroyd
bugs1189967
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1189967 - Be slightly more explicit about some conversions to std::wstring. r=nfroyd
dom/plugins/ipc/PluginProcessParent.cpp
ipc/chromium/src/base/command_line.h
ipc/chromium/src/base/file_path.h
ipc/glue/GeckoChildProcessHost.cpp
toolkit/crashreporter/nsExceptionHandler.cpp
--- a/dom/plugins/ipc/PluginProcessParent.cpp
+++ b/dom/plugins/ipc/PluginProcessParent.cpp
@@ -62,17 +62,17 @@ AddSandboxAllowedFile(vector<std::wstrin
     rv = userDir->GetPath(userDirPath);
     if (NS_WARN_IF(NS_FAILED(rv))) {
         return;
     }
 
     if (!aSuffix.IsEmpty()) {
         userDirPath.Append(aSuffix);
     }
-    aAllowedFiles.push_back(userDirPath.get());
+    aAllowedFiles.push_back(std::wstring(userDirPath.get()));
     return;
 }
 
 static void
 AddSandboxAllowedFiles(int32_t aSandboxLevel,
                        vector<std::wstring>& aAllowedFilesRead,
                        vector<std::wstring>& aAllowedFilesReadWrite)
 {
--- a/ipc/chromium/src/base/command_line.h
+++ b/ipc/chromium/src/base/command_line.h
@@ -114,16 +114,22 @@ class CommandLine {
   // Appends the given switch string (preceded by a space and a switch
   // prefix) to the given string, with the given value attached.
   void AppendSwitchWithValue(const std::wstring& switch_string,
                              const std::wstring& value_string);
 
   // Append a loose value to the command line.
   void AppendLooseValue(const std::wstring& value);
 
+#if defined(OS_WIN)
+  void AppendLooseValue(const wchar_t* value) {
+    AppendLooseValue(std::wstring(value));
+  }
+#endif
+
   // Append the arguments from another command line to this one.
   // If |include_program| is true, include |other|'s program as well.
   void AppendArguments(const CommandLine& other,
                        bool include_program);
 
   // On POSIX systems it's common to run processes via a wrapper (like
   // "valgrind" or "gdb --args").
   void PrependWrapper(const std::wstring& wrapper);
--- a/ipc/chromium/src/base/file_path.h
+++ b/ipc/chromium/src/base/file_path.h
@@ -111,16 +111,20 @@ class FilePath {
 
   // The character used to identify a file extension.
   static const CharType kExtensionSeparator;
 
   FilePath() {}
   FilePath(const FilePath& that) : path_(that.path_) {}
   explicit FilePath(const StringType& path) : path_(path) {}
 
+#if defined(OS_WIN)
+  explicit FilePath(const wchar_t* path) : path_(path) {}
+#endif
+
   FilePath& operator=(const FilePath& that) {
     path_ = that.path_;
     return *this;
   }
 
   bool operator==(const FilePath& that) const {
     return path_ == that.path_;
   }
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -588,17 +588,17 @@ MaybeAddNsprLogFileAccess(std::vector<st
   if (NS_WARN_IF(NS_FAILED(rv))) {
       return;
   }
 
   // Update the environment variable as well as adding the rule, because the
   // Chromium sandbox can only allow access to fully qualified file paths. This
   // only affects the environment for the child process we're about to create,
   // because this will get reset to the original value in PerformAsyncLaunch.
-  aAllowedFilesReadWrite.push_back(resolvedFilePath.get());
+  aAllowedFilesReadWrite.push_back(std::wstring(resolvedFilePath.get()));
   nsAutoCString resolvedEnvVar("NSPR_LOG_FILE=");
   AppendUTF16toUTF8(resolvedFilePath, resolvedEnvVar);
   PR_SetEnv(resolvedEnvVar.get());
 }
 #endif
 
 bool
 GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExtraOpts, base::ProcessArchitecture arch)
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -420,16 +420,22 @@ my_inttostring(intmax_t t, char* buffer,
 #endif
 
 #ifdef XP_WIN
 static void
 CreateFileFromPath(const xpstring& path, nsIFile** file)
 {
   NS_NewLocalFile(nsDependentString(path.c_str()), false, file);
 }
+
+static void
+CreateFileFromPath(const wchar_t* path, nsIFile** file)
+{
+  CreateFileFromPath(std::wstring(path), file);
+}
 #else
 static void
 CreateFileFromPath(const xpstring& path, nsIFile** file)
 {
   NS_NewNativeLocalFile(nsDependentCString(path.c_str()), false, file);
 }
 #endif
 
@@ -1222,16 +1228,18 @@ nsresult SetExceptionHandler(nsIFile* aX
 #ifdef XP_WIN
   previousUnhandledExceptionFilter = GetUnhandledExceptionFilter();
 #endif
 
   gExceptionHandler = new google_breakpad::
     ExceptionHandler(
 #ifdef XP_LINUX
                      descriptor,
+#elif defined(XP_WIN)
+                     std::wstring(tempPath.get()),
 #else
                      tempPath.get(),
 #endif
 
 #ifdef XP_WIN
                      FPEFilter,
 #else
                      Filter,
@@ -1336,17 +1344,17 @@ bool GetMinidumpPath(nsAString& aPath)
 }
 
 nsresult SetMinidumpPath(const nsAString& aPath)
 {
   if (!gExceptionHandler)
     return NS_ERROR_NOT_INITIALIZED;
 
 #ifdef XP_WIN32
-  gExceptionHandler->set_dump_path(char16ptr_t(aPath.BeginReading()));
+  gExceptionHandler->set_dump_path(std::wstring(char16ptr_t(aPath.BeginReading())));
 #elif defined(XP_LINUX)
   gExceptionHandler->set_minidump_descriptor(
       MinidumpDescriptor(NS_ConvertUTF16toUTF8(aPath).BeginReading()));
 #else
   gExceptionHandler->set_dump_path(NS_ConvertUTF16toUTF8(aPath).BeginReading());
 #endif
   return NS_OK;
 }
@@ -2728,17 +2736,17 @@ OOPInit()
 
 #if defined(XP_WIN)
   childCrashNotifyPipe =
     PR_smprintf("\\\\.\\pipe\\gecko-crash-server-pipe.%i",
                 static_cast<int>(::GetCurrentProcessId()));
 
   const std::wstring dumpPath = gExceptionHandler->dump_path();
   crashServer = new CrashGenerationServer(
-    NS_ConvertASCIItoUTF16(childCrashNotifyPipe).get(),
+    std::wstring(NS_ConvertASCIItoUTF16(childCrashNotifyPipe).get()),
     nullptr,                    // default security attributes
     nullptr, nullptr,           // we don't care about process connect here
     OnChildProcessDumpRequested, nullptr,
     nullptr, nullptr,           // we don't care about process exit here
     nullptr, nullptr,           // we don't care about upload request here
     true,                       // automatically generate dumps
     &dumpPath);