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 NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ | 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ |
10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ | 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // Returns NULL or the NaClSubprocess of the new helper NaCl module. | 108 // Returns NULL or the NaClSubprocess of the new helper NaCl module. |
109 NaClSubprocess* LoadHelperNaClModule(const nacl::string& helper_url, | 109 NaClSubprocess* LoadHelperNaClModule(const nacl::string& helper_url, |
110 PP_FileHandle file_handle, | 110 PP_FileHandle file_handle, |
111 ErrorInfo* error_info); | 111 ErrorInfo* error_info); |
112 | 112 |
113 // Report an error that was encountered while loading a module. | 113 // Report an error that was encountered while loading a module. |
114 void ReportLoadError(const ErrorInfo& error_info); | 114 void ReportLoadError(const ErrorInfo& error_info); |
115 | 115 |
116 nacl::DescWrapperFactory* wrapper_factory() const { return wrapper_factory_; } | 116 nacl::DescWrapperFactory* wrapper_factory() const { return wrapper_factory_; } |
117 | 117 |
118 // Called back by CallOnMainThread. Dispatches the first enqueued progress | |
119 // event. | |
120 void DispatchProgressEvent(int32_t result); | |
121 | |
122 // A helper function that indicates if |url| can be requested by the document | 118 // A helper function that indicates if |url| can be requested by the document |
123 // under the same-origin policy. Strictly speaking, it may be possible for the | 119 // under the same-origin policy. Strictly speaking, it may be possible for the |
124 // document to request the URL using CORS even if this function returns false. | 120 // document to request the URL using CORS even if this function returns false. |
125 bool DocumentCanRequest(const std::string& url); | 121 bool DocumentCanRequest(const std::string& url); |
126 | 122 |
127 // set_exit_status may be called off the main thread. | 123 // set_exit_status may be called off the main thread. |
128 void set_exit_status(int exit_status); | 124 void set_exit_status(int exit_status); |
129 | 125 |
130 const PPB_NaCl_Private* nacl_interface() const { return nacl_interface_; } | 126 const PPB_NaCl_Private* nacl_interface() const { return nacl_interface_; } |
131 pp::UMAPrivate& uma_interface() { return uma_interface_; } | 127 pp::UMAPrivate& uma_interface() { return uma_interface_; } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // data: URI) is fetched, then the JSON is parsed. Once a valid .nexe is | 200 // data: URI) is fetched, then the JSON is parsed. Once a valid .nexe is |
205 // chosen for the sandbox ISA, any current service runtime is shut down, the | 201 // chosen for the sandbox ISA, any current service runtime is shut down, the |
206 // .nexe is loaded and run. | 202 // .nexe is loaded and run. |
207 | 203 |
208 // Callback used when getting the manifest file as a local file descriptor. | 204 // Callback used when getting the manifest file as a local file descriptor. |
209 void NaClManifestFileDidOpen(int32_t pp_error); | 205 void NaClManifestFileDidOpen(int32_t pp_error); |
210 | 206 |
211 // Processes the JSON manifest string and starts loading the nexe. | 207 // Processes the JSON manifest string and starts loading the nexe. |
212 void ProcessNaClManifest(const nacl::string& manifest_json); | 208 void ProcessNaClManifest(const nacl::string& manifest_json); |
213 | 209 |
214 // Logs timing information to a UMA histogram, and also logs the same timing | |
215 // information divided by the size of the nexe to another histogram. | |
216 void HistogramStartupTimeSmall(const std::string& name, float dt); | |
217 void HistogramStartupTimeMedium(const std::string& name, float dt); | |
218 | |
219 void SetExitStatusOnMainThread(int32_t pp_error, int exit_status); | 210 void SetExitStatusOnMainThread(int32_t pp_error, int exit_status); |
220 | 211 |
221 // Keep track of the NaCl module subprocess that was spun up in the plugin. | 212 // Keep track of the NaCl module subprocess that was spun up in the plugin. |
222 NaClSubprocess main_subprocess_; | 213 NaClSubprocess main_subprocess_; |
223 | 214 |
224 bool uses_nonsfi_mode_; | 215 bool uses_nonsfi_mode_; |
225 | 216 |
226 nacl::DescWrapperFactory* wrapper_factory_; | 217 nacl::DescWrapperFactory* wrapper_factory_; |
227 | 218 |
228 // Original, unresolved URL for the .nexe program to load. | 219 // Original, unresolved URL for the .nexe program to load. |
229 std::string program_url_; | 220 std::string program_url_; |
230 | 221 |
231 pp::CompletionCallbackFactory<Plugin> callback_factory_; | 222 pp::CompletionCallbackFactory<Plugin> callback_factory_; |
232 | 223 |
233 nacl::scoped_ptr<PnaclCoordinator> pnacl_coordinator_; | 224 nacl::scoped_ptr<PnaclCoordinator> pnacl_coordinator_; |
234 | 225 |
235 int64_t time_of_last_progress_event_; | |
236 int exit_status_; | 226 int exit_status_; |
237 | 227 |
238 PP_NaClFileInfo nexe_file_info_; | 228 PP_NaClFileInfo nexe_file_info_; |
239 | 229 |
240 const PPB_NaCl_Private* nacl_interface_; | 230 const PPB_NaCl_Private* nacl_interface_; |
241 pp::UMAPrivate uma_interface_; | 231 pp::UMAPrivate uma_interface_; |
242 }; | 232 }; |
243 | 233 |
244 } // namespace plugin | 234 } // namespace plugin |
245 | 235 |
246 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ | 236 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ |
OLD | NEW |