xref: /aosp_15_r20/external/cronet/components/nacl/renderer/plugin/nacl_subprocess.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Instances of NaCl modules spun up within the plugin as a subprocess.
6 // This may represent the "main" nacl module, or it may represent helpers
7 // that perform various tasks within the plugin, for example,
8 // a NaCl module for a compiler could be loaded to translate LLVM bitcode
9 // into native code.
10 
11 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_NACL_SUBPROCESS_H_
12 #define COMPONENTS_NACL_RENDERER_PLUGIN_NACL_SUBPROCESS_H_
13 
14 #include <stdarg.h>
15 
16 #include <memory>
17 
18 #include "components/nacl/renderer/plugin/service_runtime.h"
19 
20 namespace plugin {
21 
22 class ServiceRuntime;
23 
24 
25 // A class representing an instance of a NaCl module, loaded by the plugin.
26 class NaClSubprocess {
27  public:
28   NaClSubprocess();
29 
30   NaClSubprocess(const NaClSubprocess&) = delete;
31   NaClSubprocess& operator=(const NaClSubprocess&) = delete;
32 
33   virtual ~NaClSubprocess();
34 
service_runtime()35   ServiceRuntime* service_runtime() const { return service_runtime_.get(); }
set_service_runtime(ServiceRuntime * service_runtime)36   void set_service_runtime(ServiceRuntime* service_runtime) {
37     service_runtime_.reset(service_runtime);
38   }
39 
40   // Fully shut down the subprocess.
41   void Shutdown();
42 
43  private:
44   // The service runtime representing the NaCl module instance.
45   std::unique_ptr<ServiceRuntime> service_runtime_;
46 };
47 
48 }  // namespace plugin
49 
50 #endif  // COMPONENTS_NACL_RENDERER_PLUGIN_NACL_SUBPROCESS_H_
51