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
3// found in the LICENSE file.
4
5#include "base/at_exit.h"
6#include "native_client/src/public/chrome_main.h"
7#include "native_client/src/public/irt_core.h"
8#include "ppapi/nacl_irt/irt_ppapi.h"
9#include "ppapi/nacl_irt/plugin_startup.h"
10
11void nacl_irt_start(uint32_t* info) {
12  nacl_irt_init(info);
13
14  // Though it isn't referenced here, we must instantiate an AtExitManager.
15  base::AtExitManager exit_manager;
16
17  // In SFI mode, the FDs of IPC channels are NACL_CHROME_DESC_BASE and its
18  // successor, which is set in nacl_listener.cc.
19  ppapi::SetIPCFileDescriptors(
20      NACL_CHROME_DESC_BASE,
21      NACL_CHROME_DESC_BASE + 1,
22      NACL_CHROME_DESC_BASE + 2);
23  ppapi::StartUpPlugin();
24
25  nacl_irt_enter_user_code(info, chrome_irt_query);
26}
27