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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // pointer to this object, not from base's Delete(). | 176 // pointer to this object, not from base's Delete(). |
177 ~Plugin(); | 177 ~Plugin(); |
178 | 178 |
179 // Shuts down socket connection, service runtime, and receive thread, | 179 // Shuts down socket connection, service runtime, and receive thread, |
180 // in this order, for the main nacl subprocess. | 180 // in this order, for the main nacl subprocess. |
181 void ShutDownSubprocesses(); | 181 void ShutDownSubprocesses(); |
182 | 182 |
183 // Histogram helper functions, internal to Plugin so they can use | 183 // Histogram helper functions, internal to Plugin so they can use |
184 // uma_interface_ normally. | 184 // uma_interface_ normally. |
185 void HistogramTimeSmall(const std::string& name, int64_t ms); | 185 void HistogramTimeSmall(const std::string& name, int64_t ms); |
186 void HistogramTimeMedium(const std::string& name, int64_t ms); | |
187 void HistogramTimeLarge(const std::string& name, int64_t ms); | |
188 void HistogramSizeKB(const std::string& name, int32_t sample); | |
189 void HistogramEnumerateLoadStatus(PP_NaClError error_code); | 186 void HistogramEnumerateLoadStatus(PP_NaClError error_code); |
190 void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code); | 187 void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code); |
191 | 188 |
192 // Load a nacl module from the file specified in wrapper. | 189 // Load a nacl module from the file specified in wrapper. |
193 // Only to be used from a background (non-main) thread. | 190 // Only to be used from a background (non-main) thread. |
194 // This will fully initialize the |subprocess| if the load was successful. | 191 // This will fully initialize the |subprocess| if the load was successful. |
195 bool LoadNaClModuleFromBackgroundThread(nacl::DescWrapper* wrapper, | 192 bool LoadNaClModuleFromBackgroundThread(nacl::DescWrapper* wrapper, |
196 NaClSubprocess* subprocess, | 193 NaClSubprocess* subprocess, |
197 int32_t manifest_id, | 194 int32_t manifest_id, |
198 const SelLdrStartParams& params); | 195 const SelLdrStartParams& params); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // data: URI) is fetched, then the JSON is parsed. Once a valid .nexe is | 240 // data: URI) is fetched, then the JSON is parsed. Once a valid .nexe is |
244 // chosen for the sandbox ISA, any current service runtime is shut down, the | 241 // chosen for the sandbox ISA, any current service runtime is shut down, the |
245 // .nexe is loaded and run. | 242 // .nexe is loaded and run. |
246 | 243 |
247 // Callback used when getting the manifest file as a local file descriptor. | 244 // Callback used when getting the manifest file as a local file descriptor. |
248 void NaClManifestFileDidOpen(int32_t pp_error); | 245 void NaClManifestFileDidOpen(int32_t pp_error); |
249 | 246 |
250 // Processes the JSON manifest string and starts loading the nexe. | 247 // Processes the JSON manifest string and starts loading the nexe. |
251 void ProcessNaClManifest(const nacl::string& manifest_json); | 248 void ProcessNaClManifest(const nacl::string& manifest_json); |
252 | 249 |
253 // Parses the JSON in |manifest_json| and retains a Manifest in | |
254 // |manifest_| for use by subsequent resource lookups. | |
255 // On success, |true| is returned and |manifest_| is updated to | |
256 // contain a Manifest that is used by SelectNexeURLFromManifest. | |
257 // On failure, |false| is returned, and |manifest_| is unchanged. | |
258 bool SetManifestObject(const nacl::string& manifest_json); | |
259 | |
260 // Logs timing information to a UMA histogram, and also logs the same timing | 250 // Logs timing information to a UMA histogram, and also logs the same timing |
261 // information divided by the size of the nexe to another histogram. | 251 // information divided by the size of the nexe to another histogram. |
262 void HistogramStartupTimeSmall(const std::string& name, float dt); | 252 void HistogramStartupTimeSmall(const std::string& name, float dt); |
263 void HistogramStartupTimeMedium(const std::string& name, float dt); | 253 void HistogramStartupTimeMedium(const std::string& name, float dt); |
264 | 254 |
265 // Callback used when loading a URL for SRPC-based StreamAsFile(). | 255 // Callback used when loading a URL for SRPC-based StreamAsFile(). |
266 void UrlDidOpenForStreamAsFile(int32_t pp_error, | 256 void UrlDidOpenForStreamAsFile(int32_t pp_error, |
267 FileDownloader* url_downloader, | 257 FileDownloader* url_downloader, |
268 pp::CompletionCallback pp_callback); | 258 pp::CompletionCallback pp_callback); |
269 | 259 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 int64_t total_bytes_to_be_received); | 294 int64_t total_bytes_to_be_received); |
305 | 295 |
306 // Finds the file downloader which owns the given URL loader. This is used | 296 // Finds the file downloader which owns the given URL loader. This is used |
307 // in UpdateDownloadProgress to map a url loader back to the URL being | 297 // in UpdateDownloadProgress to map a url loader back to the URL being |
308 // downloaded. | 298 // downloaded. |
309 const FileDownloader* FindFileDownloader(PP_Resource url_loader) const; | 299 const FileDownloader* FindFileDownloader(PP_Resource url_loader) const; |
310 | 300 |
311 int64_t time_of_last_progress_event_; | 301 int64_t time_of_last_progress_event_; |
312 int exit_status_; | 302 int exit_status_; |
313 | 303 |
314 PP_Var manifest_data_var_; | |
315 int32_t manifest_id_; | 304 int32_t manifest_id_; |
316 | 305 |
317 PP_FileHandle nexe_handle_; | 306 PP_FileHandle nexe_handle_; |
318 | 307 |
319 const PPB_NaCl_Private* nacl_interface_; | 308 const PPB_NaCl_Private* nacl_interface_; |
320 pp::UMAPrivate uma_interface_; | 309 pp::UMAPrivate uma_interface_; |
321 }; | 310 }; |
322 | 311 |
323 } // namespace plugin | 312 } // namespace plugin |
324 | 313 |
325 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ | 314 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ |
OLD | NEW |