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

Side by Side Diff: ppapi/nacl_irt/irt_start.cc

Issue 2148633002: Pass around IPC::ChannelHandles instead of raw fds in the NaCl IRT. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 5 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
« no previous file with comments | « ppapi/nacl_irt/irt_ppapi.cc ('k') | ppapi/nacl_irt/plugin_startup.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 // We need nacl_irt_start injection in SFI mode. Non-SFI has a different 7 // We need nacl_irt_start injection in SFI mode. Non-SFI has a different
8 // start up procedure so we just exclude it. 8 // start up procedure so we just exclude it.
9 #if defined(OS_NACL_SFI) 9 #if defined(OS_NACL_SFI)
10 10
11 #include <stdint.h> 11 #include <stdint.h>
12 12
13 #include "base/at_exit.h" 13 #include "base/at_exit.h"
14 #include "native_client/src/public/chrome_main.h" 14 #include "native_client/src/public/chrome_main.h"
15 #include "native_client/src/public/irt_core.h" 15 #include "native_client/src/public/irt_core.h"
16 #include "ppapi/nacl_irt/irt_interfaces.h" 16 #include "ppapi/nacl_irt/irt_interfaces.h"
17 #include "ppapi/nacl_irt/plugin_startup.h" 17 #include "ppapi/nacl_irt/plugin_startup.h"
18 18
19 namespace {
20 IPC::ChannelHandle MakeIPCHandle(const char* name, int fd) {
21 return IPC::ChannelHandle(name,
22 base::FileDescriptor(fd, false /* auto_close */));
23 }
24 } // namespace
25
19 void nacl_irt_start(uint32_t* info) { 26 void nacl_irt_start(uint32_t* info) {
20 nacl_irt_init(info); 27 nacl_irt_init(info);
21 28
22 // Though it isn't referenced here, we must instantiate an AtExitManager. 29 // Though it isn't referenced here, we must instantiate an AtExitManager.
23 base::AtExitManager exit_manager; 30 base::AtExitManager exit_manager;
24 31
25 // In SFI mode, the FDs of IPC channels are NACL_CHROME_DESC_BASE and its 32 // In SFI mode, the FDs of IPC channels are NACL_CHROME_DESC_BASE and its
26 // successor, which is set in nacl_listener.cc. 33 // successor, which is set in nacl_listener.cc.
27 ppapi::SetIPCFileDescriptors( 34 ppapi::SetIPCChannelHandles(
28 NACL_CHROME_DESC_BASE, 35 MakeIPCHandle("NaCl Browser", NACL_CHROME_DESC_BASE),
29 NACL_CHROME_DESC_BASE + 1, 36 MakeIPCHandle("NaCl Renderer", NACL_CHROME_DESC_BASE + 1),
30 NACL_CHROME_DESC_BASE + 2); 37 MakeIPCHandle("NaCl Manifest", NACL_CHROME_DESC_BASE + 2));
31 ppapi::StartUpPlugin(); 38 ppapi::StartUpPlugin();
32 39
33 nacl_irt_enter_user_code(info, chrome_irt_query); 40 nacl_irt_enter_user_code(info, chrome_irt_query);
34 } 41 }
35 42
36 #endif // defined(OS_NACL_SFI) 43 #endif // defined(OS_NACL_SFI)
OLDNEW
« no previous file with comments | « ppapi/nacl_irt/irt_ppapi.cc ('k') | ppapi/nacl_irt/plugin_startup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698