Bug 1264811 - Use a const reference and a default constructor to simplify the macOS sandbox code; r=haik
authorAlex Gaynor <agaynor@mozilla.com>
Fri, 28 Jul 2017 15:00:22 -0400
changeset 420451 cc29c0db027bca894099bc3148ace3328e710ab8
parent 420402 3b56ac96c918e042194781d0021f5f243babc5e7
child 420452 a417b9d7712d6aab5037904e1103d8d5e2e0a99e
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershaik
bugs1264811
milestone56.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 1264811 - Use a const reference and a default constructor to simplify the macOS sandbox code; r=haik MozReview-Commit-ID: Dtspj7fL9t7
security/sandbox/mac/Sandbox.h
security/sandbox/mac/Sandbox.mm
--- a/security/sandbox/mac/Sandbox.h
+++ b/security/sandbox/mac/Sandbox.h
@@ -36,28 +36,18 @@ typedef struct _MacSandboxPluginInfo {
   std::string pluginPath;
   std::string pluginBinaryPath;
 } MacSandboxPluginInfo;
 
 typedef struct _MacSandboxInfo {
   _MacSandboxInfo()
     : type(MacSandboxType_Default), level(0), hasFilePrivileges(false),
       shouldLog(true) {}
-  _MacSandboxInfo(const struct _MacSandboxInfo& other)
-    : type(other.type), level(other.level),
-      hasFilePrivileges(other.hasFilePrivileges),
-      hasSandboxedProfile(other.hasSandboxedProfile),
-      pluginInfo(other.pluginInfo),
-      appPath(other.appPath), appBinaryPath(other.appBinaryPath),
-      appDir(other.appDir), appTempDir(other.appTempDir),
-      profileDir(other.profileDir), debugWriteDir(other.debugWriteDir),
-      testingReadPath1(other.testingReadPath1),
-      testingReadPath2(other.testingReadPath2),
-      testingReadPath3(other.testingReadPath3),
-      testingReadPath4(other.testingReadPath4), shouldLog(other.shouldLog) {}
+  _MacSandboxInfo(const struct _MacSandboxInfo& other) = default;
+
   MacSandboxType type;
   int32_t level;
   bool hasFilePrivileges;
   bool hasSandboxedProfile;
   MacSandboxPluginInfo pluginInfo;
   std::string appPath;
   std::string appBinaryPath;
   std::string appDir;
@@ -70,13 +60,13 @@ typedef struct _MacSandboxInfo {
   std::string testingReadPath3;
   std::string testingReadPath4;
 
   bool shouldLog;
 } MacSandboxInfo;
 
 namespace mozilla {
 
-bool StartMacSandbox(MacSandboxInfo aInfo, std::string &aErrorMessage);
+bool StartMacSandbox(MacSandboxInfo const &aInfo, std::string &aErrorMessage);
 
 } // namespace mozilla
 
 #endif // mozilla_Sandbox_h
--- a/security/sandbox/mac/Sandbox.mm
+++ b/security/sandbox/mac/Sandbox.mm
@@ -119,17 +119,17 @@ OSXVersion::GetVersionNumber()
     GetSystemVersion(major, minor, bugfix);
     mOSXVersion = MAC_OS_X_VERSION_10_0_HEX + (minor << 4) + bugfix;
   }
   return mOSXVersion;
 }
 
 namespace mozilla {
 
-bool StartMacSandbox(MacSandboxInfo aInfo, std::string &aErrorMessage)
+bool StartMacSandbox(MacSandboxInfo const &aInfo, std::string &aErrorMessage)
 {
   std::vector<const char *> params;
   char *profile = NULL;
   bool profile_needs_free = false;
 
   std::string macOSMinor = std::to_string(OSXVersion::OSXVersionMinor());
 
   if (aInfo.type == MacSandboxType_Plugin) {