| 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 PostTaskToDatabaseAndReply(const base::Closure& request, | 56 bool PostTaskToDatabaseThreadAndReply(const base::Closure& request, |
| 57 const base::Closure& reply) { | 57 const base::Closure& reply) { |
| 58 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); | 58 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); |
| 59 base::SequencedWorkerPool::SequenceToken token = | 59 base::SequencedWorkerPool::SequenceToken token = |
| 60 pool->GetNamedSequenceToken(Database::kDatabaseSequenceToken); | 60 pool->GetNamedSequenceToken(Database::kDatabaseSequenceToken); |
| 61 return pool->GetSequencedTaskRunner(token)->PostTaskAndReply( | 61 return pool->GetSequencedTaskRunner(token)->PostTaskAndReply( |
| 62 FROM_HERE, request, reply); | 62 FROM_HERE, request, reply); |
| 63 } | 63 } |
| 64 | 64 |
| 65 scoped_ptr<Event> CreateExtensionInstallEvent(const base::Time& time, | 65 scoped_ptr<Event> CreateExtensionInstallEvent(const base::Time& time, |
| 66 const std::string& id, | 66 const std::string& id, |
| 67 const std::string& name, | 67 const std::string& name, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 event.time = static_cast<double>(time.ToInternalValue()); | 211 event.time = static_cast<double>(time.ToInternalValue()); |
| 212 event.previous_version = previous_version; | 212 event.previous_version = previous_version; |
| 213 event.current_version = current_version; | 213 event.current_version = current_version; |
| 214 scoped_ptr<base::DictionaryValue> value = event.ToValue(); | 214 scoped_ptr<base::DictionaryValue> value = event.ToValue(); |
| 215 return scoped_ptr<Event>(new Event( | 215 return scoped_ptr<Event>(new Event( |
| 216 EVENT_CHROME_UPDATE, time, value.Pass())); | 216 EVENT_CHROME_UPDATE, time, value.Pass())); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace util | 219 } // namespace util |
| 220 } // namespace performance_monitor | 220 } // namespace performance_monitor |
| OLD | NEW |