diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-22 05:16:13 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-22 05:16:13 +0000 |
commit | f3b3576935e25d8d4e6c244740a06a36b9dc9f8e (patch) | |
tree | a5e44168dc6631d47c58e1b9c6008e236581bcbe /chrome/browser/metrics | |
parent | 0c472954a32a68e6d6cc7be6eb53b6b9e99b66d6 (diff) | |
download | chromium_src-f3b3576935e25d8d4e6c244740a06a36b9dc9f8e.zip chromium_src-f3b3576935e25d8d4e6c244740a06a36b9dc9f8e.tar.gz chromium_src-f3b3576935e25d8d4e6c244740a06a36b9dc9f8e.tar.bz2 |
Split the ProcessType enum into process types that content knows about (which will remain in src\content) and those that are for chrome (which moved to src\chrome). This way we won't get any more layering violations where nacl code is in content.
Also move the NaCl command line switches to chrome.
BUG=191682
Review URL: https://codereview.chromium.org/12662019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189763 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r-- | chrome/browser/metrics/metrics_log.cc | 19 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_log.h | 3 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_log_unittest.cc | 1 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.cc | 25 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.h | 4 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/metrics/tracking_synchronizer.cc | 5 | ||||
-rw-r--r-- | chrome/browser/metrics/tracking_synchronizer.h | 4 | ||||
-rw-r--r-- | chrome/browser/metrics/tracking_synchronizer_observer.h | 4 |
9 files changed, 35 insertions, 32 deletions
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index 646ddb4..141dac8 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -32,6 +32,7 @@ #include "chrome/browser/google/google_util.h" #include "chrome/browser/plugins/plugin_prefs.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/common/chrome_process_type.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/metrics/proto/omnibox_event.pb.h" @@ -138,7 +139,7 @@ OmniboxEventProto::Suggestion::ResultType AsOmniboxEventResultType( } ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType( - content::ProcessType process_type) { + int process_type) { switch (process_type) { case content::PROCESS_TYPE_BROWSER: return ProfilerEventProto::TrackedObject::BROWSER; @@ -148,24 +149,24 @@ ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType( return ProfilerEventProto::TrackedObject::PLUGIN; case content::PROCESS_TYPE_WORKER: return ProfilerEventProto::TrackedObject::WORKER; - case content::PROCESS_TYPE_NACL_LOADER: - return ProfilerEventProto::TrackedObject::NACL_LOADER; case content::PROCESS_TYPE_UTILITY: return ProfilerEventProto::TrackedObject::UTILITY; - case content::PROCESS_TYPE_PROFILE_IMPORT: - return ProfilerEventProto::TrackedObject::PROFILE_IMPORT; case content::PROCESS_TYPE_ZYGOTE: return ProfilerEventProto::TrackedObject::ZYGOTE; case content::PROCESS_TYPE_SANDBOX_HELPER: return ProfilerEventProto::TrackedObject::SANDBOX_HELPER; - case content::PROCESS_TYPE_NACL_BROKER: - return ProfilerEventProto::TrackedObject::NACL_BROKER; case content::PROCESS_TYPE_GPU: return ProfilerEventProto::TrackedObject::GPU; case content::PROCESS_TYPE_PPAPI_PLUGIN: return ProfilerEventProto::TrackedObject::PPAPI_PLUGIN; case content::PROCESS_TYPE_PPAPI_BROKER: return ProfilerEventProto::TrackedObject::PPAPI_BROKER; + case PROCESS_TYPE_PROFILE_IMPORT: + return ProfilerEventProto::TrackedObject::PROFILE_IMPORT; + case PROCESS_TYPE_NACL_LOADER: + return ProfilerEventProto::TrackedObject::NACL_LOADER; + case PROCESS_TYPE_NACL_BROKER: + return ProfilerEventProto::TrackedObject::NACL_BROKER; default: NOTREACHED(); return ProfilerEventProto::TrackedObject::UNKNOWN; @@ -213,7 +214,7 @@ void WriteFieldTrials(const std::vector<ActiveGroupId>& field_trial_ids, } void WriteProfilerData(const ProcessDataSnapshot& profiler_data, - content::ProcessType process_type, + int process_type, ProfilerEventProto* performance_profile) { for (std::vector<tracked_objects::TaskSnapshot>::const_iterator it = profiler_data.tasks.begin(); @@ -882,7 +883,7 @@ void MetricsLog::RecordEnvironmentProto( void MetricsLog::RecordProfilerData( const tracked_objects::ProcessDataSnapshot& process_data, - content::ProcessType process_type) { + int process_type) { DCHECK(!locked()); if (tracked_objects::GetTimeSourceType() != diff --git a/chrome/browser/metrics/metrics_log.h b/chrome/browser/metrics/metrics_log.h index def5887..f5cf34e 100644 --- a/chrome/browser/metrics/metrics_log.h +++ b/chrome/browser/metrics/metrics_log.h @@ -15,7 +15,6 @@ #include "chrome/browser/metrics/metrics_network_observer.h" #include "chrome/common/metrics/metrics_log_base.h" #include "chrome/installer/util/google_update_settings.h" -#include "content/public/common/process_type.h" #include "ui/gfx/size.h" #if defined(OS_CHROMEOS) @@ -113,7 +112,7 @@ class MetricsLog : public MetricsLogBase { // browser's profiled performance during startup for a single process. void RecordProfilerData( const tracked_objects::ProcessDataSnapshot& process_data, - content::ProcessType process_type); + int process_type); // Record recent delta for critical stability metrics. We can't wait for a // restart to gather these, as that delay biases our observation away from diff --git a/chrome/browser/metrics/metrics_log_unittest.cc b/chrome/browser/metrics/metrics_log_unittest.cc index fa26522..946dbb7 100644 --- a/chrome/browser/metrics/metrics_log_unittest.cc +++ b/chrome/browser/metrics/metrics_log_unittest.cc @@ -17,6 +17,7 @@ #include "chrome/browser/google/google_util.h" #include "chrome/browser/metrics/metrics_log.h" #include "chrome/browser/prefs/browser_prefs.h" +#include "chrome/common/chrome_process_type.h" #include "chrome/common/metrics/proto/profiler_event.pb.h" #include "chrome/common/metrics/proto/system_profile.pb.h" #include "chrome/common/metrics/variations/variations_util.h" diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index b5323d2..e68d7bf 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -187,6 +187,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_otr_state.h" #include "chrome/common/child_process_logging.h" +#include "chrome/common/chrome_process_type.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_result_codes.h" #include "chrome/common/chrome_switches.h" @@ -335,12 +336,12 @@ MetricsService::ShutdownCleanliness MetricsService::clean_shutdown_status_ = // reported to the UMA server on next launch. struct MetricsService::ChildProcessStats { public: - explicit ChildProcessStats(content::ProcessType type) + explicit ChildProcessStats(int process_type) : process_launches(0), process_crashes(0), instances(0), loading_errors(0), - process_type(type) {} + process_type(process_type) {} // This constructor is only used by the map to return some default value for // an index for which no value has been assigned. @@ -366,7 +367,7 @@ struct MetricsService::ChildProcessStats { // process. int loading_errors; - content::ProcessType process_type; + int process_type; }; // Handles asynchronous fetching of memory details. @@ -649,7 +650,7 @@ void MetricsService::BrowserChildProcessCrashed( GetChildProcessStats(data).process_crashes++; // Exclude plugin crashes from the count below because we report them via // a separate UMA metric. - if (!IsPluginProcess(data.type)) + if (!IsPluginProcess(data.process_type)) IncrementPrefValue(prefs::kStabilityChildProcessCrashCount); } @@ -1008,7 +1009,7 @@ void MetricsService::OnUserAction(const std::string& action) { void MetricsService::ReceivedProfilerData( const tracked_objects::ProcessDataSnapshot& process_data, - content::ProcessType process_type) { + int process_type) { DCHECK_EQ(INIT_TASK_SCHEDULED, state_); // Upon the first callback, create the initial log so that we can immediately @@ -1723,8 +1724,10 @@ void MetricsService::LogPluginLoadingError(const base::FilePath& plugin_path) { MetricsService::ChildProcessStats& MetricsService::GetChildProcessStats( const content::ChildProcessData& data) { const string16& child_name = data.name; - if (!ContainsKey(child_process_stats_buffer_, child_name)) - child_process_stats_buffer_[child_name] = ChildProcessStats(data.type); + if (!ContainsKey(child_process_stats_buffer_, child_name)) { + child_process_stats_buffer_[child_name] = + ChildProcessStats(data.process_type); + } return child_process_stats_buffer_[child_name]; } @@ -1847,10 +1850,10 @@ void MetricsService::RecordCurrentState(PrefService* pref) { } // static -bool MetricsService::IsPluginProcess(content::ProcessType type) { - return (type == content::PROCESS_TYPE_PLUGIN || - type == content::PROCESS_TYPE_PPAPI_PLUGIN || - type == content::PROCESS_TYPE_PPAPI_BROKER); +bool MetricsService::IsPluginProcess(int process_type) { + return (process_type == content::PROCESS_TYPE_PLUGIN || + process_type == content::PROCESS_TYPE_PPAPI_PLUGIN || + process_type == content::PROCESS_TYPE_PPAPI_BROKER); } #if defined(OS_CHROMEOS) diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h index 6091c2a..dc3fddb 100644 --- a/chrome/browser/metrics/metrics_service.h +++ b/chrome/browser/metrics/metrics_service.h @@ -252,7 +252,7 @@ class MetricsService // TrackingSynchronizerObserver: virtual void ReceivedProfilerData( const tracked_objects::ProcessDataSnapshot& process_data, - content::ProcessType process_type) OVERRIDE; + int process_type) OVERRIDE; // Callback that moves the state to INIT_TASK_DONE. virtual void FinishedReceivingProfilerData() OVERRIDE; @@ -405,7 +405,7 @@ class MetricsService // Returns true if process of type |type| should be counted as a plugin // process, and false otherwise. - static bool IsPluginProcess(content::ProcessType type); + static bool IsPluginProcess(int process_type); content::ActionCallback action_callback_; diff --git a/chrome/browser/metrics/metrics_service_unittest.cc b/chrome/browser/metrics/metrics_service_unittest.cc index d1109a6..17ec707 100644 --- a/chrome/browser/metrics/metrics_service_unittest.cc +++ b/chrome/browser/metrics/metrics_service_unittest.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - #include <ctype.h> #include <string> #include "chrome/browser/metrics/metrics_service.h" +#include "chrome/common/chrome_process_type.h" #include "testing/gtest/include/gtest/gtest.h" // Ensure the ClientId is formatted as expected. diff --git a/chrome/browser/metrics/tracking_synchronizer.cc b/chrome/browser/metrics/tracking_synchronizer.cc index 75d7c0e..bdc0888 100644 --- a/chrome/browser/metrics/tracking_synchronizer.cc +++ b/chrome/browser/metrics/tracking_synchronizer.cc @@ -10,6 +10,7 @@ #include "base/threading/thread.h" #include "base/tracked_objects.h" #include "chrome/browser/metrics/tracking_synchronizer_observer.h" +#include "chrome/common/chrome_process_type.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/profiler_controller.h" @@ -233,7 +234,7 @@ void TrackingSynchronizer::OnPendingProcesses(int sequence_number, void TrackingSynchronizer::OnProfilerDataCollected( int sequence_number, const tracked_objects::ProcessDataSnapshot& profiler_data, - content::ProcessType process_type) { + int process_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DecrementPendingProcessesAndSendData(sequence_number, profiler_data, process_type); @@ -266,7 +267,7 @@ int TrackingSynchronizer::RegisterAndNotifyAllProcesses( void TrackingSynchronizer::DecrementPendingProcessesAndSendData( int sequence_number, const tracked_objects::ProcessDataSnapshot& profiler_data, - content::ProcessType process_type) { + int process_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); RequestContext* request = RequestContext::GetRequestContext(sequence_number); diff --git a/chrome/browser/metrics/tracking_synchronizer.h b/chrome/browser/metrics/tracking_synchronizer.h index 45c94fe..2fcfebb 100644 --- a/chrome/browser/metrics/tracking_synchronizer.h +++ b/chrome/browser/metrics/tracking_synchronizer.h @@ -75,7 +75,7 @@ class TrackingSynchronizer virtual void OnProfilerDataCollected( int sequence_number, const tracked_objects::ProcessDataSnapshot& profiler_data, - content::ProcessType process_type) OVERRIDE; + int process_type) OVERRIDE; // Establish a new sequence_number_, and use it to notify all the processes of // the need to supply, to the browser, their tracking data. It also registers @@ -94,7 +94,7 @@ class TrackingSynchronizer void DecrementPendingProcessesAndSendData( int sequence_number, const tracked_objects::ProcessDataSnapshot& profiler_data, - content::ProcessType process_type); + int process_type); // Get a new sequence number to be sent to processes from browser process. // This method is accessible on UI thread. diff --git a/chrome/browser/metrics/tracking_synchronizer_observer.h b/chrome/browser/metrics/tracking_synchronizer_observer.h index e11f138..9dc1d75 100644 --- a/chrome/browser/metrics/tracking_synchronizer_observer.h +++ b/chrome/browser/metrics/tracking_synchronizer_observer.h @@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_METRICS_TRACKING_SYNCHRONIZER_OBSERVER_H_ #define CHROME_BROWSER_METRICS_TRACKING_SYNCHRONIZER_OBSERVER_H_ -#include "content/public/common/process_type.h" - namespace tracked_objects { struct ProcessDataSnapshot; } @@ -21,7 +19,7 @@ class TrackingSynchronizerObserver { // |FinishedReceivingData()| is called. virtual void ReceivedProfilerData( const tracked_objects::ProcessDataSnapshot& profiler_data, - content::ProcessType process_type) = 0; + int process_type) = 0; // The observer should not expect any more calls to |ReceivedProfilerData()| // (without re-registering). This is sent either when data from all processes |