Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: chrome/app/nacl_fork_delegate_linux.cc

Issue 11819022: NaCl: Remove unused "sandboxed_" field and argument from NaClForkDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/app/nacl_fork_delegate_linux.h" 5 #include "chrome/app/nacl_fork_delegate_linux.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <sys/resource.h> 9 #include <sys/resource.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
11 11
12 #include <set> 12 #include <set>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/file_path.h" 17 #include "base/file_path.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/posix/eintr_wrapper.h" 19 #include "base/posix/eintr_wrapper.h"
20 #include "base/posix/unix_domain_socket.h" 20 #include "base/posix/unix_domain_socket.h"
21 #include "base/process_util.h" 21 #include "base/process_util.h"
22 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 22 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
23 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
24 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/nacl_helper_linux.h" 25 #include "chrome/common/nacl_helper_linux.h"
26 26
27 NaClForkDelegate::NaClForkDelegate() 27 NaClForkDelegate::NaClForkDelegate()
28 : status_(kNaClHelperUnused), 28 : status_(kNaClHelperUnused),
29 sandboxed_(false),
30 fd_(-1) {} 29 fd_(-1) {}
31 30
32 /* 31 /*
33 * Note these need to match up with their counterparts in nacl_helper_linux.c 32 * Note these need to match up with their counterparts in nacl_helper_linux.c
34 * and nacl_helper_bootstrap_linux.c. 33 * and nacl_helper_bootstrap_linux.c.
35 */ 34 */
36 const char kNaClHelperReservedAtZero[] = 35 const char kNaClHelperReservedAtZero[] =
37 "--reserved_at_zero=0xXXXXXXXXXXXXXXXX"; 36 "--reserved_at_zero=0xXXXXXXXXXXXXXXXX";
38 const char kNaClHelperRDebug[] = "--r_debug=0xXXXXXXXXXXXXXXXX"; 37 const char kNaClHelperRDebug[] = "--r_debug=0xXXXXXXXXXXXXXXXX";
39 38
40 void NaClForkDelegate::Init(const bool sandboxed, 39 void NaClForkDelegate::Init(const int browserdesc, const int sandboxdesc) {
41 const int browserdesc,
42 const int sandboxdesc) {
43 VLOG(1) << "NaClForkDelegate::Init()"; 40 VLOG(1) << "NaClForkDelegate::Init()";
44 int fds[2]; 41 int fds[2];
45 42
46 sandboxed_ = sandboxed;
47 // Confirm a couple hard-wired assumptions. 43 // Confirm a couple hard-wired assumptions.
48 // The NaCl constants are from chrome/nacl/nacl_linux_helper.h 44 // The NaCl constants are from chrome/nacl/nacl_linux_helper.h
49 DCHECK(kNaClBrowserDescriptor == browserdesc); 45 DCHECK(kNaClBrowserDescriptor == browserdesc);
50 DCHECK(kNaClSandboxDescriptor == sandboxdesc); 46 DCHECK(kNaClSandboxDescriptor == sandboxdesc);
51 47
52 CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0); 48 CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0);
53 base::FileHandleMappingVector fds_to_map; 49 base::FileHandleMappingVector fds_to_map;
54 fds_to_map.push_back(std::make_pair(fds[1], kNaClZygoteDescriptor)); 50 fds_to_map.push_back(std::make_pair(fds[1], kNaClZygoteDescriptor));
55 fds_to_map.push_back(std::make_pair(sandboxdesc, kNaClSandboxDescriptor)); 51 fds_to_map.push_back(std::make_pair(sandboxdesc, kNaClSandboxDescriptor));
56 52
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 158
163 bool NaClForkDelegate::AckChild(const int fd, 159 bool NaClForkDelegate::AckChild(const int fd,
164 const std::string& channel_switch) { 160 const std::string& channel_switch) {
165 int nwritten = HANDLE_EINTR(write(fd, channel_switch.c_str(), 161 int nwritten = HANDLE_EINTR(write(fd, channel_switch.c_str(),
166 channel_switch.length())); 162 channel_switch.length()));
167 if (nwritten != static_cast<int>(channel_switch.length())) { 163 if (nwritten != static_cast<int>(channel_switch.length())) {
168 return false; 164 return false;
169 } 165 }
170 return true; 166 return true;
171 } 167 }
OLDNEW
« no previous file with comments | « chrome/app/nacl_fork_delegate_linux.h ('k') | content/public/common/zygote_fork_delegate_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698