[go: nahoru, domu]

blob: 99b93cb8b3e2fc6e67f4572e3745d8f778ac69f5 [file] [log] [blame]
Avi Drissmandb497b32022-09-15 19:47:281// Copyright 2014 The Chromium Authors
hidehiko@chromium.org36ab6822014-04-09 12:13:052// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
avie029c4132015-12-23 06:45:225#include <stdint.h>
6
hidehiko@chromium.org36ab6822014-04-09 12:13:057#include "base/at_exit.h"
Ken Rockotf03d97c952018-07-04 22:08:108#include "mojo/core/embedder/embedder.h"
hidehiko@chromium.org36ab6822014-04-09 12:13:059#include "native_client/src/public/chrome_main.h"
10#include "native_client/src/public/irt_core.h"
mseaborn770b3282015-07-21 16:37:5711#include "ppapi/nacl_irt/irt_interfaces.h"
hidehiko@chromium.org36ab6822014-04-09 12:13:0512#include "ppapi/nacl_irt/plugin_startup.h"
13
amistrya6dcb652016-07-14 00:43:5914namespace {
sammc9bf370c2016-11-14 03:29:0815IPC::ChannelHandle MakeIPCHandle(int fd) {
16 return IPC::ChannelHandle(base::FileDescriptor(fd, false /* auto_close */));
amistrya6dcb652016-07-14 00:43:5917}
18} // namespace
19
hidehiko@chromium.org36ab6822014-04-09 12:13:0520void nacl_irt_start(uint32_t* info) {
21 nacl_irt_init(info);
22
23 // Though it isn't referenced here, we must instantiate an AtExitManager.
24 base::AtExitManager exit_manager;
25
26 // In SFI mode, the FDs of IPC channels are NACL_CHROME_DESC_BASE and its
27 // successor, which is set in nacl_listener.cc.
sammc9bf370c2016-11-14 03:29:0828 ppapi::SetIPCChannelHandles(MakeIPCHandle(NACL_CHROME_DESC_BASE),
29 MakeIPCHandle(NACL_CHROME_DESC_BASE + 1),
30 MakeIPCHandle(NACL_CHROME_DESC_BASE + 2));
sammca6ae9622016-09-06 07:31:0431 // The Mojo EDK must be initialized before using IPC.
Ken Rockotf03d97c952018-07-04 22:08:1032 mojo::core::Init();
hidehiko@chromium.org36ab6822014-04-09 12:13:0533 ppapi::StartUpPlugin();
34
35 nacl_irt_enter_user_code(info, chrome_irt_query);
36}