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 11 matching lines...) Expand all Loading... |
22 | 22 |
23 namespace nacl { | 23 namespace nacl { |
24 | 24 |
25 class ManifestServiceChannel; | 25 class ManifestServiceChannel; |
26 class TrustedPluginChannel; | 26 class TrustedPluginChannel; |
27 | 27 |
28 // NexeLoadManager provides methods for reporting the progress of loading a | 28 // NexeLoadManager provides methods for reporting the progress of loading a |
29 // nexe. | 29 // nexe. |
30 class NexeLoadManager { | 30 class NexeLoadManager { |
31 public: | 31 public: |
32 explicit NexeLoadManager(PP_Instance instance); | |
33 ~NexeLoadManager(); | 32 ~NexeLoadManager(); |
34 | 33 |
| 34 static void Create(PP_Instance instance); |
| 35 // Non-owning pointer. |
| 36 static NexeLoadManager* Get(PP_Instance instance); |
| 37 static void Delete(PP_Instance instance); |
| 38 |
35 void NexeFileDidOpen(int32_t pp_error, | 39 void NexeFileDidOpen(int32_t pp_error, |
36 const base::File& file, | 40 const base::File& file, |
37 int32_t http_status, | 41 int32_t http_status, |
38 int64_t nexe_bytes_read, | 42 int64_t nexe_bytes_read, |
39 const std::string& url, | 43 const std::string& url, |
40 base::TimeDelta time_since_open); | 44 base::TimeDelta time_since_open); |
41 void ReportLoadSuccess(const std::string& url, | 45 void ReportLoadSuccess(const std::string& url, |
42 uint64_t loaded_bytes, | 46 uint64_t loaded_bytes, |
43 uint64_t total_bytes); | 47 uint64_t total_bytes); |
44 void ReportLoadError(PP_NaClError error, | 48 void ReportLoadError(PP_NaClError error, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 base::Time pnacl_start_time() const { return pnacl_start_time_; } | 112 base::Time pnacl_start_time() const { return pnacl_start_time_; } |
109 void set_pnacl_start_time(base::Time time) { | 113 void set_pnacl_start_time(base::Time time) { |
110 pnacl_start_time_ = time; | 114 pnacl_start_time_ = time; |
111 } | 115 } |
112 | 116 |
113 const std::string& program_url() const { return program_url_; } | 117 const std::string& program_url() const { return program_url_; } |
114 | 118 |
115 private: | 119 private: |
116 DISALLOW_COPY_AND_ASSIGN(NexeLoadManager); | 120 DISALLOW_COPY_AND_ASSIGN(NexeLoadManager); |
117 | 121 |
| 122 explicit NexeLoadManager(PP_Instance instance); |
| 123 |
118 void ReportDeadNexe(); | 124 void ReportDeadNexe(); |
119 | 125 |
120 // Copies a crash log to the console, one line at a time. | 126 // Copies a crash log to the console, one line at a time. |
121 void CopyCrashLogToJsConsole(const std::string& crash_log); | 127 void CopyCrashLogToJsConsole(const std::string& crash_log); |
122 | 128 |
123 PP_Instance pp_instance_; | 129 PP_Instance pp_instance_; |
124 PP_NaClReadyState nacl_ready_state_; | 130 PP_NaClReadyState nacl_ready_state_; |
125 bool nexe_error_reported_; | 131 bool nexe_error_reported_; |
126 | 132 |
127 std::string program_url_; | 133 std::string program_url_; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 base::Time pnacl_start_time_; | 178 base::Time pnacl_start_time_; |
173 | 179 |
174 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel_; | 180 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel_; |
175 scoped_ptr<ManifestServiceChannel> manifest_service_channel_; | 181 scoped_ptr<ManifestServiceChannel> manifest_service_channel_; |
176 base::WeakPtrFactory<NexeLoadManager> weak_factory_; | 182 base::WeakPtrFactory<NexeLoadManager> weak_factory_; |
177 }; | 183 }; |
178 | 184 |
179 } // namespace nacl | 185 } // namespace nacl |
180 | 186 |
181 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ | 187 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ |
OLD | NEW |