OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/files/file_path.h" |
16 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
18 #include "base/memory/scoped_vector.h" | 19 #include "base/memory/scoped_vector.h" |
19 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
20 #include "base/metrics/field_trial.h" | 21 #include "base/metrics/field_trial.h" |
21 #include "base/metrics/user_metrics.h" | 22 #include "base/metrics/user_metrics.h" |
22 #include "base/observer_list.h" | 23 #include "base/observer_list.h" |
23 #include "base/process/kill.h" | |
24 #include "base/threading/thread_checker.h" | 24 #include "base/threading/thread_checker.h" |
25 #include "base/time/time.h" | 25 #include "base/time/time.h" |
26 #include "chrome/browser/metrics/metrics_log.h" | 26 #include "chrome/browser/metrics/metrics_log.h" |
27 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" | 27 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" |
28 #include "chrome/common/metrics/metrics_service_base.h" | 28 #include "chrome/common/metrics/metrics_service_base.h" |
29 #include "chrome/installer/util/google_update_settings.h" | 29 #include "chrome/installer/util/google_update_settings.h" |
30 #include "components/metrics/metrics_provider.h" | 30 #include "components/metrics/metrics_provider.h" |
31 #include "components/metrics/metrics_service_observer.h" | 31 #include "components/metrics/metrics_service_observer.h" |
32 #include "components/variations/active_field_trials.h" | 32 #include "components/variations/active_field_trials.h" |
33 #include "content/public/browser/browser_child_process_observer.h" | 33 #include "content/public/browser/browser_child_process_observer.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 // completes (either successfully or with failure). | 439 // completes (either successfully or with failure). |
440 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 440 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
441 | 441 |
442 // Reads, increments and then sets the specified integer preference. | 442 // Reads, increments and then sets the specified integer preference. |
443 void IncrementPrefValue(const char* path); | 443 void IncrementPrefValue(const char* path); |
444 | 444 |
445 // Reads, increments and then sets the specified long preference that is | 445 // Reads, increments and then sets the specified long preference that is |
446 // stored as a string. | 446 // stored as a string. |
447 void IncrementLongPrefsValue(const char* path); | 447 void IncrementLongPrefsValue(const char* path); |
448 | 448 |
449 // Records a renderer process crash. | |
450 void LogRendererCrash(content::RenderProcessHost* host, | |
451 base::TerminationStatus status, | |
452 int exit_code); | |
453 | |
454 // Records a renderer process hang. | |
455 void LogRendererHang(); | |
456 | |
457 // Records that the browser was shut down cleanly. | 449 // Records that the browser was shut down cleanly. |
458 void LogCleanShutdown(); | 450 void LogCleanShutdown(); |
459 | 451 |
460 // Returns reference to ChildProcessStats corresponding to |data|. | 452 // Returns reference to ChildProcessStats corresponding to |data|. |
461 ChildProcessStats& GetChildProcessStats( | 453 ChildProcessStats& GetChildProcessStats( |
462 const content::ChildProcessData& data); | 454 const content::ChildProcessData& data); |
463 | 455 |
464 // Saves plugin-related updates from the in-object buffer to Local State | 456 // Saves plugin-related updates from the in-object buffer to Local State |
465 // for retrieval next time we send a Profile log (generally next launch). | 457 // for retrieval next time we send a Profile log (generally next launch). |
466 void RecordPluginChanges(PrefService* pref); | 458 void RecordPluginChanges(PrefService* pref); |
467 | 459 |
468 // Records state that should be periodically saved, like uptime and | 460 // Records state that should be periodically saved, like uptime and |
469 // buffered plugin stability statistics. | 461 // buffered plugin stability statistics. |
470 void RecordCurrentState(PrefService* pref); | 462 void RecordCurrentState(PrefService* pref); |
471 | 463 |
472 // Logs the initiation of a page load and uses |web_contents| to do | |
473 // additional logging of the type of page loaded. | |
474 void LogLoadStarted(content::WebContents* web_contents); | |
475 | |
476 // Checks whether events should currently be logged. | 464 // Checks whether events should currently be logged. |
477 bool ShouldLogEvents(); | 465 bool ShouldLogEvents(); |
478 | 466 |
479 // Sets the value of the specified path in prefs and schedules a save. | 467 // Sets the value of the specified path in prefs and schedules a save. |
480 void RecordBooleanPrefValue(const char* path, bool value); | 468 void RecordBooleanPrefValue(const char* path, bool value); |
481 | 469 |
482 // Returns true if process of type |type| should be counted as a plugin | 470 // Returns true if process of type |type| should be counted as a plugin |
483 // process, and false otherwise. | 471 // process, and false otherwise. |
484 static bool IsPluginProcess(int process_type); | 472 static bool IsPluginProcess(int process_type); |
485 | 473 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 | 635 |
648 // Registers/unregisters |observer| to receive MetricsLog notifications | 636 // Registers/unregisters |observer| to receive MetricsLog notifications |
649 // from metrics service. | 637 // from metrics service. |
650 static void AddMetricsServiceObserver(MetricsServiceObserver* observer); | 638 static void AddMetricsServiceObserver(MetricsServiceObserver* observer); |
651 static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer); | 639 static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer); |
652 | 640 |
653 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); | 641 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); |
654 }; | 642 }; |
655 | 643 |
656 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 644 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
OLD | NEW |