Index: chrome/browser/performance_monitor/database.cc |
diff --git a/chrome/browser/performance_monitor/database.cc b/chrome/browser/performance_monitor/database.cc |
index 8eb135080a00cedf9b51c82893712d7fc4520b0b..8cb2dbf4a2cdcce47d99d9282e8cae10c8039fb2 100644 |
--- a/chrome/browser/performance_monitor/database.cc |
+++ b/chrome/browser/performance_monitor/database.cc |
@@ -379,6 +379,29 @@ std::vector<std::string> Database::GetActiveActivities( |
return results; |
} |
+bool Database::GetRecentStatsForActivityAndMetric( |
+ const std::string& activity, |
+ MetricType metric, |
+ MetricInfo* info) { |
+ CHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
+ std::string recent_map_key = CreateRecentMapKey(metric, activity); |
+ if (!recent_map_.count(recent_map_key)) |
+ return false; |
+ std::string recent_start_key = recent_map_[recent_map_key]; |
eaugusti
2012/07/31 18:46:06
Not really a "start" key, just a key.
chebert
2012/07/31 19:26:36
Done.
|
+ |
+ scoped_ptr<leveldb::Iterator> it(recent_db_->NewIterator(read_options_)); |
eaugusti
2012/07/31 18:46:06
Maybe use Get() instead of an iterator:
http://lev
chebert
2012/07/31 19:26:36
Done.
|
+ |
+ it->Seek(recent_start_key); |
+ if (it->Valid()) { |
+ RecentKey split_key = SplitRecentKey(it->key().ToString()); |
+ if (split_key.activity == activity) { |
+ *info = MetricInfo(split_key.time, it->value().ToString()); |
+ return true; |
+ } |
+ } |
+ return false; |
+} |
+ |
Database::MetricInfoVector Database::GetStatsForActivityAndMetric( |
const std::string& activity, MetricType metric_type, |
const base::Time& start, const base::Time& end) { |