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/performance_monitor_util.h" | 5 #include "chrome/browser/performance_monitor/performance_monitor_util.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 const base::Time& time, | 177 const base::Time& time, |
178 const EventType& type, | 178 const EventType& type, |
179 const std::string& url) { | 179 const std::string& url) { |
180 events::RendererCrash event; | 180 events::RendererCrash event; |
181 event.event_type = type; | 181 event.event_type = type; |
182 event.time = static_cast<double>(time.ToInternalValue()); | 182 event.time = static_cast<double>(time.ToInternalValue()); |
183 scoped_ptr<base::DictionaryValue> value = event.ToValue(); | 183 scoped_ptr<base::DictionaryValue> value = event.ToValue(); |
184 return scoped_ptr<Event>(new Event(type, time, value.Pass())); | 184 return scoped_ptr<Event>(new Event(type, time, value.Pass())); |
185 } | 185 } |
186 | 186 |
187 scoped_ptr<Event> CreateUncleanShutdownEvent(const base::Time& time) { | 187 scoped_ptr<Event> CreateUncleanExitEvent(const base::Time& time, |
188 events::UncleanShutdown event; | 188 const std::string& profile_name) { |
189 event.event_type = EVENT_UNCLEAN_SHUTDOWN; | 189 events::UncleanExit event; |
| 190 event.event_type = EVENT_UNCLEAN_EXIT; |
190 event.time = static_cast<double>(time.ToInternalValue()); | 191 event.time = static_cast<double>(time.ToInternalValue()); |
| 192 event.profile_name = profile_name; |
191 scoped_ptr<base::DictionaryValue> value = event.ToValue(); | 193 scoped_ptr<base::DictionaryValue> value = event.ToValue(); |
192 return scoped_ptr<Event>(new Event( | 194 return scoped_ptr<Event>(new Event( |
193 EVENT_UNCLEAN_SHUTDOWN, time, value.Pass())); | 195 EVENT_UNCLEAN_EXIT, time, value.Pass())); |
194 } | 196 } |
195 | 197 |
196 scoped_ptr<Event> CreateChromeUpdateEvent( | 198 scoped_ptr<Event> CreateChromeUpdateEvent(const base::Time& time, |
197 const base::Time& time, | 199 const std::string& previous_version, |
198 const std::string& previous_version, | 200 const std::string& current_version) { |
199 const std::string& current_version) { | |
200 events::ChromeUpdate event; | 201 events::ChromeUpdate event; |
201 event.event_type = EVENT_CHROME_UPDATE; | 202 event.event_type = EVENT_CHROME_UPDATE; |
202 event.time = static_cast<double>(time.ToInternalValue()); | 203 event.time = static_cast<double>(time.ToInternalValue()); |
203 event.previous_version = previous_version; | 204 event.previous_version = previous_version; |
204 event.current_version = current_version; | 205 event.current_version = current_version; |
205 scoped_ptr<base::DictionaryValue> value = event.ToValue(); | 206 scoped_ptr<base::DictionaryValue> value = event.ToValue(); |
206 return scoped_ptr<Event>(new Event( | 207 return scoped_ptr<Event>(new Event( |
207 EVENT_CHROME_UPDATE, time, value.Pass())); | 208 EVENT_CHROME_UPDATE, time, value.Pass())); |
208 } | 209 } |
209 | 210 |
210 } // namespace util | 211 } // namespace util |
211 } // namespace performance_monitor | 212 } // namespace performance_monitor |
OLD | NEW |