OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifdef _MSC_VER | 5 #ifdef _MSC_VER |
6 // Do not warn about use of std::copy with raw pointers. | 6 // Do not warn about use of std::copy with raw pointers. |
7 #pragma warning(disable : 4996) | 7 #pragma warning(disable : 4996) |
8 #endif | 8 #endif |
9 | 9 |
10 #include "ppapi/native_client/src/trusted/plugin/plugin.h" | 10 #include "ppapi/native_client/src/trusted/plugin/plugin.h" |
(...skipping 16 matching lines...) Expand all Loading... | |
27 #include "native_client/src/shared/platform/nacl_check.h" | 27 #include "native_client/src/shared/platform/nacl_check.h" |
28 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | 28 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
29 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" | 29 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" |
30 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" | 30 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" |
31 | 31 |
32 #include "ppapi/c/pp_errors.h" | 32 #include "ppapi/c/pp_errors.h" |
33 #include "ppapi/c/ppb_console.h" | 33 #include "ppapi/c/ppb_console.h" |
34 #include "ppapi/c/ppb_var.h" | 34 #include "ppapi/c/ppb_var.h" |
35 #include "ppapi/c/ppp_instance.h" | 35 #include "ppapi/c/ppp_instance.h" |
36 #include "ppapi/c/private/ppb_nacl_private.h" | 36 #include "ppapi/c/private/ppb_nacl_private.h" |
37 #include "ppapi/c/private/ppb_uma_private.h" | |
38 #include "ppapi/cpp/dev/url_util_dev.h" | 37 #include "ppapi/cpp/dev/url_util_dev.h" |
39 #include "ppapi/cpp/module.h" | 38 #include "ppapi/cpp/module.h" |
40 #include "ppapi/cpp/text_input_controller.h" | 39 #include "ppapi/cpp/text_input_controller.h" |
41 | 40 |
42 #include "ppapi/native_client/src/trusted/plugin/file_utils.h" | 41 #include "ppapi/native_client/src/trusted/plugin/file_utils.h" |
43 #include "ppapi/native_client/src/trusted/plugin/json_manifest.h" | 42 #include "ppapi/native_client/src/trusted/plugin/json_manifest.h" |
44 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h" | 43 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h" |
45 #include "ppapi/native_client/src/trusted/plugin/nacl_subprocess.h" | 44 #include "ppapi/native_client/src/trusted/plugin/nacl_subprocess.h" |
46 #include "ppapi/native_client/src/trusted/plugin/nexe_arch.h" | 45 #include "ppapi/native_client/src/trusted/plugin/nexe_arch.h" |
47 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" | 46 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" |
(...skipping 23 matching lines...) Expand all Loading... | |
71 const size_t kNaClManifestMaxFileBytes = 1024 * 1024; | 70 const size_t kNaClManifestMaxFileBytes = 1024 * 1024; |
72 | 71 |
73 // Define an argument name to enable 'dev' interfaces. To make sure it doesn't | 72 // Define an argument name to enable 'dev' interfaces. To make sure it doesn't |
74 // collide with any user-defined HTML attribute, make the first character '@'. | 73 // collide with any user-defined HTML attribute, make the first character '@'. |
75 const char* const kDevAttribute = "@dev"; | 74 const char* const kDevAttribute = "@dev"; |
76 | 75 |
77 // URL schemes that we treat in special ways. | 76 // URL schemes that we treat in special ways. |
78 const char* const kChromeExtensionUriScheme = "chrome-extension"; | 77 const char* const kChromeExtensionUriScheme = "chrome-extension"; |
79 const char* const kDataUriScheme = "data"; | 78 const char* const kDataUriScheme = "data"; |
80 | 79 |
80 const PPB_NaCl_Private* GetNaClInterface() { | |
81 pp::Module *module = pp::Module::Get(); | |
82 CHECK(module); | |
83 return static_cast<const PPB_NaCl_Private*>( | |
84 module->GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE)); | |
85 } | |
86 | |
bbudge
2014/01/08 19:01:49
Did you intentionally move this here? It seems bet
elijahtaylor1
2014/01/08 23:59:41
I don't know how this ended up here. Done.
| |
81 // Up to 20 seconds | 87 // Up to 20 seconds |
82 const int64_t kTimeSmallMin = 1; // in ms | 88 const int64_t kTimeSmallMin = 1; // in ms |
83 const int64_t kTimeSmallMax = 20000; // in ms | 89 const int64_t kTimeSmallMax = 20000; // in ms |
84 const uint32_t kTimeSmallBuckets = 100; | 90 const uint32_t kTimeSmallBuckets = 100; |
85 | 91 |
86 // Up to 3 minutes, 20 seconds | 92 // Up to 3 minutes, 20 seconds |
87 const int64_t kTimeMediumMin = 10; // in ms | 93 const int64_t kTimeMediumMin = 10; // in ms |
88 const int64_t kTimeMediumMax = 200000; // in ms | 94 const int64_t kTimeMediumMax = 200000; // in ms |
89 const uint32_t kTimeMediumBuckets = 100; | 95 const uint32_t kTimeMediumBuckets = 100; |
90 | 96 |
91 // Up to 33 minutes. | 97 // Up to 33 minutes. |
92 const int64_t kTimeLargeMin = 100; // in ms | 98 const int64_t kTimeLargeMin = 100; // in ms |
93 const int64_t kTimeLargeMax = 2000000; // in ms | 99 const int64_t kTimeLargeMax = 2000000; // in ms |
94 const uint32_t kTimeLargeBuckets = 100; | 100 const uint32_t kTimeLargeBuckets = 100; |
95 | 101 |
96 const int64_t kSizeKBMin = 1; | 102 const int64_t kSizeKBMin = 1; |
97 const int64_t kSizeKBMax = 512*1024; // very large .nexe | 103 const int64_t kSizeKBMax = 512*1024; // very large .nexe |
98 const uint32_t kSizeKBBuckets = 100; | 104 const uint32_t kSizeKBBuckets = 100; |
99 | 105 |
100 const PPB_NaCl_Private* GetNaClInterface() { | |
101 pp::Module *module = pp::Module::Get(); | |
102 CHECK(module); | |
103 return static_cast<const PPB_NaCl_Private*>( | |
104 module->GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE)); | |
105 } | |
106 | |
107 const PPB_UMA_Private* GetUMAInterface() { | |
108 pp::Module *module = pp::Module::Get(); | |
109 CHECK(module); | |
110 return static_cast<const PPB_UMA_Private*>( | |
111 module->GetBrowserInterface(PPB_UMA_PRIVATE_INTERFACE)); | |
112 } | |
113 | |
114 void HistogramTimeSmall(const std::string& name, int64_t ms) { | |
115 if (ms < 0) return; | |
116 | |
117 const PPB_UMA_Private* ptr = GetUMAInterface(); | |
118 if (ptr == NULL) return; | |
119 | |
120 ptr->HistogramCustomTimes(pp::Var(name).pp_var(), | |
121 ms, | |
122 kTimeSmallMin, kTimeSmallMax, | |
123 kTimeSmallBuckets); | |
124 } | |
125 | |
126 void HistogramTimeMedium(const std::string& name, int64_t ms) { | |
127 if (ms < 0) return; | |
128 | |
129 const PPB_UMA_Private* ptr = GetUMAInterface(); | |
130 if (ptr == NULL) return; | |
131 | |
132 ptr->HistogramCustomTimes(pp::Var(name).pp_var(), | |
133 ms, | |
134 kTimeMediumMin, kTimeMediumMax, | |
135 kTimeMediumBuckets); | |
136 } | |
137 | |
138 void HistogramTimeLarge(const std::string& name, int64_t ms) { | |
139 if (ms < 0) return; | |
140 | |
141 const PPB_UMA_Private* ptr = GetUMAInterface(); | |
142 if (ptr == NULL) return; | |
143 | |
144 ptr->HistogramCustomTimes(pp::Var(name).pp_var(), | |
145 ms, | |
146 kTimeLargeMin, kTimeLargeMax, | |
147 kTimeLargeBuckets); | |
148 } | |
149 | |
150 void HistogramSizeKB(const std::string& name, int32_t sample) { | |
151 if (sample < 0) return; | |
152 | |
153 const PPB_UMA_Private* ptr = GetUMAInterface(); | |
154 if (ptr == NULL) return; | |
155 | |
156 ptr->HistogramCustomCounts(pp::Var(name).pp_var(), | |
157 sample, | |
158 kSizeKBMin, kSizeKBMax, | |
159 kSizeKBBuckets); | |
160 } | |
161 | |
162 void HistogramEnumerate(const std::string& name, int sample, int maximum, | |
163 int out_of_range_replacement) { | |
164 if (sample < 0 || sample >= maximum) { | |
165 if (out_of_range_replacement < 0) | |
166 // No replacement for bad input, abort. | |
167 return; | |
168 else | |
169 // Use a specific value to signal a bad input. | |
170 sample = out_of_range_replacement; | |
171 } | |
172 const PPB_UMA_Private* ptr = GetUMAInterface(); | |
173 if (ptr == NULL) return; | |
174 ptr->HistogramEnumeration(pp::Var(name).pp_var(), sample, maximum); | |
175 } | |
176 | |
177 void HistogramEnumerateOsArch(const std::string& sandbox_isa) { | |
178 enum NaClOSArch { | |
179 kNaClLinux32 = 0, | |
180 kNaClLinux64, | |
181 kNaClLinuxArm, | |
182 kNaClMac32, | |
183 kNaClMac64, | |
184 kNaClMacArm, | |
185 kNaClWin32, | |
186 kNaClWin64, | |
187 kNaClWinArm, | |
188 kNaClOSArchMax | |
189 }; | |
190 | |
191 NaClOSArch os_arch = kNaClOSArchMax; | |
192 #if NACL_LINUX | |
193 os_arch = kNaClLinux32; | |
194 #elif NACL_OSX | |
195 os_arch = kNaClMac32; | |
196 #elif NACL_WINDOWS | |
197 os_arch = kNaClWin32; | |
198 #endif | |
199 | |
200 if (sandbox_isa == "x86-64") | |
201 os_arch = static_cast<NaClOSArch>(os_arch + 1); | |
202 if (sandbox_isa == "arm") | |
203 os_arch = static_cast<NaClOSArch>(os_arch + 2); | |
204 | |
205 HistogramEnumerate("NaCl.Client.OSArch", os_arch, kNaClOSArchMax, -1); | |
206 } | |
207 | |
208 void HistogramEnumerateLoadStatus(PluginErrorCode error_code, | |
209 bool is_installed) { | |
210 HistogramEnumerate("NaCl.LoadStatus.Plugin", error_code, ERROR_MAX, | |
211 ERROR_UNKNOWN); | |
212 | |
213 // Gather data to see if being installed changes load outcomes. | |
214 const char* name = is_installed ? "NaCl.LoadStatus.Plugin.InstalledApp" : | |
215 "NaCl.LoadStatus.Plugin.NotInstalledApp"; | |
216 HistogramEnumerate(name, error_code, ERROR_MAX, | |
217 ERROR_UNKNOWN); | |
218 } | |
219 | |
220 void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code, | |
221 bool is_installed) { | |
222 HistogramEnumerate("NaCl.LoadStatus.SelLdr", error_code, NACL_ERROR_CODE_MAX, | |
223 LOAD_STATUS_UNKNOWN); | |
224 | |
225 // Gather data to see if being installed changes load outcomes. | |
226 const char* name = is_installed ? "NaCl.LoadStatus.SelLdr.InstalledApp" : | |
227 "NaCl.LoadStatus.SelLdr.NotInstalledApp"; | |
228 HistogramEnumerate(name, error_code, NACL_ERROR_CODE_MAX, | |
229 LOAD_STATUS_UNKNOWN); | |
230 } | |
231 | |
232 void HistogramEnumerateManifestIsDataURI(bool is_data_uri) { | |
233 HistogramEnumerate("NaCl.Manifest.IsDataURI", is_data_uri, 2, -1); | |
234 } | |
235 | |
236 void HistogramHTTPStatusCode(const std::string& name, int status) { | |
237 // Log the status codes in rough buckets - 1XX, 2XX, etc. | |
238 int sample = status / 100; | |
239 // HTTP status codes only go up to 5XX, using "6" to indicate an internal | |
240 // error. | |
241 // Note: installed files may have "0" for a status code. | |
242 if (status < 0 || status >= 600) | |
243 sample = 6; | |
244 HistogramEnumerate(name, sample, 7, 6); | |
245 } | |
246 | |
247 } // namespace | 106 } // namespace |
248 | 107 |
249 void Plugin::AddPropertyGet(const nacl::string& prop_name, | 108 void Plugin::AddPropertyGet(const nacl::string& prop_name, |
250 Plugin::PropertyGetter getter) { | 109 Plugin::PropertyGetter getter) { |
251 PLUGIN_PRINTF(("Plugin::AddPropertyGet (prop_name='%s')\n", | 110 PLUGIN_PRINTF(("Plugin::AddPropertyGet (prop_name='%s')\n", |
252 prop_name.c_str())); | 111 prop_name.c_str())); |
253 property_getters_[nacl::string(prop_name)] = getter; | 112 property_getters_[nacl::string(prop_name)] = getter; |
254 } | 113 } |
255 | 114 |
256 bool Plugin::HasProperty(const nacl::string& prop_name) { | 115 bool Plugin::HasProperty(const nacl::string& prop_name) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 main_subprocess_.detailed_description().c_str())); | 208 main_subprocess_.detailed_description().c_str())); |
350 | 209 |
351 // Shut down service runtime. This must be done before all other calls so | 210 // Shut down service runtime. This must be done before all other calls so |
352 // they don't block forever when waiting for the upcall thread to exit. | 211 // they don't block forever when waiting for the upcall thread to exit. |
353 main_subprocess_.Shutdown(); | 212 main_subprocess_.Shutdown(); |
354 | 213 |
355 PLUGIN_PRINTF(("Plugin::ShutDownSubprocess (this=%p, return)\n", | 214 PLUGIN_PRINTF(("Plugin::ShutDownSubprocess (this=%p, return)\n", |
356 static_cast<void*>(this))); | 215 static_cast<void*>(this))); |
357 } | 216 } |
358 | 217 |
359 void Plugin::StartSelLdrOnMainThread(int32_t pp_error, | 218 void Plugin::HistogramTimeSmall(const std::string& name, |
360 ServiceRuntime* service_runtime, | 219 int64_t ms) { |
361 const SelLdrStartParams& params, | 220 if (ms < 0) return; |
362 bool* success) { | 221 uma_interface_.HistogramCustomTimes(name, |
363 if (pp_error != PP_OK) { | 222 ms, |
364 PLUGIN_PRINTF(("Plugin::StartSelLdrOnMainThread: non-PP_OK arg " | 223 kTimeSmallMin, kTimeSmallMax, |
365 "-- SHOULD NOT HAPPEN\n")); | 224 kTimeSmallBuckets); |
366 *success = false; | 225 } |
367 return; | 226 |
227 void Plugin::HistogramTimeMedium(const std::string& name, | |
228 int64_t ms) { | |
229 if (ms < 0) return; | |
230 uma_interface_.HistogramCustomTimes(name, | |
231 ms, | |
232 kTimeMediumMin, kTimeMediumMax, | |
233 kTimeMediumBuckets); | |
234 } | |
235 | |
236 void Plugin::HistogramTimeLarge(const std::string& name, | |
237 int64_t ms) { | |
238 if (ms < 0) return; | |
239 uma_interface_.HistogramCustomTimes(name, | |
240 ms, | |
241 kTimeLargeMin, kTimeLargeMax, | |
242 kTimeLargeBuckets); | |
243 } | |
244 | |
245 void Plugin::HistogramSizeKB(const std::string& name, | |
246 int32_t sample) { | |
247 if (sample < 0) return; | |
248 uma_interface_.HistogramCustomCounts(name, | |
249 sample, | |
250 kSizeKBMin, kSizeKBMax, | |
251 kSizeKBBuckets); | |
252 } | |
253 | |
254 void Plugin::HistogramEnumerate(const std::string& name, | |
255 int sample, | |
256 int maximum, | |
257 int out_of_range_replacement) { | |
258 if (sample < 0 || sample >= maximum) { | |
259 if (out_of_range_replacement < 0) | |
260 // No replacement for bad input, abort. | |
261 return; | |
262 else | |
263 // Use a specific value to signal a bad input. | |
264 sample = out_of_range_replacement; | |
368 } | 265 } |
369 *success = service_runtime->StartSelLdr(params); | 266 uma_interface_.HistogramEnumeration(name, sample, maximum); |
370 // Signal outside of StartSelLdr here, so that the write to *success | 267 } |
371 // is done before signaling. | 268 |
372 service_runtime->SignalStartSelLdrDone(); | 269 void Plugin::HistogramEnumerateOsArch(const std::string& sandbox_isa) { |
270 enum NaClOSArch { | |
271 kNaClLinux32 = 0, | |
272 kNaClLinux64, | |
273 kNaClLinuxArm, | |
274 kNaClMac32, | |
275 kNaClMac64, | |
276 kNaClMacArm, | |
277 kNaClWin32, | |
278 kNaClWin64, | |
279 kNaClWinArm, | |
280 kNaClOSArchMax | |
281 }; | |
282 | |
283 NaClOSArch os_arch = kNaClOSArchMax; | |
284 #if NACL_LINUX | |
285 os_arch = kNaClLinux32; | |
286 #elif NACL_OSX | |
287 os_arch = kNaClMac32; | |
288 #elif NACL_WINDOWS | |
289 os_arch = kNaClWin32; | |
290 #endif | |
291 | |
292 if (sandbox_isa == "x86-64") | |
293 os_arch = static_cast<NaClOSArch>(os_arch + 1); | |
294 if (sandbox_isa == "arm") | |
295 os_arch = static_cast<NaClOSArch>(os_arch + 2); | |
296 | |
297 HistogramEnumerate("NaCl.Client.OSArch", os_arch, kNaClOSArchMax, -1); | |
298 } | |
299 | |
300 void Plugin::HistogramEnumerateLoadStatus(PluginErrorCode error_code, | |
301 bool is_installed) { | |
302 HistogramEnumerate("NaCl.LoadStatus.Plugin", error_code, ERROR_MAX, | |
303 ERROR_UNKNOWN); | |
304 | |
305 // Gather data to see if being installed changes load outcomes. | |
306 const char* name = is_installed ? "NaCl.LoadStatus.Plugin.InstalledApp" : | |
307 "NaCl.LoadStatus.Plugin.NotInstalledApp"; | |
308 HistogramEnumerate(name, error_code, ERROR_MAX, ERROR_UNKNOWN); | |
309 } | |
310 | |
311 void Plugin::HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code, | |
312 bool is_installed) { | |
313 HistogramEnumerate("NaCl.LoadStatus.SelLdr", error_code, | |
314 NACL_ERROR_CODE_MAX, LOAD_STATUS_UNKNOWN); | |
315 | |
316 // Gather data to see if being installed changes load outcomes. | |
317 const char* name = is_installed ? "NaCl.LoadStatus.SelLdr.InstalledApp" : | |
318 "NaCl.LoadStatus.SelLdr.NotInstalledApp"; | |
319 HistogramEnumerate(name, error_code, NACL_ERROR_CODE_MAX, | |
320 LOAD_STATUS_UNKNOWN); | |
321 } | |
322 | |
323 void Plugin::HistogramEnumerateManifestIsDataURI(bool is_data_uri) { | |
324 HistogramEnumerate("NaCl.Manifest.IsDataURI", is_data_uri, 2, -1); | |
325 } | |
326 | |
327 void Plugin::HistogramHTTPStatusCode(const std::string& name, | |
328 int status) { | |
329 // Log the status codes in rough buckets - 1XX, 2XX, etc. | |
330 int sample = status / 100; | |
331 // HTTP status codes only go up to 5XX, using "6" to indicate an internal | |
332 // error. | |
333 // Note: installed files may have "0" for a status code. | |
334 if (status < 0 || status >= 600) | |
335 sample = 6; | |
336 HistogramEnumerate(name, sample, 7, 6); | |
373 } | 337 } |
374 | 338 |
375 bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper, | 339 bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper, |
376 NaClSubprocess* subprocess, | 340 NaClSubprocess* subprocess, |
377 const Manifest* manifest, | 341 const Manifest* manifest, |
378 bool should_report_uma, | 342 bool should_report_uma, |
379 const SelLdrStartParams& params, | 343 const SelLdrStartParams& params, |
380 const pp::CompletionCallback& init_done_cb, | 344 const pp::CompletionCallback& init_done_cb, |
381 const pp::CompletionCallback& crash_cb) { | 345 const pp::CompletionCallback& crash_cb) { |
382 ServiceRuntime* new_service_runtime = | 346 ServiceRuntime* new_service_runtime = |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 params.error_info, | 381 params.error_info, |
418 crash_cb); | 382 crash_cb); |
419 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (nexe_loaded=%d)\n", | 383 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (nexe_loaded=%d)\n", |
420 nexe_loaded)); | 384 nexe_loaded)); |
421 if (!nexe_loaded) { | 385 if (!nexe_loaded) { |
422 return false; | 386 return false; |
423 } | 387 } |
424 return true; | 388 return true; |
425 } | 389 } |
426 | 390 |
391 void Plugin::StartSelLdrOnMainThread(int32_t pp_error, | |
392 ServiceRuntime* service_runtime, | |
393 const SelLdrStartParams& params, | |
394 bool* success) { | |
395 if (pp_error != PP_OK) { | |
396 PLUGIN_PRINTF(("Plugin::StartSelLdrOnMainThread: non-PP_OK arg " | |
397 "-- SHOULD NOT HAPPEN\n")); | |
398 *success = false; | |
399 return; | |
400 } | |
401 *success = service_runtime->StartSelLdr(params); | |
402 // Signal outside of StartSelLdr here, so that the write to *success | |
403 // is done before signaling. | |
404 service_runtime->SignalStartSelLdrDone(); | |
405 } | |
406 | |
427 bool Plugin::LoadNaClModule(nacl::DescWrapper* wrapper, | 407 bool Plugin::LoadNaClModule(nacl::DescWrapper* wrapper, |
428 ErrorInfo* error_info, | 408 ErrorInfo* error_info, |
429 bool enable_dyncode_syscalls, | 409 bool enable_dyncode_syscalls, |
430 bool enable_exception_handling, | 410 bool enable_exception_handling, |
431 bool enable_crash_throttling, | 411 bool enable_crash_throttling, |
432 const pp::CompletionCallback& init_done_cb, | 412 const pp::CompletionCallback& init_done_cb, |
433 const pp::CompletionCallback& crash_cb) { | 413 const pp::CompletionCallback& crash_cb) { |
434 // Before forking a new sel_ldr process, ensure that we do not leak | 414 // Before forking a new sel_ldr process, ensure that we do not leak |
435 // the ServiceRuntime object for an existing subprocess, and that any | 415 // the ServiceRuntime object for an existing subprocess, and that any |
436 // associated listener threads do not go unjoined because if they | 416 // associated listener threads do not go unjoined because if they |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
694 main_subprocess_("main subprocess", NULL, NULL), | 674 main_subprocess_("main subprocess", NULL, NULL), |
695 nacl_ready_state_(UNSENT), | 675 nacl_ready_state_(UNSENT), |
696 nexe_error_reported_(false), | 676 nexe_error_reported_(false), |
697 wrapper_factory_(NULL), | 677 wrapper_factory_(NULL), |
698 enable_dev_interfaces_(false), | 678 enable_dev_interfaces_(false), |
699 is_installed_(false), | 679 is_installed_(false), |
700 init_time_(0), | 680 init_time_(0), |
701 ready_time_(0), | 681 ready_time_(0), |
702 nexe_size_(0), | 682 nexe_size_(0), |
703 time_of_last_progress_event_(0), | 683 time_of_last_progress_event_(0), |
704 nacl_interface_(NULL) { | 684 nacl_interface_(NULL), |
685 uma_interface_(this) { | |
705 PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%" | 686 PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%" |
706 NACL_PRId32 ")\n", static_cast<void*>(this), pp_instance)); | 687 NACL_PRId32 ")\n", static_cast<void*>(this), pp_instance)); |
707 callback_factory_.Initialize(this); | 688 callback_factory_.Initialize(this); |
708 nexe_downloader_.Initialize(this); | 689 nexe_downloader_.Initialize(this); |
709 nacl_interface_ = GetNaClInterface(); | 690 nacl_interface_ = GetNaClInterface(); |
710 CHECK(nacl_interface_ != NULL); | 691 CHECK(nacl_interface_ != NULL); |
711 } | 692 } |
712 | 693 |
713 | 694 |
714 Plugin::~Plugin() { | 695 Plugin::~Plugin() { |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1348 EnqueueProgressEvent( | 1329 EnqueueProgressEvent( |
1349 PP_NACL_EVENT_LOAD, url, length_computable, loaded_bytes, total_bytes); | 1330 PP_NACL_EVENT_LOAD, url, length_computable, loaded_bytes, total_bytes); |
1350 EnqueueProgressEvent( | 1331 EnqueueProgressEvent( |
1351 PP_NACL_EVENT_LOADEND, url, length_computable, loaded_bytes, total_bytes); | 1332 PP_NACL_EVENT_LOADEND, url, length_computable, loaded_bytes, total_bytes); |
1352 | 1333 |
1353 // UMA | 1334 // UMA |
1354 HistogramEnumerateLoadStatus(ERROR_LOAD_SUCCESS, is_installed_); | 1335 HistogramEnumerateLoadStatus(ERROR_LOAD_SUCCESS, is_installed_); |
1355 } | 1336 } |
1356 | 1337 |
1357 | 1338 |
1358 // TODO(ncbray): report UMA stats | |
1359 void Plugin::ReportLoadError(const ErrorInfo& error_info) { | 1339 void Plugin::ReportLoadError(const ErrorInfo& error_info) { |
1360 PLUGIN_PRINTF(("Plugin::ReportLoadError (error='%s')\n", | 1340 PLUGIN_PRINTF(("Plugin::ReportLoadError (error='%s')\n", |
1361 error_info.message().c_str())); | 1341 error_info.message().c_str())); |
1362 // For errors the user (and not just the developer) should know about, | 1342 // For errors the user (and not just the developer) should know about, |
1363 // report them to the renderer so the browser can display a message. | 1343 // report them to the renderer so the browser can display a message. |
1364 if (error_info.error_code() == ERROR_MANIFEST_PROGRAM_MISSING_ARCH) { | 1344 if (error_info.error_code() == ERROR_MANIFEST_PROGRAM_MISSING_ARCH) { |
1365 // A special case: the manifest may otherwise be valid but is missing | 1345 // A special case: the manifest may otherwise be valid but is missing |
1366 // a program/file compatible with the user's sandbox. | 1346 // a program/file compatible with the user's sandbox. |
1367 nacl_interface()->ReportNaClError(pp_instance(), | 1347 nacl_interface()->ReportNaClError(pp_instance(), |
1368 PP_NACL_MANIFEST_MISSING_ARCH); | 1348 PP_NACL_MANIFEST_MISSING_ARCH); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1599 static_cast<uint32_t>(text.size())); | 1579 static_cast<uint32_t>(text.size())); |
1600 const PPB_Console* console_interface = | 1580 const PPB_Console* console_interface = |
1601 static_cast<const PPB_Console*>( | 1581 static_cast<const PPB_Console*>( |
1602 module->GetBrowserInterface(PPB_CONSOLE_INTERFACE)); | 1582 module->GetBrowserInterface(PPB_CONSOLE_INTERFACE)); |
1603 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); | 1583 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); |
1604 var_interface->Release(prefix); | 1584 var_interface->Release(prefix); |
1605 var_interface->Release(str); | 1585 var_interface->Release(str); |
1606 } | 1586 } |
1607 | 1587 |
1608 } // namespace plugin | 1588 } // namespace plugin |
OLD | NEW |