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#ifndef PPAPI_NACL_IRT_PLUGIN_STARTUP_H_
6#define PPAPI_NACL_IRT_PLUGIN_STARTUP_H_
7
8#include "ppapi/proxy/ppapi_proxy_export.h"
9
10namespace base {
11class Thread;
12class WaitableEvent;
13}  // namespace base
14
15namespace ppapi {
16
17class ManifestService;
18
19// Sets the IPC channels for the browser and the renderer by the given FD
20// numbers. This will be used for non-SFI mode. Must be called before
21// PpapiPluginMain is called.
22PPAPI_PROXY_EXPORT void SetIPCFileDescriptors(
23    int browser_ipc_fd, int renderer_ipc_fd, int manifest_service_fd);
24
25// Runs start up procedure for the plugin.
26// Specifically, start background IO thread for IPC, and prepare
27// shutdown event instance.
28PPAPI_PROXY_EXPORT void StartUpPlugin();
29
30// Returns IPC file descriptor for PPAPI to the browser.
31int GetBrowserIPCFileDescriptor();
32
33// Returns IPC file descriptor for PPAPI to the renderer.
34int GetRendererIPCFileDescriptor();
35
36// Returns the shutdown event instance for the plugin.
37// Must be called after StartUpPlugin().
38base::WaitableEvent* GetShutdownEvent();
39
40// Returns the IOThread for the plugin. Must be called after StartUpPlugin().
41base::Thread* GetIOThread();
42
43// Returns the ManifestService interface. To use this, manifest_service_fd
44// needs to be set via SetIPCFileDescriptors. Must be called after
45// StartUpPlugin().
46// If not available, returns NULL.
47ManifestService* GetManifestService();
48
49}  // namespace ppapi
50
51#endif  // PPAPI_NACL_IRT_PLUGIN_STARTUP_H_
52