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