| OLD | NEW |
| 1 // -*- c++ -*- | 1 // -*- c++ -*- |
| 2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 // The portable representation of an instance and root scriptable object. | 6 // The portable representation of an instance and root scriptable object. |
| 7 // The PPAPI version of the plugin instantiates a subclass of this class. | 7 // The PPAPI version of the plugin instantiates a subclass of this class. |
| 8 | 8 |
| 9 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_PLUGIN_H_ | 9 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_PLUGIN_H_ |
| 10 #define COMPONENTS_NACL_RENDERER_PLUGIN_PLUGIN_H_ | 10 #define COMPONENTS_NACL_RENDERER_PLUGIN_PLUGIN_H_ |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // thread of the renderer on this subsequent event delivery. We | 79 // thread of the renderer on this subsequent event delivery. We |
| 80 // should include a time-out at which point we declare the | 80 // should include a time-out at which point we declare the |
| 81 // nacl_ready_state to be done, and let the normal crash detection | 81 // nacl_ready_state to be done, and let the normal crash detection |
| 82 // mechanism(s) take over. | 82 // mechanism(s) take over. |
| 83 void LoadNaClModule(PP_NaClFileInfo file_info, | 83 void LoadNaClModule(PP_NaClFileInfo file_info, |
| 84 bool uses_nonsfi_mode, | 84 bool uses_nonsfi_mode, |
| 85 PP_NaClAppProcessType process_type); | 85 PP_NaClAppProcessType process_type); |
| 86 | 86 |
| 87 // Load support. | 87 // Load support. |
| 88 // A helper SRPC NaCl module can be loaded given a PP_NaClFileInfo. | 88 // A helper SRPC NaCl module can be loaded given a PP_NaClFileInfo. |
| 89 // Blocks until the helper module signals initialization is done. | |
| 90 // Does not update nacl_module_origin(). | 89 // Does not update nacl_module_origin(). |
| 91 // Returns NULL or the NaClSubprocess of the new helper NaCl module. | 90 // Uses the given NaClSubprocess to contain the new SelLdr process. |
| 92 NaClSubprocess* LoadHelperNaClModule(const std::string& helper_url, | 91 // The given callback is called when the loading is complete. |
| 93 PP_NaClFileInfo file_info, | 92 void LoadHelperNaClModule(const std::string& helper_url, |
| 94 ErrorInfo* error_info); | 93 PP_NaClFileInfo file_info, |
| 94 NaClSubprocess* subprocess_to_init, |
| 95 pp::CompletionCallback callback); |
| 95 | 96 |
| 96 // Report an error that was encountered while loading a module. | 97 // Report an error that was encountered while loading a module. |
| 97 void ReportLoadError(const ErrorInfo& error_info); | 98 void ReportLoadError(const ErrorInfo& error_info); |
| 98 | 99 |
| 99 nacl::DescWrapperFactory* wrapper_factory() const { return wrapper_factory_; } | 100 nacl::DescWrapperFactory* wrapper_factory() const { return wrapper_factory_; } |
| 100 | 101 |
| 101 const PPB_NaCl_Private* nacl_interface() const { return nacl_interface_; } | 102 const PPB_NaCl_Private* nacl_interface() const { return nacl_interface_; } |
| 102 | 103 |
| 103 private: | 104 private: |
| 104 NACL_DISALLOW_COPY_AND_ASSIGN(Plugin); | 105 NACL_DISALLOW_COPY_AND_ASSIGN(Plugin); |
| 105 // The browser will invoke the destructor via the pp::Instance | 106 // The browser will invoke the destructor via the pp::Instance |
| 106 // pointer to this object, not from base's Delete(). | 107 // pointer to this object, not from base's Delete(). |
| 107 ~Plugin() override; | 108 ~Plugin() override; |
| 108 | 109 |
| 109 // Shuts down socket connection, service runtime, and receive thread, | 110 // Shuts down socket connection, service runtime, and receive thread, |
| 110 // in this order, for the main nacl subprocess. | 111 // in this order, for the main nacl subprocess. |
| 111 void ShutDownSubprocesses(); | 112 void ShutDownSubprocesses(); |
| 112 | 113 |
| 113 // Loads and starts a helper (e.g. llc, ld) NaCl module. | 114 // Start sel_ldr given the start params. This is invoked on the main thread. |
| 114 // Only to be used from a background (non-main) thread for the PNaCl | 115 void StartSelLdr(ServiceRuntime* service_runtime, |
| 115 // translator. This will fully initialize the |subprocess| if the load was | 116 const SelLdrStartParams& params, |
| 116 // successful. | 117 pp::CompletionCallback callback); |
| 117 bool LoadHelperNaClModuleInternal(NaClSubprocess* subprocess, | |
| 118 const SelLdrStartParams& params); | |
| 119 | |
| 120 // Start sel_ldr from the main thread, given the start params. | |
| 121 // |pp_error| is set by CallOnMainThread (should be PP_OK). | |
| 122 void StartSelLdrOnMainThread(int32_t pp_error, | |
| 123 ServiceRuntime* service_runtime, | |
| 124 const SelLdrStartParams& params, | |
| 125 pp::CompletionCallback callback); | |
| 126 | |
| 127 // Signals that StartSelLdr has finished. | |
| 128 // This is invoked on the main thread. | |
| 129 void SignalStartSelLdrDone(int32_t pp_error, | |
| 130 bool* started, | |
| 131 ServiceRuntime* service_runtime); | |
| 132 | 118 |
| 133 // This is invoked on the main thread. | 119 // This is invoked on the main thread. |
| 134 void StartNexe(int32_t pp_error, ServiceRuntime* service_runtime); | 120 void StartNexe(int32_t pp_error, ServiceRuntime* service_runtime); |
| 135 | 121 |
| 122 // Continuation for LoadHelperNaClModule. This is invoked on the main thread. |
| 123 void StartHelperNexe(int32_t pp_error, |
| 124 NaClSubprocess* subprocess_to_init, |
| 125 pp::CompletionCallback callback); |
| 126 |
| 136 // Callback used when getting the URL for the .nexe file. If the URL loading | 127 // Callback used when getting the URL for the .nexe file. If the URL loading |
| 137 // is successful, the file descriptor is opened and can be passed to sel_ldr | 128 // is successful, the file descriptor is opened and can be passed to sel_ldr |
| 138 // with the sandbox on. | 129 // with the sandbox on. |
| 139 void NexeFileDidOpen(int32_t pp_error); | 130 void NexeFileDidOpen(int32_t pp_error); |
| 140 | 131 |
| 141 // Callback used when a .nexe is translated from bitcode. If the translation | 132 // Callback used when a .nexe is translated from bitcode. If the translation |
| 142 // is successful, the file descriptor is opened and can be passed to sel_ldr | 133 // is successful, the file descriptor is opened and can be passed to sel_ldr |
| 143 // with the sandbox on. | 134 // with the sandbox on. |
| 144 void BitcodeDidTranslate(int32_t pp_error); | 135 void BitcodeDidTranslate(int32_t pp_error); |
| 145 | 136 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 170 | 161 |
| 171 PP_NaClFileInfo nexe_file_info_; | 162 PP_NaClFileInfo nexe_file_info_; |
| 172 | 163 |
| 173 const PPB_NaCl_Private* nacl_interface_; | 164 const PPB_NaCl_Private* nacl_interface_; |
| 174 pp::UMAPrivate uma_interface_; | 165 pp::UMAPrivate uma_interface_; |
| 175 }; | 166 }; |
| 176 | 167 |
| 177 } // namespace plugin | 168 } // namespace plugin |
| 178 | 169 |
| 179 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_PLUGIN_H_ | 170 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_PLUGIN_H_ |
| OLD | NEW |