Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: chrome/browser/performance_monitor/performance_monitor_util.cc

Issue 10987040: Fix CPM casting issue; refactor renderer crash events (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Nit fixes, latest master Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 30 matching lines...) Expand all
41 event.extension_name = name; 41 event.extension_name = name;
42 event.extension_url = url; 42 event.extension_url = url;
43 event.extension_location = location; 43 event.extension_location = location;
44 event.extension_version = version; 44 event.extension_version = version;
45 event.extension_description = description; 45 event.extension_description = description;
46 scoped_ptr<base::DictionaryValue> value = event.ToValue(); 46 scoped_ptr<base::DictionaryValue> value = event.ToValue();
47 return scoped_ptr<Event>(new Event( 47 return scoped_ptr<Event>(new Event(
48 type, time, value.Pass())); 48 type, time, value.Pass()));
49 } 49 }
50 50
51 scoped_ptr<Event> CreateRendererFreezeEvent(const base::Time& time, 51 scoped_ptr<Event> CreateRendererFailureEvent(const base::Time& time,
52 const std::string& url) { 52 const EventType& type,
53 events::RendererFreeze event; 53 const std::string& url) {
54 event.event_type = EVENT_RENDERER_FREEZE; 54 events::RendererFailure event;
55 event.event_type = type;
55 event.time = static_cast<double>(time.ToInternalValue()); 56 event.time = static_cast<double>(time.ToInternalValue());
56 event.url = url; 57 event.url = url;
57 scoped_ptr<base::DictionaryValue> value = event.ToValue(); 58 scoped_ptr<base::DictionaryValue> value = event.ToValue();
58 return scoped_ptr<Event>(new Event(
59 EVENT_RENDERER_FREEZE, time, value.Pass()));
60 }
61
62 scoped_ptr<Event> CreateCrashEvent(const base::Time& time,
63 const EventType& type) {
64 events::RendererCrash event;
65 event.event_type = type;
66 event.time = static_cast<double>(time.ToInternalValue());
67 scoped_ptr<base::DictionaryValue> value = event.ToValue();
68 return scoped_ptr<Event>(new Event(type, time, value.Pass())); 59 return scoped_ptr<Event>(new Event(type, time, value.Pass()));
69 } 60 }
70 61
71 scoped_ptr<Event> CreateUncleanExitEvent(const base::Time& time, 62 scoped_ptr<Event> CreateUncleanExitEvent(const base::Time& time,
72 const std::string& profile_name) { 63 const std::string& profile_name) {
73 events::UncleanExit event; 64 events::UncleanExit event;
74 event.event_type = EVENT_UNCLEAN_EXIT; 65 event.event_type = EVENT_UNCLEAN_EXIT;
75 event.time = static_cast<double>(time.ToInternalValue()); 66 event.time = static_cast<double>(time.ToInternalValue());
76 event.profile_name = profile_name; 67 event.profile_name = profile_name;
77 scoped_ptr<base::DictionaryValue> value = event.ToValue(); 68 scoped_ptr<base::DictionaryValue> value = event.ToValue();
78 return scoped_ptr<Event>(new Event( 69 return scoped_ptr<Event>(new Event(
79 EVENT_UNCLEAN_EXIT, time, value.Pass())); 70 EVENT_UNCLEAN_EXIT, time, value.Pass()));
80 } 71 }
81 72
82 scoped_ptr<Event> CreateChromeUpdateEvent(const base::Time& time, 73 scoped_ptr<Event> CreateChromeUpdateEvent(const base::Time& time,
83 const std::string& previous_version, 74 const std::string& previous_version,
84 const std::string& current_version) { 75 const std::string& current_version) {
85 events::ChromeUpdate event; 76 events::ChromeUpdate event;
86 event.event_type = EVENT_CHROME_UPDATE; 77 event.event_type = EVENT_CHROME_UPDATE;
87 event.time = static_cast<double>(time.ToInternalValue()); 78 event.time = static_cast<double>(time.ToInternalValue());
88 event.previous_version = previous_version; 79 event.previous_version = previous_version;
89 event.current_version = current_version; 80 event.current_version = current_version;
90 scoped_ptr<base::DictionaryValue> value = event.ToValue(); 81 scoped_ptr<base::DictionaryValue> value = event.ToValue();
91 return scoped_ptr<Event>(new Event( 82 return scoped_ptr<Event>(new Event(
92 EVENT_CHROME_UPDATE, time, value.Pass())); 83 EVENT_CHROME_UPDATE, time, value.Pass()));
93 } 84 }
94 85
95 } // namespace util 86 } // namespace util
96 } // namespace performance_monitor 87 } // namespace performance_monitor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698