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/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 // If the window splits an area of the step function, split the aggregation | 47 // If the window splits an area of the step function, split the aggregation |
48 // at the end of the window. | 48 // at the end of the window. |
49 integrated += metric_value * (window_end - last_sample_time).InSecondsF(); | 49 integrated += metric_value * (window_end - last_sample_time).InSecondsF(); |
50 double average = integrated / resolution.InSecondsF(); | 50 double average = integrated / resolution.InSecondsF(); |
51 results.push_back(MetricInfo(window_end, average)); | 51 results.push_back(MetricInfo(window_end, average)); |
52 } | 52 } |
53 return results; | 53 return results; |
54 } | 54 } |
55 | 55 |
56 bool PostTaskToDatabaseThreadAndReply(const base::Closure& request, | 56 bool PostTaskToDatabaseThreadAndReply( |
57 const base::Closure& reply) { | 57 const tracked_objects::Location& from_here, |
| 58 const base::Closure& request, |
| 59 const base::Closure& reply) { |
58 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); | 60 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); |
59 base::SequencedWorkerPool::SequenceToken token = | 61 base::SequencedWorkerPool::SequenceToken token = |
60 pool->GetNamedSequenceToken(Database::kDatabaseSequenceToken); | 62 pool->GetNamedSequenceToken(Database::kDatabaseSequenceToken); |
61 return pool->GetSequencedTaskRunner(token)->PostTaskAndReply( | 63 return pool->GetSequencedTaskRunner(token)->PostTaskAndReply( |
62 FROM_HERE, request, reply); | 64 from_here, request, reply); |
63 } | 65 } |
64 | 66 |
65 scoped_ptr<Event> CreateExtensionInstallEvent(const base::Time& time, | 67 scoped_ptr<Event> CreateExtensionInstallEvent(const base::Time& time, |
66 const std::string& id, | 68 const std::string& id, |
67 const std::string& name, | 69 const std::string& name, |
68 const std::string& url, | 70 const std::string& url, |
69 const int& location, | 71 const int& location, |
70 const std::string& version, | 72 const std::string& version, |
71 const std::string& description) { | 73 const std::string& description) { |
72 events::ExtensionInstall event; | 74 events::ExtensionInstall event; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 event.time = static_cast<double>(time.ToInternalValue()); | 211 event.time = static_cast<double>(time.ToInternalValue()); |
210 event.previous_version = previous_version; | 212 event.previous_version = previous_version; |
211 event.current_version = current_version; | 213 event.current_version = current_version; |
212 scoped_ptr<base::DictionaryValue> value = event.ToValue(); | 214 scoped_ptr<base::DictionaryValue> value = event.ToValue(); |
213 return scoped_ptr<Event>(new Event( | 215 return scoped_ptr<Event>(new Event( |
214 EVENT_CHROME_UPDATE, time, value.Pass())); | 216 EVENT_CHROME_UPDATE, time, value.Pass())); |
215 } | 217 } |
216 | 218 |
217 } // namespace util | 219 } // namespace util |
218 } // namespace performance_monitor | 220 } // namespace performance_monitor |
OLD | NEW |