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..da8722efaf552737818f481a42c437d7f7d8ba67 100644 |
--- a/chrome/browser/performance_monitor/database.cc |
+++ b/chrome/browser/performance_monitor/database.cc |
@@ -11,6 +11,7 @@ |
#include "base/json/json_writer.h" |
#include "base/logging.h" |
#include "base/path_service.h" |
+#include "base/stl_util.h" |
#include "base/string_number_conversions.h" |
#include "base/string_split.h" |
#include "base/stringprintf.h" |
@@ -379,6 +380,23 @@ 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 (!ContainsKey(recent_map_, recent_map_key)) |
+ return false; |
+ std::string recent_key = recent_map_[recent_map_key]; |
+ |
+ std::string result; |
+ leveldb::Status status = recent_db_->Get(read_options_, recent_key, &result); |
+ if (status.ok()) |
+ *info = MetricInfo(SplitRecentKey(recent_key).time, result); |
+ return status.ok(); |
+} |
+ |
Database::MetricInfoVector Database::GetStatsForActivityAndMetric( |
const std::string& activity, MetricType metric_type, |
const base::Time& start, const base::Time& end) { |