Use base::GlobalDescriptors::kBaseDescriptor instead of magic number 3.

Review URL: https://chromiumcodereview.appspot.com/23814006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221809 0039d316-1c4b-4281-b951-d872f2087c98
parent 3b5c3f15
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#if defined(OS_POSIX) #if defined(OS_POSIX)
#include <signal.h> #include <signal.h>
#include "base/posix/global_descriptors.h"
#endif #endif
namespace { namespace {
...@@ -503,7 +504,8 @@ bool ProxyLauncher::LaunchBrowserHelper(const LaunchState& state, ...@@ -503,7 +504,8 @@ bool ProxyLauncher::LaunchBrowserHelper(const LaunchState& state,
base::FileHandleMappingVector fds; base::FileHandleMappingVector fds;
if (main_launch && automation_proxy_.get()) { if (main_launch && automation_proxy_.get()) {
ipcfd = automation_proxy_->channel()->TakeClientFileDescriptor(); ipcfd = automation_proxy_->channel()->TakeClientFileDescriptor();
fds.push_back(std::make_pair(ipcfd, kPrimaryIPCChannel + 3)); fds.push_back(std::make_pair(ipcfd,
kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
options.fds_to_remap = &fds; options.fds_to_remap = &fds;
} }
#endif #endif
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/file_util.h" #include "base/file_util.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/posix/global_descriptors.h"
#include "base/process/kill.h" #include "base/process/kill.h"
#include "base/process/launch.h" #include "base/process/launch.h"
#include "base/test/test_timeouts.h" #include "base/test/test_timeouts.h"
...@@ -52,7 +53,8 @@ bool LaunchNSSDecrypterChildProcess(const base::FilePath& nss_path, ...@@ -52,7 +53,8 @@ bool LaunchNSSDecrypterChildProcess(const base::FilePath& nss_path,
file_util::ScopedFD client_file_descriptor_closer(&ipcfd); file_util::ScopedFD client_file_descriptor_closer(&ipcfd);
base::FileHandleMappingVector fds_to_map; base::FileHandleMappingVector fds_to_map;
fds_to_map.push_back(std::pair<int,int>(ipcfd, kPrimaryIPCChannel + 3)); fds_to_map.push_back(std::pair<int,int>(ipcfd,
kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
bool debug_on_start = CommandLine::ForCurrentProcess()->HasSwitch( bool debug_on_start = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDebugChildren); switches::kDebugChildren);
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
#include "ipc/ipc_descriptors.h" #include "ipc/ipc_descriptors.h"
#include "ipc/ipc_switches.h" #include "ipc/ipc_switches.h"
#if defined(OS_POSIX)
#include "base/posix/global_descriptors.h"
#endif
// static // static
std::string IPCTestBase::GetChannelName(const std::string& test_client_name) { std::string IPCTestBase::GetChannelName(const std::string& test_client_name) {
DCHECK(!test_client_name.empty()); DCHECK(!test_client_name.empty());
...@@ -102,7 +106,8 @@ bool IPCTestBase::StartClient() { ...@@ -102,7 +106,8 @@ bool IPCTestBase::StartClient() {
const int ipcfd = channel_.get() ? channel_->GetClientFileDescriptor() : const int ipcfd = channel_.get() ? channel_->GetClientFileDescriptor() :
channel_proxy_->GetClientFileDescriptor(); channel_proxy_->GetClientFileDescriptor();
if (ipcfd > -1) if (ipcfd > -1)
fds_to_map.push_back(std::pair<int, int>(ipcfd, kPrimaryIPCChannel + 3)); fds_to_map.push_back(std::pair<int, int>(ipcfd,
kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
client_process_ = MultiProcessTest::SpawnChild(test_main, client_process_ = MultiProcessTest::SpawnChild(test_main,
fds_to_map, fds_to_map,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment