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

Side by Side Diff: components/metrics/metrics_service.h

Issue 1818613002: Implement UMA log throttling for cellular connections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « components/metrics/metrics_pref_names.cc ('k') | components/metrics/metrics_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // This file defines a service that collects information about the user 5 // This file defines a service that collects information about the user
6 // experience in order to help improve future versions of the app. 6 // experience in order to help improve future versions of the app.
7 7
8 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_H_ 8 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_H_
9 #define COMPONENTS_METRICS_METRICS_SERVICE_H_ 9 #define COMPONENTS_METRICS_METRICS_SERVICE_H_
10 10
11 #include <stdint.h> 11 #include <stdint.h>
12 12
13 #include <map> 13 #include <map>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/memory/scoped_vector.h" 20 #include "base/memory/scoped_vector.h"
21 #include "base/memory/weak_ptr.h" 21 #include "base/memory/weak_ptr.h"
22 #include "base/metrics/field_trial.h" 22 #include "base/metrics/field_trial.h"
23 #include "base/metrics/histogram_flattener.h" 23 #include "base/metrics/histogram_flattener.h"
24 #include "base/metrics/histogram_snapshot_manager.h" 24 #include "base/metrics/histogram_snapshot_manager.h"
25 #include "base/metrics/user_metrics.h" 25 #include "base/metrics/user_metrics.h"
26 #include "base/observer_list.h" 26 #include "base/observer_list.h"
27 #include "base/time/time.h" 27 #include "base/time/time.h"
28 #include "build/build_config.h" 28 #include "build/build_config.h"
29 #include "components/metrics/clean_exit_beacon.h" 29 #include "components/metrics/clean_exit_beacon.h"
30 #include "components/metrics/data_use_tracker.h"
30 #include "components/metrics/metrics_log.h" 31 #include "components/metrics/metrics_log.h"
31 #include "components/metrics/metrics_log_manager.h" 32 #include "components/metrics/metrics_log_manager.h"
32 #include "components/metrics/metrics_provider.h" 33 #include "components/metrics/metrics_provider.h"
33 #include "components/metrics/net/network_metrics_provider.h" 34 #include "components/metrics/net/network_metrics_provider.h"
34 #include "components/variations/synthetic_trials.h" 35 #include "components/variations/synthetic_trials.h"
35 36
36 class PrefService; 37 class PrefService;
37 class PrefRegistrySimple; 38 class PrefRegistrySimple;
38 39
39 namespace base { 40 namespace base {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // should not be called more than once. 208 // should not be called more than once.
208 void CheckForClonedInstall( 209 void CheckForClonedInstall(
209 scoped_refptr<base::SingleThreadTaskRunner> task_runner); 210 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
210 211
211 // Clears the stability metrics that are saved in local state. 212 // Clears the stability metrics that are saved in local state.
212 void ClearSavedStabilityMetrics(); 213 void ClearSavedStabilityMetrics();
213 214
214 // Pushes a log that has been generated by an external component. 215 // Pushes a log that has been generated by an external component.
215 void PushExternalLog(const std::string& log); 216 void PushExternalLog(const std::string& log);
216 217
218 // Returns a callback to data use pref updating function which can be called
219 // from any thread, but this function should be called on UI thread.
220 UpdateUsagePrefCallbackType GetDataUseForwardingCallback();
221
217 protected: 222 protected:
218 // Exposed for testing. 223 // Exposed for testing.
219 MetricsLogManager* log_manager() { return &log_manager_; } 224 MetricsLogManager* log_manager() { return &log_manager_; }
220 225
221 private: 226 private:
222 friend class MetricsServiceAccessor; 227 friend class MetricsServiceAccessor;
223 228
224 // The MetricsService has a lifecycle that is stored as a state. 229 // The MetricsService has a lifecycle that is stored as a state.
225 // See metrics_service.cc for description of this lifecycle. 230 // See metrics_service.cc for description of this lifecycle.
226 enum State { 231 enum State {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 // Field trial groups that map to Chrome configuration states. 466 // Field trial groups that map to Chrome configuration states.
462 SyntheticTrialGroups synthetic_trial_groups_; 467 SyntheticTrialGroups synthetic_trial_groups_;
463 468
464 // List of observers of |synthetic_trial_groups_| changes. 469 // List of observers of |synthetic_trial_groups_| changes.
465 base::ObserverList<variations::SyntheticTrialObserver> 470 base::ObserverList<variations::SyntheticTrialObserver>
466 synthetic_trial_observer_list_; 471 synthetic_trial_observer_list_;
467 472
468 // Execution phase the browser is in. 473 // Execution phase the browser is in.
469 static ExecutionPhase execution_phase_; 474 static ExecutionPhase execution_phase_;
470 475
471 // Reduntant marker to check that we completed our shutdown, and set the 476 // Redundant marker to check that we completed our shutdown, and set the
472 // exited-cleanly bit in the prefs. 477 // exited-cleanly bit in the prefs.
473 static ShutdownCleanliness clean_shutdown_status_; 478 static ShutdownCleanliness clean_shutdown_status_;
474 479
475 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); 480 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess);
476 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, 481 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest,
477 PermutedEntropyCacheClearedWhenLowEntropyReset); 482 PermutedEntropyCacheClearedWhenLowEntropyReset);
478 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); 483 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial);
479 484
485 // Pointer used for obtaining data use pref updater callback on above layers.
486 scoped_ptr<DataUseTracker> data_use_tracker_;
487
480 // Weak pointers factory used to post task on different threads. All weak 488 // Weak pointers factory used to post task on different threads. All weak
481 // pointers managed by this factory have the same lifetime as MetricsService. 489 // pointers managed by this factory have the same lifetime as MetricsService.
482 base::WeakPtrFactory<MetricsService> self_ptr_factory_; 490 base::WeakPtrFactory<MetricsService> self_ptr_factory_;
483 491
484 // Weak pointers factory used for saving state. All weak pointers managed by 492 // Weak pointers factory used for saving state. All weak pointers managed by
485 // this factory are invalidated in ScheduleNextStateSave. 493 // this factory are invalidated in ScheduleNextStateSave.
486 base::WeakPtrFactory<MetricsService> state_saver_factory_; 494 base::WeakPtrFactory<MetricsService> state_saver_factory_;
487 495
488 DISALLOW_COPY_AND_ASSIGN(MetricsService); 496 DISALLOW_COPY_AND_ASSIGN(MetricsService);
489 }; 497 };
490 498
491 } // namespace metrics 499 } // namespace metrics
492 500
493 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ 501 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_
OLDNEW
« no previous file with comments | « components/metrics/metrics_pref_names.cc ('k') | components/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698