Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: components/nacl/renderer/nexe_load_manager.cc

Issue 307173002: Remove PlatformFile from components/nacl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update NexeFdCallback definition Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 NexeLoadManager::~NexeLoadManager() { 102 NexeLoadManager::~NexeLoadManager() {
103 if (!nexe_error_reported_) { 103 if (!nexe_error_reported_) {
104 base::TimeDelta uptime = base::Time::Now() - ready_time_; 104 base::TimeDelta uptime = base::Time::Now() - ready_time_;
105 HistogramTimeLarge("NaCl.ModuleUptime.Normal", uptime.InMilliseconds()); 105 HistogramTimeLarge("NaCl.ModuleUptime.Normal", uptime.InMilliseconds());
106 } 106 }
107 } 107 }
108 108
109 void NexeLoadManager::NexeFileDidOpen(int32_t pp_error, 109 void NexeLoadManager::NexeFileDidOpen(int32_t pp_error,
110 base::PlatformFile file, 110 const base::File& file,
111 int32_t http_status, 111 int32_t http_status,
112 int64_t nexe_bytes_read, 112 int64_t nexe_bytes_read,
113 const std::string& url, 113 const std::string& url,
114 base::TimeDelta time_since_open) { 114 base::TimeDelta time_since_open) {
115 // Check that we are on the main renderer thread. 115 // Check that we are on the main renderer thread.
116 DCHECK(content::RenderThread::Get()); 116 DCHECK(content::RenderThread::Get());
117 VLOG(1) << "Plugin::NexeFileDidOpen (pp_error=" << pp_error << ")"; 117 VLOG(1) << "Plugin::NexeFileDidOpen (pp_error=" << pp_error << ")";
118 HistogramHTTPStatusCode( 118 HistogramHTTPStatusCode(
119 is_installed_ ? "NaCl.HttpStatusCodeClass.Nexe.InstalledApp" : 119 is_installed_ ? "NaCl.HttpStatusCodeClass.Nexe.InstalledApp" :
120 "NaCl.HttpStatusCodeClass.Nexe.NotInstalledApp", 120 "NaCl.HttpStatusCodeClass.Nexe.NotInstalledApp",
121 http_status); 121 http_status);
122 122
123 if (pp_error != PP_OK || file == base::kInvalidPlatformFileValue) { 123 if (pp_error != PP_OK || !file.IsValid()) {
124 if (pp_error == PP_ERROR_ABORTED) { 124 if (pp_error == PP_ERROR_ABORTED) {
125 ReportLoadAbort(); 125 ReportLoadAbort();
126 } else if (pp_error == PP_ERROR_NOACCESS) { 126 } else if (pp_error == PP_ERROR_NOACCESS) {
127 ReportLoadError(PP_NACL_ERROR_NEXE_NOACCESS_URL, 127 ReportLoadError(PP_NACL_ERROR_NEXE_NOACCESS_URL,
128 "access to nexe url was denied."); 128 "access to nexe url was denied.");
129 } else { 129 } else {
130 ReportLoadError(PP_NACL_ERROR_NEXE_LOAD_URL, 130 ReportLoadError(PP_NACL_ERROR_NEXE_LOAD_URL,
131 "could not load nexe url."); 131 "could not load nexe url.");
132 } 132 }
133 } else if (nexe_bytes_read == -1) { 133 } else if (nexe_bytes_read == -1) {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 // to provide error handling. 417 // to provide error handling.
418 } 418 }
419 419
420 void NexeLoadManager::CopyCrashLogToJsConsole(const std::string& crash_log) { 420 void NexeLoadManager::CopyCrashLogToJsConsole(const std::string& crash_log) {
421 base::StringTokenizer t(crash_log, "\n"); 421 base::StringTokenizer t(crash_log, "\n");
422 while (t.GetNext()) 422 while (t.GetNext())
423 LogToConsole(t.token()); 423 LogToConsole(t.token());
424 } 424 }
425 425
426 } // namespace nacl 426 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/renderer/nexe_load_manager.h ('k') | components/nacl/renderer/pnacl_translation_resource_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698