summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbbudge <bbudge@chromium.org>2015-04-03 10:18:22 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-03 17:18:51 +0000
commit747e4bfbd5795b2192afc9b3372dfde7df3a4afb (patch)
tree34a4eaf239e181e9aade6d5d83eabdbe6cfc0b3b
parent6d9b2f470073c2125c1e085e38efa7710d94aca1 (diff)
downloadchromium_src-747e4bfbd5795b2192afc9b3372dfde7df3a4afb.zip
chromium_src-747e4bfbd5795b2192afc9b3372dfde7df3a4afb.tar.gz
chromium_src-747e4bfbd5795b2192afc9b3372dfde7df3a4afb.tar.bz2
Native Client: Remove histogram code from the trusted NaCl plugin.
Removes the last histogram code from the trusted plugin. This code fails because the proxy can't enter a destroyed plugin instance. Move the histogram to content/renderer/pepper/pepper_plugin_instance_impl.cc. BUG=388302,472206 Review URL: https://codereview.chromium.org/1055683004 Cr-Commit-Position: refs/heads/master@{#323760}
-rw-r--r--components/nacl/renderer/histogram.cc6
-rw-r--r--components/nacl/renderer/plugin/plugin.cc25
-rw-r--r--components/nacl/renderer/plugin/plugin.h4
-rw-r--r--content/renderer/pepper/pepper_plugin_instance_impl.cc12
4 files changed, 10 insertions, 37 deletions
diff --git a/components/nacl/renderer/histogram.cc b/components/nacl/renderer/histogram.cc
index bffdba0..7f14657 100644
--- a/components/nacl/renderer/histogram.cc
+++ b/components/nacl/renderer/histogram.cc
@@ -85,8 +85,6 @@ void HistogramEnumerateOsArch(const std::string& sandbox_isa) {
}
// Records values up to 20 seconds.
-// These constants MUST match those in
-// components/nacl/renderer/plugin/plugin.cc
void HistogramTimeSmall(const std::string& name, int64_t sample) {
if (sample < 0)
sample = 0;
@@ -101,8 +99,6 @@ void HistogramTimeSmall(const std::string& name, int64_t sample) {
}
// Records values up to 3 minutes, 20 seconds.
-// These constants MUST match those in
-// components/nacl/renderer/plugin/plugin.cc
void HistogramTimeMedium(const std::string& name, int64_t sample) {
if (sample < 0)
sample = 0;
@@ -117,8 +113,6 @@ void HistogramTimeMedium(const std::string& name, int64_t sample) {
}
// Records values up to 33 minutes.
-// These constants MUST match those in
-// components/nacl/renderer/plugin/plugin.cc
void HistogramTimeLarge(const std::string& name, int64_t sample) {
if (sample < 0)
sample = 0;
diff --git a/components/nacl/renderer/plugin/plugin.cc b/components/nacl/renderer/plugin/plugin.cc
index c714040..89c5db7 100644
--- a/components/nacl/renderer/plugin/plugin.cc
+++ b/components/nacl/renderer/plugin/plugin.cc
@@ -26,15 +26,6 @@
namespace plugin {
-namespace {
-
-// Up to 20 seconds
-const int64_t kTimeSmallMin = 1; // in ms
-const int64_t kTimeSmallMax = 20000; // in ms
-const uint32_t kTimeSmallBuckets = 100;
-
-} // namespace
-
void Plugin::ShutDownSubprocesses() {
PLUGIN_PRINTF(("Plugin::ShutDownSubprocesses (this=%p)\n",
static_cast<void*>(this)));
@@ -47,15 +38,6 @@ void Plugin::ShutDownSubprocesses() {
static_cast<void*>(this)));
}
-void Plugin::HistogramTimeSmall(const std::string& name,
- int64_t ms) {
- if (ms < 0) return;
- uma_interface_.HistogramCustomTimes(name,
- ms,
- kTimeSmallMin, kTimeSmallMax,
- kTimeSmallBuckets);
-}
-
bool Plugin::LoadHelperNaClModuleInternal(NaClSubprocess* subprocess,
const SelLdrStartParams& params) {
CHECK(!pp::Module::Get()->core()->IsMainThread());
@@ -251,8 +233,6 @@ Plugin::Plugin(PP_Instance pp_instance)
}
Plugin::~Plugin() {
- int64_t shutdown_start = NaClGetTimeOfDayMicroseconds();
-
// Destroy the coordinator while the rest of the data is still there
pnacl_coordinator_.reset(NULL);
@@ -285,11 +265,6 @@ Plugin::~Plugin() {
ShutDownSubprocesses();
delete wrapper_factory_;
-
- HistogramTimeSmall(
- "NaCl.Perf.ShutdownTime.Total",
- (NaClGetTimeOfDayMicroseconds() - shutdown_start)
- / NACL_MICROS_PER_MILLI);
}
bool Plugin::HandleDocumentLoad(const pp::URLLoader& url_loader) {
diff --git a/components/nacl/renderer/plugin/plugin.h b/components/nacl/renderer/plugin/plugin.h
index cb0e2937..7e9a323 100644
--- a/components/nacl/renderer/plugin/plugin.h
+++ b/components/nacl/renderer/plugin/plugin.h
@@ -110,10 +110,6 @@ class Plugin : public pp::Instance {
// in this order, for the main nacl subprocess.
void ShutDownSubprocesses();
- // Histogram helper functions, internal to Plugin so they can use
- // uma_interface_ normally.
- void HistogramTimeSmall(const std::string& name, int64_t ms);
-
// Loads and starts a helper (e.g. llc, ld) NaCl module.
// Only to be used from a background (non-main) thread for the PNaCl
// translator. This will fully initialize the |subprocess| if the load was
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc
index f949129..b51c2a3 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/memory/linked_ptr.h"
#include "base/message_loop/message_loop.h"
+#include "base/metrics/histogram.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_offset_string_conversions.h"
@@ -678,10 +679,17 @@ void PepperPluginInstanceImpl::Delete() {
// If this is a NaCl plugin instance, shut down the NaCl plugin by calling
// its DidDestroy. Don't call DidDestroy on the untrusted plugin instance,
// since there is little that it can do at this point.
- if (original_instance_interface_)
+ if (original_instance_interface_) {
+ base::TimeTicks start = base::TimeTicks::Now();
original_instance_interface_->DidDestroy(pp_instance());
- else
+ UMA_HISTOGRAM_CUSTOM_TIMES("NaCl.Perf.ShutdownTime.Total",
+ base::TimeTicks::Now() - start,
+ base::TimeDelta::FromMilliseconds(1),
+ base::TimeDelta::FromSeconds(20),
+ 100);
+ } else {
instance_interface_->DidDestroy(pp_instance());
+ }
// Ensure we don't attempt to call functions on the destroyed instance.
original_instance_interface_.reset();
instance_interface_.reset();