OLD | NEW |
1 /* -*- c++ -*- */ | 1 /* -*- c++ -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 // A class containing information regarding a socket connection to a | 8 // A class containing information regarding a socket connection to a |
9 // service runtime instance. | 9 // service runtime instance. |
10 | 10 |
11 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_SERVICE_RUNTIME_H_ | 11 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_SERVICE_RUNTIME_H_ |
12 #define COMPONENTS_NACL_RENDERER_PLUGIN_SERVICE_RUNTIME_H_ | 12 #define COMPONENTS_NACL_RENDERER_PLUGIN_SERVICE_RUNTIME_H_ |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/process/process_handle.h" | 16 #include "base/process/process_handle.h" |
17 #include "components/nacl/renderer/plugin/utility.h" | 17 #include "components/nacl/renderer/plugin/utility.h" |
18 #include "ipc/ipc_sync_channel.h" | 18 #include "ipc/ipc_sync_channel.h" |
19 #include "native_client/src/include/nacl_macros.h" | 19 #include "native_client/src/include/nacl_macros.h" |
20 #include "native_client/src/include/nacl_scoped_ptr.h" | 20 #include "native_client/src/include/nacl_scoped_ptr.h" |
21 #include "native_client/src/public/imc_types.h" | 21 #include "native_client/src/public/imc_types.h" |
22 #include "native_client/src/shared/platform/nacl_sync.h" | 22 #include "native_client/src/shared/platform/nacl_sync.h" |
23 #include "native_client/src/shared/srpc/nacl_srpc.h" | |
24 #include "ppapi/cpp/completion_callback.h" | 23 #include "ppapi/cpp/completion_callback.h" |
25 | 24 |
26 namespace plugin { | 25 namespace plugin { |
27 | 26 |
28 class ErrorInfo; | 27 class ErrorInfo; |
29 class Plugin; | 28 class Plugin; |
30 class SelLdrLauncherChrome; | 29 class SelLdrLauncherChrome; |
31 class SrpcClient; | |
32 class ServiceRuntime; | 30 class ServiceRuntime; |
33 | 31 |
34 // Struct of params used by StartSelLdr. Use a struct so that callback | 32 // Struct of params used by StartSelLdr. Use a struct so that callback |
35 // creation templates aren't overwhelmed with too many parameters. | 33 // creation templates aren't overwhelmed with too many parameters. |
36 struct SelLdrStartParams { | 34 struct SelLdrStartParams { |
37 SelLdrStartParams(const std::string& url, | 35 SelLdrStartParams(const std::string& url, |
38 const PP_NaClFileInfo& file_info, | 36 const PP_NaClFileInfo& file_info, |
39 PP_NaClAppProcessType process_type) | 37 PP_NaClAppProcessType process_type) |
40 : url(url), | 38 : url(url), |
41 file_info(file_info), | 39 file_info(file_info), |
(...skipping 16 matching lines...) Expand all Loading... |
58 | 56 |
59 // Spawn the sel_ldr instance. | 57 // Spawn the sel_ldr instance. |
60 void StartSelLdr(const SelLdrStartParams& params, | 58 void StartSelLdr(const SelLdrStartParams& params, |
61 pp::CompletionCallback callback); | 59 pp::CompletionCallback callback); |
62 | 60 |
63 // Establish an SrpcClient to the sel_ldr instance and start the nexe. | 61 // Establish an SrpcClient to the sel_ldr instance and start the nexe. |
64 // This function must be called on the main thread. | 62 // This function must be called on the main thread. |
65 // This function must only be called once. | 63 // This function must only be called once. |
66 void StartNexe(); | 64 void StartNexe(); |
67 | 65 |
68 // Starts the application channel to the nexe. | |
69 SrpcClient* SetupAppChannel(); | |
70 | |
71 Plugin* plugin() const { return plugin_; } | 66 Plugin* plugin() const { return plugin_; } |
72 void Shutdown(); | 67 void Shutdown(); |
73 | 68 |
74 bool main_service_runtime() const { return main_service_runtime_; } | 69 bool main_service_runtime() const { return main_service_runtime_; } |
75 | 70 |
76 scoped_ptr<IPC::SyncChannel> TakeTranslatorChannel() { | 71 scoped_ptr<IPC::SyncChannel> TakeTranslatorChannel() { |
77 return scoped_ptr<IPC::SyncChannel>(translator_channel_.release()); | 72 return scoped_ptr<IPC::SyncChannel>(translator_channel_.release()); |
78 } | 73 } |
79 | 74 |
80 // Returns the PID of the subprocess. This PID is needed for copying | 75 // Returns the PID of the subprocess. This PID is needed for copying |
(...skipping 15 matching lines...) Expand all Loading... |
96 | 91 |
97 NaClHandle bootstrap_channel_; | 92 NaClHandle bootstrap_channel_; |
98 | 93 |
99 scoped_ptr<IPC::SyncChannel> translator_channel_; | 94 scoped_ptr<IPC::SyncChannel> translator_channel_; |
100 base::ProcessId process_id_; | 95 base::ProcessId process_id_; |
101 }; | 96 }; |
102 | 97 |
103 } // namespace plugin | 98 } // namespace plugin |
104 | 99 |
105 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_SERVICE_RUNTIME_H_ | 100 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_SERVICE_RUNTIME_H_ |
OLD | NEW |