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 #include "components/nacl/renderer/nexe_load_manager.h" | 5 #include "components/nacl/renderer/nexe_load_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_tokenizer.h" | 10 #include "base/strings/string_tokenizer.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // Store mime_type_ at initialization time since we make it lowercase. | 330 // Store mime_type_ at initialization time since we make it lowercase. |
331 mime_type_ = StringToLowerASCII(LookupAttribute(args_, kTypeAttribute)); | 331 mime_type_ = StringToLowerASCII(LookupAttribute(args_, kTypeAttribute)); |
332 } | 332 } |
333 | 333 |
334 void NexeLoadManager::ReportStartupOverhead() const { | 334 void NexeLoadManager::ReportStartupOverhead() const { |
335 base::TimeDelta overhead = base::Time::Now() - init_time_; | 335 base::TimeDelta overhead = base::Time::Now() - init_time_; |
336 HistogramStartupTimeMedium( | 336 HistogramStartupTimeMedium( |
337 "NaCl.Perf.StartupTime.NaClOverhead", overhead, nexe_size_); | 337 "NaCl.Perf.StartupTime.NaClOverhead", overhead, nexe_size_); |
338 } | 338 } |
339 | 339 |
340 bool NexeLoadManager::RequestNaClManifest(const std::string& url, | 340 bool NexeLoadManager::RequestNaClManifest(const std::string& url) { |
341 bool* is_data_uri) { | |
342 if (plugin_base_url_.is_valid()) { | 341 if (plugin_base_url_.is_valid()) { |
343 const GURL& resolved_url = plugin_base_url_.Resolve(url); | 342 const GURL& resolved_url = plugin_base_url_.Resolve(url); |
344 if (resolved_url.is_valid()) { | 343 if (resolved_url.is_valid()) { |
345 manifest_base_url_ = resolved_url; | 344 manifest_base_url_ = resolved_url; |
346 is_installed_ = manifest_base_url_.SchemeIs("chrome-extension"); | 345 is_installed_ = manifest_base_url_.SchemeIs("chrome-extension"); |
347 *is_data_uri = manifest_base_url_.SchemeIs("data"); | 346 HistogramEnumerateManifestIsDataURI( |
348 HistogramEnumerateManifestIsDataURI(*is_data_uri); | 347 manifest_base_url_.SchemeIs("data")); |
349 | |
350 set_nacl_ready_state(PP_NACL_READY_STATE_OPENED); | 348 set_nacl_ready_state(PP_NACL_READY_STATE_OPENED); |
351 DispatchProgressEvent(pp_instance_, | 349 DispatchProgressEvent(pp_instance_, |
352 ProgressEvent(PP_NACL_EVENT_LOADSTART)); | 350 ProgressEvent(PP_NACL_EVENT_LOADSTART)); |
353 return true; | 351 return true; |
354 } | 352 } |
355 } | 353 } |
356 ReportLoadError(PP_NACL_ERROR_MANIFEST_RESOLVE_URL, | 354 ReportLoadError(PP_NACL_ERROR_MANIFEST_RESOLVE_URL, |
357 std::string("could not resolve URL \"") + url + | 355 std::string("could not resolve URL \"") + url + |
358 "\" relative to \"" + | 356 "\" relative to \"" + |
359 plugin_base_url_.possibly_invalid_spec() + "\"."); | 357 plugin_base_url_.possibly_invalid_spec() + "\"."); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // to provide error handling. | 422 // to provide error handling. |
425 } | 423 } |
426 | 424 |
427 void NexeLoadManager::CopyCrashLogToJsConsole(const std::string& crash_log) { | 425 void NexeLoadManager::CopyCrashLogToJsConsole(const std::string& crash_log) { |
428 base::StringTokenizer t(crash_log, "\n"); | 426 base::StringTokenizer t(crash_log, "\n"); |
429 while (t.GetNext()) | 427 while (t.GetNext()) |
430 LogToConsole(t.token()); | 428 LogToConsole(t.token()); |
431 } | 429 } |
432 | 430 |
433 } // namespace nacl | 431 } // namespace nacl |
OLD | NEW |