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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 void SetExitStatusOnMainThread(int32_t pp_error, int exit_status); | 275 void SetExitStatusOnMainThread(int32_t pp_error, int exit_status); |
276 | 276 |
277 // Keep track of the NaCl module subprocess that was spun up in the plugin. | 277 // Keep track of the NaCl module subprocess that was spun up in the plugin. |
278 NaClSubprocess main_subprocess_; | 278 NaClSubprocess main_subprocess_; |
279 | 279 |
280 bool uses_nonsfi_mode_; | 280 bool uses_nonsfi_mode_; |
281 | 281 |
282 nacl::DescWrapperFactory* wrapper_factory_; | 282 nacl::DescWrapperFactory* wrapper_factory_; |
283 | 283 |
284 // File download support. |nexe_downloader_| can be opened with a specific | 284 // Original, unresolved URL for the .nexe program to load. |
285 // callback to run when the file has been downloaded and is opened for | 285 std::string program_url_; |
286 // reading. We use one downloader for all URL downloads to prevent issuing | 286 |
287 // multiple GETs that might arrive out of order. For example, this will | |
288 // prevent a GET of a NaCl manifest while a .nexe GET is pending. Note that | |
289 // this will also prevent simultaneous handling of multiple .nexes on a page. | |
290 FileDownloader nexe_downloader_; | |
291 pp::CompletionCallbackFactory<Plugin> callback_factory_; | 287 pp::CompletionCallbackFactory<Plugin> callback_factory_; |
292 | 288 |
293 nacl::scoped_ptr<PnaclCoordinator> pnacl_coordinator_; | 289 nacl::scoped_ptr<PnaclCoordinator> pnacl_coordinator_; |
294 | 290 |
295 // Keep track of the FileDownloaders created to fetch urls. | 291 // Keep track of the FileDownloaders created to fetch urls. |
296 std::set<FileDownloader*> url_downloaders_; | 292 std::set<FileDownloader*> url_downloaders_; |
297 // Keep track of file descriptors opened by StreamAsFile(). | 293 // Keep track of file descriptors opened by StreamAsFile(). |
298 // These are owned by the browser. | 294 // These are owned by the browser. |
299 std::map<nacl::string, NaClFileInfoAutoCloser*> url_file_info_map_; | 295 std::map<nacl::string, NaClFileInfoAutoCloser*> url_file_info_map_; |
300 | 296 |
301 // Callback to receive .nexe and .dso download progress notifications. | 297 // Callback to receive .nexe and .dso download progress notifications. |
302 static void UpdateDownloadProgress( | 298 static void UpdateDownloadProgress( |
303 PP_Instance pp_instance, | 299 PP_Instance pp_instance, |
304 PP_Resource pp_resource, | 300 PP_Resource pp_resource, |
305 int64_t bytes_sent, | 301 int64_t bytes_sent, |
306 int64_t total_bytes_to_be_sent, | 302 int64_t total_bytes_to_be_sent, |
307 int64_t bytes_received, | 303 int64_t bytes_received, |
308 int64_t total_bytes_to_be_received); | 304 int64_t total_bytes_to_be_received); |
309 | 305 |
310 // Finds the file downloader which owns the given URL loader. This is used | 306 // Finds the file downloader which owns the given URL loader. This is used |
311 // in UpdateDownloadProgress to map a url loader back to the URL being | 307 // in UpdateDownloadProgress to map a url loader back to the URL being |
312 // downloaded. | 308 // downloaded. |
313 const FileDownloader* FindFileDownloader(PP_Resource url_loader) const; | 309 const FileDownloader* FindFileDownloader(PP_Resource url_loader) const; |
314 | 310 |
315 int64_t time_of_last_progress_event_; | 311 int64_t time_of_last_progress_event_; |
316 int exit_status_; | 312 int exit_status_; |
317 | 313 |
318 // Open times are in microseconds. | |
319 int64_t nexe_open_time_; | |
320 | |
321 PP_Var manifest_data_var_; | 314 PP_Var manifest_data_var_; |
322 int32_t manifest_id_; | 315 int32_t manifest_id_; |
323 | 316 |
| 317 PP_FileHandle nexe_handle_; |
| 318 |
324 const PPB_NaCl_Private* nacl_interface_; | 319 const PPB_NaCl_Private* nacl_interface_; |
325 pp::UMAPrivate uma_interface_; | 320 pp::UMAPrivate uma_interface_; |
326 }; | 321 }; |
327 | 322 |
328 } // namespace plugin | 323 } // namespace plugin |
329 | 324 |
330 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ | 325 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ |
OLD | NEW |