summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-04 19:04:00 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-04 19:04:00 +0000
commita5de4542ea36796ca647669a81a343f19e4827d8 (patch)
tree5efa736410030f9cddf372e2b056d9b1633c83d0
parent513357a535d3662b16e504d8145f9b708d233355 (diff)
downloadchromium_src-a5de4542ea36796ca647669a81a343f19e4827d8.zip
chromium_src-a5de4542ea36796ca647669a81a343f19e4827d8.tar.gz
chromium_src-a5de4542ea36796ca647669a81a343f19e4827d8.tar.bz2
Pepper: Move NexeDidCrash() to NexeLoadManager.
This change pulls more code out of ppapi/native_client to compnents/nacl/renderer. GetReadyTime() is removed from PPB_NaCl_Private here to simplify time management. I don't want to mix time math from Chrome and NaCl, so plugin.cc uses its own ready_time_ for some operations again, and SetReadyTime() stashes the current value of base::Time::Now in NexeLoadManager. BUG=239656 Review URL: https://codereview.chromium.org/216103003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261820 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--components/nacl/renderer/nexe_load_manager.cc99
-rw-r--r--components/nacl/renderer/nexe_load_manager.h16
-rw-r--r--components/nacl/renderer/ppb_nacl_private_impl.cc28
-rw-r--r--ppapi/api/private/ppb_nacl_private.idl15
-rw-r--r--ppapi/c/private/ppb_nacl_private.h12
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.cc99
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.h10
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c32
8 files changed, 111 insertions, 200 deletions
diff --git a/components/nacl/renderer/nexe_load_manager.cc b/components/nacl/renderer/nexe_load_manager.cc
index cf935ed..2e3ac30 100644
--- a/components/nacl/renderer/nexe_load_manager.cc
+++ b/components/nacl/renderer/nexe_load_manager.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
+#include "base/strings/string_tokenizer.h"
#include "components/nacl/common/nacl_host_messages.h"
#include "components/nacl/common/nacl_types.h"
#include "components/nacl/renderer/pnacl_translation_resource_host.h"
@@ -111,6 +112,18 @@ void HistogramTimeMedium(const std::string& name, int64_t sample) {
counter->AddTime(base::TimeDelta::FromMilliseconds(sample));
}
+// Records values up to 33 minutes.
+void HistogramTimeLarge(const std::string& name, int64_t sample) {
+ base::HistogramBase* counter = base::Histogram::FactoryTimeGet(
+ name,
+ base::TimeDelta::FromMilliseconds(100),
+ base::TimeDelta::FromMilliseconds(2000000),
+ 100,
+ base::HistogramBase::kUmaTargetedHistogramFlag);
+ if (counter)
+ counter->AddTime(base::TimeDelta::FromMilliseconds(sample));
+}
+
blink::WebString EventTypeToString(PP_NaClEventType event_type) {
switch (event_type) {
case PP_NACL_EVENT_LOADSTART:
@@ -160,6 +173,10 @@ NexeLoadManager::NexeLoadManager(
}
NexeLoadManager::~NexeLoadManager() {
+ if (!nexe_error_reported_) {
+ base::TimeDelta uptime = base::Time::Now() - ready_time_;
+ HistogramTimeLarge("NaCl.ModuleUptime.Normal", uptime.InMilliseconds());
+ }
}
void NexeLoadManager::ReportLoadSuccess(const std::string& url,
@@ -258,27 +275,36 @@ void NexeLoadManager::ReportLoadAbort() {
LogToConsole(error_string);
}
-void NexeLoadManager::ReportDeadNexe(int64_t crash_time) {
- if (nacl_ready_state_ == PP_NACL_READY_STATE_DONE && // After loadEnd
- !nexe_error_reported_) {
- // Crashes will be more likely near startup, so use a medium histogram
- // instead of a large one.
- HistogramTimeMedium(
- "NaCl.ModuleUptime.Crash", (crash_time - ready_time_) / 1000);
-
- std::string message("NaCl module crashed");
- SetLastError(message);
- LogToConsole(message);
-
- ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
- FROM_HERE,
- base::Bind(&NexeLoadManager::DispatchEvent,
- weak_factory_.GetWeakPtr(),
- ProgressEvent(PP_NACL_EVENT_CRASH)));
- nexe_error_reported_ = true;
+void NexeLoadManager::NexeDidCrash(const char* crash_log) {
+ VLOG(1) << "Plugin::NexeDidCrash: crash event!";
+ // The NaCl module voluntarily exited. However, this is still a
+ // crash from the point of view of Pepper, since PPAPI plugins are
+ // event handlers and should never exit.
+ VLOG_IF(1, exit_status_ != -1)
+ << "Plugin::NexeDidCrash: nexe exited with status " << exit_status_
+ << " so this is a \"controlled crash\".";
+ // If the crash occurs during load, we just want to report an error
+ // that fits into our load progress event grammar. If the crash
+ // occurs after loaded/loadend, then we use ReportDeadNexe to send a
+ // "crash" event.
+ if (nexe_error_reported_) {
+ VLOG(1) << "Plugin::NexeDidCrash: error already reported; suppressing";
+ } else {
+ if (nacl_ready_state_ == PP_NACL_READY_STATE_DONE) {
+ ReportDeadNexe();
+ } else {
+ ReportLoadError(PP_NACL_ERROR_START_PROXY_CRASH,
+ "Nexe crashed during startup",
+ "Nexe crashed during startup");
+ }
}
- // else ReportLoadError() and ReportLoadAbort() will be used by loading code
- // to provide error handling.
+ // In all cases, try to grab the crash log. The first error
+ // reported may have come from the start_module RPC reply indicating
+ // a validation error or something similar, which wouldn't grab the
+ // crash log. In the event that this is called twice, the second
+ // invocation will just be a no-op, since the entire crash log will
+ // have been received and we'll just get an EOF indication.
+ CopyCrashLogToJsConsole(crash_log);
}
void NexeLoadManager::DispatchEvent(const ProgressEvent &event) {
@@ -323,10 +349,6 @@ void NexeLoadManager::set_trusted_plugin_channel(
trusted_plugin_channel_ = channel.Pass();
}
-bool NexeLoadManager::nexe_error_reported() {
- return nexe_error_reported_;
-}
-
PP_NaClReadyState NexeLoadManager::nacl_ready_state() {
return nacl_ready_state_;
}
@@ -366,4 +388,33 @@ void NexeLoadManager::set_exit_status(int exit_status) {
SetReadOnlyProperty(exit_status_name_var.get(), PP_MakeInt32(exit_status));
}
+void NexeLoadManager::ReportDeadNexe() {
+ if (nacl_ready_state_ == PP_NACL_READY_STATE_DONE && // After loadEnd
+ !nexe_error_reported_) {
+ // Crashes will be more likely near startup, so use a medium histogram
+ // instead of a large one.
+ base::TimeDelta uptime = base::Time::Now() - ready_time_;
+ HistogramTimeMedium("NaCl.ModuleUptime.Crash", uptime.InMilliseconds());
+
+ std::string message("NaCl module crashed");
+ SetLastError(message);
+ LogToConsole(message);
+
+ ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
+ FROM_HERE,
+ base::Bind(&NexeLoadManager::DispatchEvent,
+ weak_factory_.GetWeakPtr(),
+ ProgressEvent(PP_NACL_EVENT_CRASH)));
+ nexe_error_reported_ = true;
+ }
+ // else ReportLoadError() and ReportLoadAbort() will be used by loading code
+ // to provide error handling.
+}
+
+void NexeLoadManager::CopyCrashLogToJsConsole(const std::string& crash_log) {
+ base::StringTokenizer t(crash_log, "\n");
+ while (t.GetNext())
+ LogToConsole(t.token());
+}
+
} // namespace nacl
diff --git a/components/nacl/renderer/nexe_load_manager.h b/components/nacl/renderer/nexe_load_manager.h
index 0944c66..8f221bf5 100644
--- a/components/nacl/renderer/nexe_load_manager.h
+++ b/components/nacl/renderer/nexe_load_manager.h
@@ -35,7 +35,7 @@ class NexeLoadManager {
const std::string& error_message,
const std::string& console_message);
void ReportLoadAbort();
- void ReportDeadNexe(int64_t crash_time);
+ void NexeDidCrash(const char* crash_log);
// TODO(dmichael): Everything below this comment should eventually be made
// private, when ppb_nacl_private_impl.cc is no longer using them directly.
@@ -69,8 +69,6 @@ class NexeLoadManager {
void DispatchEvent(const ProgressEvent &event);
void set_trusted_plugin_channel(scoped_ptr<TrustedPluginChannel> channel);
- bool nexe_error_reported();
-
PP_NaClReadyState nacl_ready_state();
void set_nacl_ready_state(PP_NaClReadyState ready_state);
@@ -81,8 +79,7 @@ class NexeLoadManager {
bool is_installed() const { return is_installed_; }
void set_is_installed(bool installed) { is_installed_ = installed; }
- int64_t ready_time() const { return ready_time_; }
- void set_ready_time(int64_t ready_time) { ready_time_ = ready_time; }
+ void set_ready_time() { ready_time_ = base::Time::Now(); }
int32_t exit_status() const { return exit_status_; }
void set_exit_status(int32_t exit_status);
@@ -90,6 +87,11 @@ class NexeLoadManager {
private:
DISALLOW_COPY_AND_ASSIGN(NexeLoadManager);
+ void ReportDeadNexe();
+
+ // Copies a crash log to the console, one line at a time.
+ void CopyCrashLogToJsConsole(const std::string& crash_log);
+
PP_Instance pp_instance_;
PP_NaClReadyState nacl_ready_state_;
bool nexe_error_reported_;
@@ -105,8 +107,8 @@ class NexeLoadManager {
// for NaCl resources that we have seen so far".
bool is_installed_;
- // Time of a successful nexe load, in microseconds since the epoch.
- int64_t ready_time_;
+ // Time of a successful nexe load.
+ base::Time ready_time_;
// The exit status of the plugin process.
// This will have a value in the range (0x00-0xff) if the exit status is set,
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc
index d267d9b..6277362 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -473,10 +473,10 @@ void ReportLoadAbort(PP_Instance instance) {
load_manager->ReportLoadAbort();
}
-void ReportDeadNexe(PP_Instance instance, int64_t crash_time) {
+void NexeDidCrash(PP_Instance instance, const char* crash_log) {
nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance);
if (load_manager)
- load_manager->ReportDeadNexe(crash_time);
+ load_manager->NexeDidCrash(crash_log);
}
void InstanceCreated(PP_Instance instance) {
@@ -531,14 +531,6 @@ void LogToConsole(PP_Instance instance, const char* message) {
load_manager->LogToConsole(std::string(message));
}
-PP_Bool GetNexeErrorReported(PP_Instance instance) {
- nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance);
- DCHECK(load_manager);
- if (load_manager)
- return PP_FromBool(load_manager->nexe_error_reported());
- return PP_FALSE;
-}
-
PP_NaClReadyState GetNaClReadyState(PP_Instance instance) {
nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance);
DCHECK(load_manager);
@@ -569,19 +561,11 @@ void SetIsInstalled(PP_Instance instance, PP_Bool installed) {
load_manager->set_is_installed(PP_ToBool(installed));
}
-int64_t GetReadyTime(PP_Instance instance) {
- nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance);
- DCHECK(load_manager);
- if (load_manager)
- return load_manager->ready_time();
- return 0;
-}
-
-void SetReadyTime(PP_Instance instance, int64_t ready_time) {
+void SetReadyTime(PP_Instance instance) {
nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance);
DCHECK(load_manager);
if (load_manager)
- load_manager->set_ready_time(ready_time);
+ load_manager->set_ready_time();
}
int32_t GetExitStatus(PP_Instance instance) {
@@ -616,19 +600,17 @@ const PPB_NaCl_Private nacl_interface = {
&ReportLoadSuccess,
&ReportLoadError,
&ReportLoadAbort,
- &ReportDeadNexe,
+ &NexeDidCrash,
&InstanceCreated,
&InstanceDestroyed,
&NaClDebugEnabledForURL,
&GetSandboxArch,
&GetUrlScheme,
&LogToConsole,
- &GetNexeErrorReported,
&GetNaClReadyState,
&SetNaClReadyState,
&GetIsInstalled,
&SetIsInstalled,
- &GetReadyTime,
&SetReadyTime,
&GetExitStatus,
&SetExitStatus
diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl
index 5bdeebc..e3e4211 100644
--- a/ppapi/api/private/ppb_nacl_private.idl
+++ b/ppapi/api/private/ppb_nacl_private.idl
@@ -291,9 +291,9 @@ interface PPB_NaCl_Private {
/* Reports that loading a nexe was aborted. */
void ReportLoadAbort([in] PP_Instance instance);
- /* Reports that the nexe has crashed or is otherwise dead. */
- void ReportDeadNexe([in] PP_Instance instance,
- [in] int64_t crash_time);
+ /* Reports that the nexe has crashed. */
+ void NexeDidCrash([in] PP_Instance instance,
+ [in] str_t crash_log);
/* Performs internal setup when an instance is created. */
void InstanceCreated([in] PP_Instance instance);
@@ -318,9 +318,6 @@ interface PPB_NaCl_Private {
void LogToConsole([in] PP_Instance instance,
[in] str_t message);
- /* Returns PP_TRUE if an error has been reported loading the nexe. */
- PP_Bool GetNexeErrorReported([in] PP_Instance instance);
-
/* Returns the NaCl readiness status for this instance. */
PP_NaClReadyState GetNaClReadyState([in] PP_Instance instance);
@@ -335,12 +332,8 @@ interface PPB_NaCl_Private {
void SetIsInstalled([in] PP_Instance instance,
[in] PP_Bool is_installed);
- /* Returns the time the nexe became ready. */
- int64_t GetReadyTime([in] PP_Instance instance);
-
/* Sets the time the nexe became ready. */
- void SetReadyTime([in] PP_Instance instance,
- [in] int64_t ready_time);
+ void SetReadyTime([in] PP_Instance instance);
/* Returns the exit status of the plugin process. */
int32_t GetExitStatus([in] PP_Instance instance);
diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h
index ddf4418..d3ab905 100644
--- a/ppapi/c/private/ppb_nacl_private.h
+++ b/ppapi/c/private/ppb_nacl_private.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_nacl_private.idl modified Wed Apr 2 10:41:10 2014. */
+/* From private/ppb_nacl_private.idl modified Fri Apr 4 08:16:11 2014. */
#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
@@ -296,8 +296,8 @@ struct PPB_NaCl_Private_1_0 {
const char* console_message);
/* Reports that loading a nexe was aborted. */
void (*ReportLoadAbort)(PP_Instance instance);
- /* Reports that the nexe has crashed or is otherwise dead. */
- void (*ReportDeadNexe)(PP_Instance instance, int64_t crash_time);
+ /* Reports that the nexe has crashed. */
+ void (*NexeDidCrash)(PP_Instance instance, const char* crash_log);
/* Performs internal setup when an instance is created. */
void (*InstanceCreated)(PP_Instance instance);
/* Performs internal cleanup when an instance is destroyed. */
@@ -314,8 +314,6 @@ struct PPB_NaCl_Private_1_0 {
PP_UrlSchemeType (*GetUrlScheme)(struct PP_Var url);
/* Logs the message to the console. */
void (*LogToConsole)(PP_Instance instance, const char* message);
- /* Returns PP_TRUE if an error has been reported loading the nexe. */
- PP_Bool (*GetNexeErrorReported)(PP_Instance instance);
/* Returns the NaCl readiness status for this instance. */
PP_NaClReadyState (*GetNaClReadyState)(PP_Instance instance);
/* Sets the NaCl readiness status for this instance. */
@@ -325,10 +323,8 @@ struct PPB_NaCl_Private_1_0 {
PP_Bool (*GetIsInstalled)(PP_Instance instance);
/* Sets whether the plugin is an installed app. */
void (*SetIsInstalled)(PP_Instance instance, PP_Bool is_installed);
- /* Returns the time the nexe became ready. */
- int64_t (*GetReadyTime)(PP_Instance instance);
/* Sets the time the nexe became ready. */
- void (*SetReadyTime)(PP_Instance instance, int64_t ready_time);
+ void (*SetReadyTime)(PP_Instance instance);
/* Returns the exit status of the plugin process. */
int32_t (*GetExitStatus)(PP_Instance instance);
/* Sets the exit status of the plugin process. */
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index b5aac6b..280c077 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -80,11 +80,6 @@ const int64_t kTimeMediumMin = 10; // in ms
const int64_t kTimeMediumMax = 200000; // in ms
const uint32_t kTimeMediumBuckets = 100;
-// Up to 33 minutes.
-const int64_t kTimeLargeMin = 100; // in ms
-const int64_t kTimeLargeMax = 2000000; // in ms
-const uint32_t kTimeLargeBuckets = 100;
-
const int64_t kSizeKBMin = 1;
const int64_t kSizeKBMax = 512*1024; // very large .nexe
const uint32_t kSizeKBBuckets = 100;
@@ -163,15 +158,6 @@ void Plugin::HistogramTimeMedium(const std::string& name,
kTimeMediumBuckets);
}
-void Plugin::HistogramTimeLarge(const std::string& name,
- int64_t ms) {
- if (ms < 0) return;
- uma_interface_.HistogramCustomTimes(name,
- ms,
- kTimeLargeMin, kTimeLargeMax,
- kTimeLargeBuckets);
-}
-
void Plugin::HistogramSizeKB(const std::string& name,
int32_t sample) {
if (sample < 0) return;
@@ -545,6 +531,7 @@ Plugin::Plugin(PP_Instance pp_instance)
wrapper_factory_(NULL),
enable_dev_interfaces_(false),
init_time_(0),
+ ready_time_(0),
nexe_size_(0),
time_of_last_progress_event_(0),
nacl_interface_(NULL),
@@ -573,13 +560,6 @@ Plugin::~Plugin() {
// Destroy the coordinator while the rest of the data is still there
pnacl_coordinator_.reset(NULL);
- int64_t ready_time = nacl_interface_->GetReadyTime(pp_instance());
- if (!nacl_interface_->GetNexeErrorReported(pp_instance())) {
- HistogramTimeLarge(
- "NaCl.ModuleUptime.Normal",
- (shutdown_start - ready_time) / NACL_MICROS_PER_MILLI);
- }
-
for (std::map<nacl::string, NaClFileInfoAutoCloser*>::iterator it =
url_file_info_map_.begin();
it != url_file_info_map_.end();
@@ -727,14 +707,14 @@ void Plugin::NexeFileDidOpenContinuation(int32_t pp_error) {
if (was_successful) {
NaClLog(4, "NexeFileDidOpenContinuation: success;"
" setting histograms\n");
- int64_t ready_time = NaClGetTimeOfDayMicroseconds();
- nacl_interface_->SetReadyTime(pp_instance(), ready_time);
+ ready_time_ = NaClGetTimeOfDayMicroseconds();
+ nacl_interface_->SetReadyTime(pp_instance());
HistogramStartupTimeSmall(
"NaCl.Perf.StartupTime.LoadModule",
- static_cast<float>(ready_time - load_start_) / NACL_MICROS_PER_MILLI);
+ static_cast<float>(ready_time_ - load_start_) / NACL_MICROS_PER_MILLI);
HistogramStartupTimeMedium(
"NaCl.Perf.StartupTime.Total",
- static_cast<float>(ready_time - init_time_) / NACL_MICROS_PER_MILLI);
+ static_cast<float>(ready_time_ - init_time_) / NACL_MICROS_PER_MILLI);
ReportLoadSuccess(nexe_size_, nexe_size_);
} else {
@@ -744,29 +724,6 @@ void Plugin::NexeFileDidOpenContinuation(int32_t pp_error) {
NaClLog(4, "Leaving NexeFileDidOpenContinuation\n");
}
-static void LogLineToConsole(Plugin* plugin, const nacl::string& one_line) {
- PLUGIN_PRINTF(("LogLineToConsole: %s\n",
- one_line.c_str()));
- plugin->nacl_interface()->LogToConsole(plugin->pp_instance(),
- one_line.c_str());
-}
-
-void Plugin::CopyCrashLogToJsConsole() {
- nacl::string fatal_msg(main_service_runtime()->GetCrashLogOutput());
- size_t ix_start = 0;
- size_t ix_end;
-
- PLUGIN_PRINTF(("Plugin::CopyCrashLogToJsConsole: got %" NACL_PRIuS " bytes\n",
- fatal_msg.size()));
- while (nacl::string::npos != (ix_end = fatal_msg.find('\n', ix_start))) {
- LogLineToConsole(this, fatal_msg.substr(ix_start, ix_end - ix_start));
- ix_start = ix_end + 1;
- }
- if (ix_start != fatal_msg.size()) {
- LogLineToConsole(this, fatal_msg.substr(ix_start));
- }
-}
-
void Plugin::NexeDidCrash(int32_t pp_error) {
PLUGIN_PRINTF(("Plugin::NexeDidCrash (pp_error=%" NACL_PRId32 ")\n",
pp_error));
@@ -774,45 +731,8 @@ void Plugin::NexeDidCrash(int32_t pp_error) {
PLUGIN_PRINTF(("Plugin::NexeDidCrash: CallOnMainThread callback with"
" non-PP_OK arg -- SHOULD NOT HAPPEN\n"));
}
- PLUGIN_PRINTF(("Plugin::NexeDidCrash: crash event!\n"));
- int exit_status = nacl_interface_->GetExitStatus(pp_instance());
- if (exit_status != -1) {
- // The NaCl module voluntarily exited. However, this is still a
- // crash from the point of view of Pepper, since PPAPI plugins are
- // event handlers and should never exit.
- PLUGIN_PRINTF((("Plugin::NexeDidCrash: nexe exited with status %d"
- " so this is a \"controlled crash\".\n"),
- exit_status));
- }
- // If the crash occurs during load, we just want to report an error
- // that fits into our load progress event grammar. If the crash
- // occurs after loaded/loadend, then we use ReportDeadNexe to send a
- // "crash" event.
- if (nacl_interface_->GetNexeErrorReported(pp_instance())) {
- PLUGIN_PRINTF(("Plugin::NexeDidCrash: error already reported;"
- " suppressing\n"));
- } else {
- if (nacl_interface_->GetNaClReadyState(pp_instance()) ==
- PP_NACL_READY_STATE_DONE) {
- ReportDeadNexe();
- } else {
- ErrorInfo error_info;
- // The error is not quite right. In particular, the crash
- // reported by this path could be due to NaCl application
- // crashes that occur after the PPAPI proxy has started.
- error_info.SetReport(PP_NACL_ERROR_START_PROXY_CRASH,
- "Nexe crashed during startup");
- ReportLoadError(error_info);
- }
- }
-
- // In all cases, try to grab the crash log. The first error
- // reported may have come from the start_module RPC reply indicating
- // a validation error or something similar, which wouldn't grab the
- // crash log. In the event that this is called twice, the second
- // invocation will just be a no-op, since all the crash log will
- // have been received and we'll just get an EOF indication.
- CopyCrashLogToJsConsole();
+ const char* crash_log = main_service_runtime()->GetCrashLogOutput().c_str();
+ nacl_interface_->NexeDidCrash(pp_instance(), crash_log);
}
void Plugin::BitcodeDidTranslate(int32_t pp_error) {
@@ -853,11 +773,6 @@ void Plugin::BitcodeDidTranslateContinuation(int32_t pp_error) {
}
}
-void Plugin::ReportDeadNexe() {
- nacl_interface_->ReportDeadNexe(
- pp_instance(), NaClGetTimeOfDayMicroseconds());
-}
-
void Plugin::NaClManifestBufferReady(int32_t pp_error) {
PLUGIN_PRINTF(("Plugin::NaClManifestBufferReady (pp_error=%"
NACL_PRId32 ")\n", pp_error));
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h
index 12a80d0..4da86ca 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.h
+++ b/ppapi/native_client/src/trusted/plugin/plugin.h
@@ -144,9 +144,6 @@ class Plugin : public pp::Instance {
// Report the error code that sel_ldr produces when starting a nexe.
void ReportSelLdrLoadStatus(int status);
- // Report nexe death after load to JS and shut down the proxy.
- void ReportDeadNexe();
-
// URL resolution support.
// plugin_base_url is the URL used for resolving relative URLs used in
// src="...".
@@ -331,12 +328,6 @@ class Plugin : public pp::Instance {
FileDownloader* url_downloader,
pp::CompletionCallback pp_callback);
- // Copy the main service runtime's most recent NaClLog output to the
- // JavaScript console. Valid to use only after a crash, e.g., via a
- // detail level LOG_FATAL NaClLog entry. If the crash was not due
- // to a LOG_FATAL this method will do nothing.
- void CopyCrashLogToJsConsole();
-
// Open an app file by requesting a file descriptor from the browser. This
// method first checks that the url is for an installed file before making the
// request so it won't slow down non-installed file downloads.
@@ -409,6 +400,7 @@ class Plugin : public pp::Instance {
int64_t load_start_;
int64_t init_time_;
+ int64_t ready_time_;
size_t nexe_size_;
// Callback to receive .nexe and .dso download progress notifications.
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index b312c1e..7f40daa 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -2064,10 +2064,6 @@ static int32_t Pnacl_M14_PPB_Font_Dev_PixelOffsetForCharacter(PP_Resource font,
/* End wrapper methods for PPB_Font_Dev_0_6 */
-/* Not generating wrapper methods for PPB_Graphics2D_Dev_0_1 */
-
-/* Not generating wrapper methods for PPB_Graphics2D_Dev_0_2 */
-
/* Begin wrapper methods for PPB_IMEInputEvent_Dev_0_1 */
static PP_Bool Pnacl_M16_PPB_IMEInputEvent_Dev_IsIMEInputEvent(PP_Resource resource) {
@@ -3171,9 +3167,9 @@ static void Pnacl_M25_PPB_NaCl_Private_ReportLoadAbort(PP_Instance instance) {
iface->ReportLoadAbort(instance);
}
-static void Pnacl_M25_PPB_NaCl_Private_ReportDeadNexe(PP_Instance instance, int64_t crash_time) {
+static void Pnacl_M25_PPB_NaCl_Private_NexeDidCrash(PP_Instance instance, const char* crash_log) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
- iface->ReportDeadNexe(instance, crash_time);
+ iface->NexeDidCrash(instance, crash_log);
}
static void Pnacl_M25_PPB_NaCl_Private_InstanceCreated(PP_Instance instance) {
@@ -3206,11 +3202,6 @@ static void Pnacl_M25_PPB_NaCl_Private_LogToConsole(PP_Instance instance, const
iface->LogToConsole(instance, message);
}
-static PP_Bool Pnacl_M25_PPB_NaCl_Private_GetNexeErrorReported(PP_Instance instance) {
- const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
- return iface->GetNexeErrorReported(instance);
-}
-
static PP_NaClReadyState Pnacl_M25_PPB_NaCl_Private_GetNaClReadyState(PP_Instance instance) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
return iface->GetNaClReadyState(instance);
@@ -3231,14 +3222,9 @@ static void Pnacl_M25_PPB_NaCl_Private_SetIsInstalled(PP_Instance instance, PP_B
iface->SetIsInstalled(instance, is_installed);
}
-static int64_t Pnacl_M25_PPB_NaCl_Private_GetReadyTime(PP_Instance instance) {
+static void Pnacl_M25_PPB_NaCl_Private_SetReadyTime(PP_Instance instance) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
- return iface->GetReadyTime(instance);
-}
-
-static void Pnacl_M25_PPB_NaCl_Private_SetReadyTime(PP_Instance instance, int64_t ready_time) {
- const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
- iface->SetReadyTime(instance, ready_time);
+ iface->SetReadyTime(instance);
}
static int32_t Pnacl_M25_PPB_NaCl_Private_GetExitStatus(PP_Instance instance) {
@@ -4819,10 +4805,6 @@ static const struct PPB_Font_Dev_0_6 Pnacl_Wrappers_PPB_Font_Dev_0_6 = {
.PixelOffsetForCharacter = (int32_t (*)(PP_Resource font, const struct PP_TextRun_Dev* text, uint32_t char_offset))&Pnacl_M14_PPB_Font_Dev_PixelOffsetForCharacter
};
-/* Not generating wrapper interface for PPB_Graphics2D_Dev_0_1 */
-
-/* Not generating wrapper interface for PPB_Graphics2D_Dev_0_2 */
-
static const struct PPB_IMEInputEvent_Dev_0_1 Pnacl_Wrappers_PPB_IMEInputEvent_Dev_0_1 = {
.IsIMEInputEvent = (PP_Bool (*)(PP_Resource resource))&Pnacl_M16_PPB_IMEInputEvent_Dev_IsIMEInputEvent,
.GetText = (struct PP_Var (*)(PP_Resource ime_event))&Pnacl_M16_PPB_IMEInputEvent_Dev_GetText,
@@ -5145,20 +5127,18 @@ static const struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = {
.ReportLoadSuccess = (void (*)(PP_Instance instance, const char* url, uint64_t loaded_bytes, uint64_t total_bytes))&Pnacl_M25_PPB_NaCl_Private_ReportLoadSuccess,
.ReportLoadError = (void (*)(PP_Instance instance, PP_NaClError error, const char* error_message, const char* console_message))&Pnacl_M25_PPB_NaCl_Private_ReportLoadError,
.ReportLoadAbort = (void (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_ReportLoadAbort,
- .ReportDeadNexe = (void (*)(PP_Instance instance, int64_t crash_time))&Pnacl_M25_PPB_NaCl_Private_ReportDeadNexe,
+ .NexeDidCrash = (void (*)(PP_Instance instance, const char* crash_log))&Pnacl_M25_PPB_NaCl_Private_NexeDidCrash,
.InstanceCreated = (void (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_InstanceCreated,
.InstanceDestroyed = (void (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_InstanceDestroyed,
.NaClDebugEnabledForURL = (PP_Bool (*)(const char* alleged_nmf_url))&Pnacl_M25_PPB_NaCl_Private_NaClDebugEnabledForURL,
.GetSandboxArch = (const char* (*)(void))&Pnacl_M25_PPB_NaCl_Private_GetSandboxArch,
.GetUrlScheme = (PP_UrlSchemeType (*)(struct PP_Var url))&Pnacl_M25_PPB_NaCl_Private_GetUrlScheme,
.LogToConsole = (void (*)(PP_Instance instance, const char* message))&Pnacl_M25_PPB_NaCl_Private_LogToConsole,
- .GetNexeErrorReported = (PP_Bool (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetNexeErrorReported,
.GetNaClReadyState = (PP_NaClReadyState (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetNaClReadyState,
.SetNaClReadyState = (void (*)(PP_Instance instance, PP_NaClReadyState ready_state))&Pnacl_M25_PPB_NaCl_Private_SetNaClReadyState,
.GetIsInstalled = (PP_Bool (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetIsInstalled,
.SetIsInstalled = (void (*)(PP_Instance instance, PP_Bool is_installed))&Pnacl_M25_PPB_NaCl_Private_SetIsInstalled,
- .GetReadyTime = (int64_t (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetReadyTime,
- .SetReadyTime = (void (*)(PP_Instance instance, int64_t ready_time))&Pnacl_M25_PPB_NaCl_Private_SetReadyTime,
+ .SetReadyTime = (void (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_SetReadyTime,
.GetExitStatus = (int32_t (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetExitStatus,
.SetExitStatus = (void (*)(PP_Instance instance, int32_t exit_status))&Pnacl_M25_PPB_NaCl_Private_SetExitStatus
};