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/performance_monitor/event.h" | 5 #include "chrome/browser/performance_monitor/event.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace performance_monitor { | 9 namespace performance_monitor { |
10 namespace { | 10 namespace { |
11 | 11 |
12 // Keep this array synced with EventTypes in the header file. | 12 // Keep this array synced with EventTypes in the header file. |
13 // TODO(mtytel): i18n. | 13 // TODO(mtytel): i18n. |
14 const char* kEventTypeNames[] = { | 14 const char* kEventTypeNames[] = { |
15 "Undefined", | 15 "Undefined", |
16 "Extension Installs", | 16 "Extension Installs", |
17 "Extension Uninstalls", | 17 "Extension Uninstalls", |
18 "Extension Updates", | 18 "Extension Updates", |
19 "Extension Enables", | 19 "Extension Enables", |
20 "Extension Unloads", | 20 "Extension Disables", |
21 "Chrome Updates", | 21 "Chrome Updates", |
22 "Renderer Freezes", | 22 "Renderer Freezes", |
23 "Renderer Crashes", | 23 "Renderer Crashes", |
24 "Out of Memory Crashes", | 24 "Out of Memory Crashes", |
25 "Unclean Shutdowns" | 25 "Unclean Shutdowns" |
26 }; | 26 }; |
27 COMPILE_ASSERT(ARRAYSIZE_UNSAFE(kEventTypeNames) == EVENT_NUMBER_OF_EVENTS, | 27 COMPILE_ASSERT(ARRAYSIZE_UNSAFE(kEventTypeNames) == EVENT_NUMBER_OF_EVENTS, |
28 event_names_incorrect_size); | 28 event_names_incorrect_size); |
29 | 29 |
30 } // namespace | 30 } // namespace |
(...skipping 18 matching lines...) Expand all Loading... |
49 return scoped_ptr<Event>(); | 49 return scoped_ptr<Event>(); |
50 double time = 0.0; | 50 double time = 0.0; |
51 if (!data->GetDouble(std::string("time"), &time)) | 51 if (!data->GetDouble(std::string("time"), &time)) |
52 return scoped_ptr<Event>(); | 52 return scoped_ptr<Event>(); |
53 return scoped_ptr<Event>(new Event(static_cast<EventType>(type), | 53 return scoped_ptr<Event>(new Event(static_cast<EventType>(type), |
54 base::Time::FromInternalValue((int64)time), | 54 base::Time::FromInternalValue((int64)time), |
55 data.Pass())); | 55 data.Pass())); |
56 } | 56 } |
57 | 57 |
58 } // namespace performance_monitor | 58 } // namespace performance_monitor |
OLD | NEW |