| 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 #include "chrome/browser/metrics/metrics_log.h" | 5 #include "chrome/browser/metrics/metrics_log.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 namespace { | 55 namespace { |
| 56 | 56 |
| 57 // Returns the date at which the current metrics client ID was created as | 57 // Returns the date at which the current metrics client ID was created as |
| 58 // a string containing seconds since the epoch, or "0" if none was found. | 58 // a string containing seconds since the epoch, or "0" if none was found. |
| 59 std::string GetMetricsEnabledDate(PrefService* pref) { | 59 std::string GetMetricsEnabledDate(PrefService* pref) { |
| 60 if (!pref) { | 60 if (!pref) { |
| 61 NOTREACHED(); | 61 NOTREACHED(); |
| 62 return "0"; | 62 return "0"; |
| 63 } | 63 } |
| 64 | 64 |
| 65 return pref->GetString(prefs::kMetricsReportingEnabledTimestamp); | 65 return pref->GetString(metrics::prefs::kMetricsReportingEnabledTimestamp); |
| 66 } | 66 } |
| 67 | 67 |
| 68 ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType( | 68 ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType( |
| 69 int process_type) { | 69 int process_type) { |
| 70 switch (process_type) { | 70 switch (process_type) { |
| 71 case content::PROCESS_TYPE_BROWSER: | 71 case content::PROCESS_TYPE_BROWSER: |
| 72 return ProfilerEventProto::TrackedObject::BROWSER; | 72 return ProfilerEventProto::TrackedObject::BROWSER; |
| 73 case content::PROCESS_TYPE_RENDERER: | 73 case content::PROCESS_TYPE_RENDERER: |
| 74 return ProfilerEventProto::TrackedObject::RENDERER; | 74 return ProfilerEventProto::TrackedObject::RENDERER; |
| 75 case content::PROCESS_TYPE_PLUGIN: | 75 case content::PROCESS_TYPE_PLUGIN: |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 profile = uma_proto()->add_profiler_event(); | 425 profile = uma_proto()->add_profiler_event(); |
| 426 profile->set_profile_type(ProfilerEventProto::STARTUP_PROFILE); | 426 profile->set_profile_type(ProfilerEventProto::STARTUP_PROFILE); |
| 427 profile->set_time_source(ProfilerEventProto::WALL_CLOCK_TIME); | 427 profile->set_time_source(ProfilerEventProto::WALL_CLOCK_TIME); |
| 428 } else { | 428 } else { |
| 429 // For the remaining calls, re-use the existing field. | 429 // For the remaining calls, re-use the existing field. |
| 430 profile = uma_proto()->mutable_profiler_event(0); | 430 profile = uma_proto()->mutable_profiler_event(0); |
| 431 } | 431 } |
| 432 | 432 |
| 433 WriteProfilerData(process_data, process_type, profile); | 433 WriteProfilerData(process_data, process_type, profile); |
| 434 } | 434 } |
| OLD | NEW |