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

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

Issue 1218583002: metrics: Add dbus interface for GetRandomPerfOutput (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do not allow both perf_stat and perf_data to be passed in; treat it as an error Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/perf_provider_chromeos.h
diff --git a/chrome/browser/metrics/perf_provider_chromeos.h b/chrome/browser/metrics/perf_provider_chromeos.h
index 8353be5f59b32f9574b8566fa119a2fc6f065e26..d9f75bde21a336f239542bfefe0d592da3344983 100644
--- a/chrome/browser/metrics/perf_provider_chromeos.h
+++ b/chrome/browser/metrics/perf_provider_chromeos.h
@@ -19,14 +19,22 @@
namespace metrics {
-class WindowedIncognitoObserver;
-
// Provides access to ChromeOS perf data. perf aka "perf events" is a
// performance profiling infrastructure built into the linux kernel. For more
// information, see: https://perf.wiki.kernel.org/index.php/Main_Page.
class PerfProvider : public base::NonThreadSafe,
public chromeos::PowerManagerClient::Observer {
public:
+ // Interface for detecting that an incognito window was opened.
+ class IncognitoObserverInterface {
Ilya Sherman 2015/07/01 03:09:02 nit: If you really need this class, please omit th
Simon Que 2015/07/01 20:22:57 Done.
+ public:
+ virtual ~IncognitoObserverInterface() {}
+
+ // Returns true if an incognito window was opened during the lifetime of the
+ // object.
+ virtual bool incognito_launched() const = 0;
Ilya Sherman 2015/07/01 03:09:02 nit: virtual functions are never trivial/inline-ab
Simon Que 2015/07/01 20:22:57 Done.
+ };
+
PerfProvider();
~PerfProvider() override;
@@ -35,6 +43,9 @@ class PerfProvider : public base::NonThreadSafe,
bool GetSampledProfiles(std::vector<SampledProfile>* sampled_profiles);
private:
+ // For unit testing.
+ friend class PerfProviderTest;
Ilya Sherman 2015/07/01 03:09:02 Please don't friend test classes -- it allows test
Simon Que 2015/07/01 21:08:02 Done.
+
// Class that listens for changes to the login state. When a normal user logs
// in, it updates PerfProvider to start collecting data.
class LoginObserver : public chromeos::LoginState::Observer {
@@ -93,14 +104,22 @@ class PerfProvider : public base::NonThreadSafe,
const base::TimeDelta& time_after_restore,
int num_tabs_restored);
- // Parses a perf data protobuf from the |data| passed in only if the
- // |incognito_observer| indicates that no incognito window had been opened
- // during the profile collection period.
+ // Parses a PerfDataProto from serialized data |perf_data|, if it exists.
+ // Parses a PerfStatProto from serialized data |perf_stat|, if it exists.
+ // Only one of these may contain data. If both |perf_data| and |perf_stat|
+ // contain data, it is counted as an error and neither is parsed.
+ // |incognito_observer| indicates whether an incognito window had been opened
+ // during the profile collection period. If there was an incognito window,
+ // discard the incoming data.
// |trigger_event| is the cause of the perf data collection.
- void ParseProtoIfValid(
- scoped_ptr<WindowedIncognitoObserver> incognito_observer,
+ // |result| is the return value of running perf/quipper. It is 0 if successful
+ // and nonzero if not successful.
+ void ParseOutputProtoIfValid(
+ scoped_ptr<IncognitoObserverInterface> incognito_observer,
scoped_ptr<SampledProfile> sampled_profile,
- const std::vector<uint8>& data);
+ int result,
+ const std::vector<uint8>& perf_data,
+ const std::vector<uint8>& perf_stat);
// Vector of SampledProfile protobufs containing perf profiles.
std::vector<SampledProfile> cached_perf_data_;
« no previous file with comments | « no previous file | chrome/browser/metrics/perf_provider_chromeos.cc » ('j') | chrome/browser/metrics/perf_provider_chromeos.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698