Chromium Code Reviews| 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 "native_client/src/trusted/plugin/plugin.h" | 10 #include "native_client/src/trusted/plugin/plugin.h" |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 607 static_cast<void*>(new_service_runtime))); | 607 static_cast<void*>(new_service_runtime))); |
| 608 if (NULL == new_service_runtime) { | 608 if (NULL == new_service_runtime) { |
| 609 error_info->SetReport(ERROR_SEL_LDR_INIT, | 609 error_info->SetReport(ERROR_SEL_LDR_INIT, |
| 610 "sel_ldr init failure " + subprocess->description()); | 610 "sel_ldr init failure " + subprocess->description()); |
| 611 return false; | 611 return false; |
| 612 } | 612 } |
| 613 | 613 |
| 614 bool service_runtime_started = | 614 bool service_runtime_started = |
| 615 new_service_runtime->Start(wrapper, | 615 new_service_runtime->Start(wrapper, |
| 616 error_info, | 616 error_info, |
| 617 manifest_base_url()); | 617 manifest_base_url(), |
| 618 crash_cb); | |
| 618 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\n", | 619 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\n", |
| 619 service_runtime_started)); | 620 service_runtime_started)); |
| 620 if (!service_runtime_started) { | 621 if (!service_runtime_started) { |
| 621 return false; | 622 return false; |
| 622 } | 623 } |
| 623 | 624 |
| 624 // Try to start the Chrome IPC-based proxy. | 625 // Try to start the Chrome IPC-based proxy. |
| 625 if (nacl_interface_->StartPpapiProxy(pp_instance())) { | 626 if (nacl_interface_->StartPpapiProxy(pp_instance())) { |
| 626 using_ipc_proxy_ = true; | 627 using_ipc_proxy_ = true; |
| 627 // We need to explicitly schedule this here. It is normally called in | 628 // We need to explicitly schedule this here. It is normally called in |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1139 static_cast<float>(ready_time_ - init_time_) / NACL_MICROS_PER_MILLI); | 1140 static_cast<float>(ready_time_ - init_time_) / NACL_MICROS_PER_MILLI); |
| 1140 | 1141 |
| 1141 ReportLoadSuccess(LENGTH_IS_COMPUTABLE, nexe_size_, nexe_size_); | 1142 ReportLoadSuccess(LENGTH_IS_COMPUTABLE, nexe_size_, nexe_size_); |
| 1142 } else { | 1143 } else { |
| 1143 NaClLog(4, "NexeFileDidOpenContinuation: failed."); | 1144 NaClLog(4, "NexeFileDidOpenContinuation: failed."); |
| 1144 ReportLoadError(error_info); | 1145 ReportLoadError(error_info); |
| 1145 } | 1146 } |
| 1146 NaClLog(4, "Leaving NexeFileDidOpenContinuation\n"); | 1147 NaClLog(4, "Leaving NexeFileDidOpenContinuation\n"); |
| 1147 } | 1148 } |
| 1148 | 1149 |
| 1149 static void LogLineToConsole(Plugin* plugin, nacl::string one_line) { | 1150 static void LogLineToConsole(Plugin* plugin, const nacl::string& one_line) { |
| 1150 PLUGIN_PRINTF(("LogLineToConsole: %s\n", | 1151 PLUGIN_PRINTF(("LogLineToConsole: %s\n", |
| 1151 one_line.c_str())); | 1152 one_line.c_str())); |
| 1152 plugin->AddToConsole(one_line); | 1153 plugin->AddToConsole(one_line); |
| 1153 } | 1154 } |
| 1154 | 1155 |
| 1155 void Plugin::CopyCrashLogToJsConsole() { | 1156 void Plugin::CopyCrashLogToJsConsole() { |
| 1156 nacl::string fatal_msg(main_service_runtime()->GetCrashLogOutput()); | 1157 nacl::string fatal_msg(main_service_runtime()->GetCrashLogOutput()); |
| 1157 size_t ix_start = 0; | 1158 size_t ix_start = 0; |
| 1158 size_t ix_end; | 1159 size_t ix_end; |
| 1159 | 1160 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1184 PLUGIN_PRINTF((("Plugin::NexeDidCrash: nexe exited with status %d" | 1185 PLUGIN_PRINTF((("Plugin::NexeDidCrash: nexe exited with status %d" |
| 1185 " so this is a \"controlled crash\".\n"), | 1186 " so this is a \"controlled crash\".\n"), |
| 1186 exit_status)); | 1187 exit_status)); |
| 1187 } | 1188 } |
| 1188 // If the crash occurs during load, we just want to report an error | 1189 // If the crash occurs during load, we just want to report an error |
| 1189 // that fits into our load progress event grammar. If the crash | 1190 // that fits into our load progress event grammar. If the crash |
| 1190 // occurs after loaded/loadend, then we use ReportDeadNexe to send a | 1191 // occurs after loaded/loadend, then we use ReportDeadNexe to send a |
| 1191 // "crash" event. | 1192 // "crash" event. |
| 1192 if (nexe_error_reported()) { | 1193 if (nexe_error_reported()) { |
| 1193 PLUGIN_PRINTF(("Plugin::NexeDidCrash: error already reported;" | 1194 PLUGIN_PRINTF(("Plugin::NexeDidCrash: error already reported;" |
| 1194 " suppressing\n")); | 1195 " suppressing\n")); |
|
bbudge
2012/07/25 20:42:27
This will now CopyCrashLogToJsConsole() instead of
bsy
2012/07/25 22:07:23
yes, but that's safe. i added to the comment just
| |
| 1195 return; | 1196 } else { |
| 1197 if (nacl_ready_state() == DONE) { | |
| 1198 ReportDeadNexe(); | |
| 1199 } else { | |
| 1200 ErrorInfo error_info; | |
| 1201 error_info.SetReport(ERROR_START_PROXY_CRASH, // Not quite right. | |
|
bbudge
2012/07/25 20:42:27
I realize this was here before, but can we improve
bsy
2012/07/25 22:07:23
Done.
| |
| 1202 "Nexe crashed during startup"); | |
| 1203 ReportLoadError(error_info); | |
| 1204 } | |
| 1196 } | 1205 } |
| 1197 | 1206 |
| 1198 if (nacl_ready_state() == DONE) { | 1207 // In all cases, try to grab the crash log. The first error |
| 1199 ReportDeadNexe(); | 1208 // reported may have come from the start_module RPC reply indicating |
| 1200 } else { | 1209 // a validation error or something similar, which wouldn't grab the |
| 1201 ErrorInfo error_info; | 1210 // crash log. |
| 1202 error_info.SetReport(ERROR_START_PROXY_CRASH, // Not quite right. | |
| 1203 "Nexe crashed during startup"); | |
| 1204 ReportLoadError(error_info); | |
| 1205 } | |
| 1206 | |
| 1207 CopyCrashLogToJsConsole(); | 1211 CopyCrashLogToJsConsole(); |
| 1208 } | 1212 } |
| 1209 | 1213 |
| 1210 void Plugin::BitcodeDidTranslate(int32_t pp_error) { | 1214 void Plugin::BitcodeDidTranslate(int32_t pp_error) { |
| 1211 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate (pp_error=%"NACL_PRId32")\n", | 1215 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate (pp_error=%"NACL_PRId32")\n", |
| 1212 pp_error)); | 1216 pp_error)); |
| 1213 if (pp_error != PP_OK) { | 1217 if (pp_error != PP_OK) { |
| 1214 // Error should have been reported by pnacl. Just return. | 1218 // Error should have been reported by pnacl. Just return. |
| 1215 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate error in Pnacl\n")); | 1219 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate error in Pnacl\n")); |
| 1216 return; | 1220 return; |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1942 static_cast<uint32_t>(text.size())); | 1946 static_cast<uint32_t>(text.size())); |
| 1943 const PPB_Console_Dev* console_interface = | 1947 const PPB_Console_Dev* console_interface = |
| 1944 static_cast<const PPB_Console_Dev*>( | 1948 static_cast<const PPB_Console_Dev*>( |
| 1945 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); | 1949 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); |
| 1946 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); | 1950 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); |
| 1947 var_interface->Release(prefix); | 1951 var_interface->Release(prefix); |
| 1948 var_interface->Release(str); | 1952 var_interface->Release(str); |
| 1949 } | 1953 } |
| 1950 | 1954 |
| 1951 } // namespace plugin | 1955 } // namespace plugin |
| OLD | NEW |