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

Unified Diff: chrome/browser/metrics/plugin_metrics_provider.h

Issue 441013002: Eliminate MetricsProvider::RecordCurrentState() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: last changes Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/metrics/plugin_metrics_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/plugin_metrics_provider.h
diff --git a/chrome/browser/metrics/plugin_metrics_provider.h b/chrome/browser/metrics/plugin_metrics_provider.h
index baabcf746df0bc5a1f499815ca0898d56e7078d0..fb9706b5cff585f94aaa25db4d27c5ed4f0e7da4 100644
--- a/chrome/browser/metrics/plugin_metrics_provider.h
+++ b/chrome/browser/metrics/plugin_metrics_provider.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "components/metrics/metrics_provider.h"
@@ -42,7 +43,6 @@ class PluginMetricsProvider : public metrics::MetricsProvider,
metrics::SystemProfileProto* system_profile_proto) OVERRIDE;
virtual void ProvideStabilityMetrics(
metrics::SystemProfileProto* system_profile_proto) OVERRIDE;
- virtual void RecordCurrentState() OVERRIDE;
// Notifies the provider about an error loading the plugin at |plugin_path|.
void LogPluginLoadingError(const base::FilePath& plugin_path);
@@ -58,6 +58,12 @@ class PluginMetricsProvider : public metrics::MetricsProvider,
static void RegisterPrefs(PrefRegistrySimple* registry);
private:
+ FRIEND_TEST_ALL_PREFIXES(PluginMetricsProviderTest,
+ RecordCurrentStateWithDelay);
+ FRIEND_TEST_ALL_PREFIXES(PluginMetricsProviderTest,
+ RecordCurrentStateIfPending);
+ FRIEND_TEST_ALL_PREFIXES(PluginMetricsProviderTest,
+ ProvideStabilityMetricsWhenPendingTask);
struct ChildProcessStats;
// Receives the plugin list from the PluginService and calls |done_callback|.
@@ -68,6 +74,18 @@ class PluginMetricsProvider : public metrics::MetricsProvider,
ChildProcessStats& GetChildProcessStats(
const content::ChildProcessData& data);
+ // Saves plugin information to local state.
+ void RecordCurrentState();
+
+ // Posts a delayed task for RecordCurrentState. Returns true if new task is
+ // posted and false if there was one already waiting for execution.
+ // The param delay_sec is for unit tests.
+ bool RecordCurrentStateWithDelay(int delay_ms);
+
+ // If a delayed RecordCurrnetState task exists then cancels it, calls
+ // RecordCurrentState immediately and returns true. Otherwise returns false.
+ bool RecordCurrentStateIfPending();
+
// content::BrowserChildProcessObserver:
virtual void BrowserChildProcessHostConnected(
const content::ChildProcessData& data) OVERRIDE;
« no previous file with comments | « no previous file | chrome/browser/metrics/plugin_metrics_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698