OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ | 5 #ifndef COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ |
6 #define COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ | 6 #define COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace nacl { | 24 namespace nacl { |
25 | 25 |
26 class ManifestServiceChannel; | 26 class ManifestServiceChannel; |
27 class TrustedPluginChannel; | 27 class TrustedPluginChannel; |
28 | 28 |
29 // NexeLoadManager provides methods for reporting the progress of loading a | 29 // NexeLoadManager provides methods for reporting the progress of loading a |
30 // nexe. | 30 // nexe. |
31 class NexeLoadManager { | 31 class NexeLoadManager { |
32 public: | 32 public: |
| 33 explicit NexeLoadManager(PP_Instance instance); |
33 ~NexeLoadManager(); | 34 ~NexeLoadManager(); |
34 | 35 |
35 static void Create(PP_Instance instance); | |
36 // Non-owning pointer. | |
37 static NexeLoadManager* Get(PP_Instance instance); | |
38 static void Delete(PP_Instance instance); | |
39 | |
40 void NexeFileDidOpen(int32_t pp_error, | 36 void NexeFileDidOpen(int32_t pp_error, |
41 const base::File& file, | 37 const base::File& file, |
42 int32_t http_status, | 38 int32_t http_status, |
43 int64_t nexe_bytes_read, | 39 int64_t nexe_bytes_read, |
44 const std::string& url, | 40 const std::string& url, |
45 base::TimeDelta time_since_open); | 41 base::TimeDelta time_since_open); |
46 void ReportLoadSuccess(const std::string& url, | 42 void ReportLoadSuccess(const std::string& url, |
47 uint64_t loaded_bytes, | 43 uint64_t loaded_bytes, |
48 uint64_t total_bytes); | 44 uint64_t total_bytes); |
49 void ReportLoadError(PP_NaClError error, | 45 void ReportLoadError(PP_NaClError error, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void set_crash_info_shmem_handle(base::SharedMemoryHandle h) { | 116 void set_crash_info_shmem_handle(base::SharedMemoryHandle h) { |
121 crash_info_shmem_handle_ = h; | 117 crash_info_shmem_handle_ = h; |
122 } | 118 } |
123 | 119 |
124 bool nonsfi() const { return nonsfi_; } | 120 bool nonsfi() const { return nonsfi_; } |
125 void set_nonsfi(bool nonsfi) { nonsfi_ = nonsfi; } | 121 void set_nonsfi(bool nonsfi) { nonsfi_ = nonsfi; } |
126 | 122 |
127 private: | 123 private: |
128 DISALLOW_COPY_AND_ASSIGN(NexeLoadManager); | 124 DISALLOW_COPY_AND_ASSIGN(NexeLoadManager); |
129 | 125 |
130 explicit NexeLoadManager(PP_Instance instance); | |
131 | |
132 void ReportDeadNexe(); | 126 void ReportDeadNexe(); |
133 | 127 |
134 // Copies a crash log to the console, one line at a time. | 128 // Copies a crash log to the console, one line at a time. |
135 void CopyCrashLogToJsConsole(const std::string& crash_log); | 129 void CopyCrashLogToJsConsole(const std::string& crash_log); |
136 | 130 |
137 PP_Instance pp_instance_; | 131 PP_Instance pp_instance_; |
138 PP_NaClReadyState nacl_ready_state_; | 132 PP_NaClReadyState nacl_ready_state_; |
139 bool nexe_error_reported_; | 133 bool nexe_error_reported_; |
140 | 134 |
141 std::string program_url_; | 135 std::string program_url_; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 base::SharedMemoryHandle crash_info_shmem_handle_; | 185 base::SharedMemoryHandle crash_info_shmem_handle_; |
192 | 186 |
193 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel_; | 187 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel_; |
194 scoped_ptr<ManifestServiceChannel> manifest_service_channel_; | 188 scoped_ptr<ManifestServiceChannel> manifest_service_channel_; |
195 base::WeakPtrFactory<NexeLoadManager> weak_factory_; | 189 base::WeakPtrFactory<NexeLoadManager> weak_factory_; |
196 }; | 190 }; |
197 | 191 |
198 } // namespace nacl | 192 } // namespace nacl |
199 | 193 |
200 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ | 194 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ |
OLD | NEW |