Index: chrome/browser/performance_monitor/startup_timer.cc |
diff --git a/chrome/browser/performance_monitor/startup_timer.cc b/chrome/browser/performance_monitor/startup_timer.cc |
index 175ab6d49c922d7c67d95287bfe03161a1354c6b..226ea78ca9e35683da140d041e34db296fa0e2f1 100644 |
--- a/chrome/browser/performance_monitor/startup_timer.cc |
+++ b/chrome/browser/performance_monitor/startup_timer.cc |
@@ -110,12 +110,19 @@ void StartupTimer::SetElapsedSessionRestoreTime( |
} |
void StartupTimer::InsertElapsedStartupTime() { |
+ performance_monitor::Database* database = |
Yoyo Zhou
2013/10/03 22:08:50
You should be able to remove this now.
Finnur
2013/10/04 17:57:02
Indeed.
|
+ PerformanceMonitor::GetInstance()->database(); |
+ // TODO(finnur): This is temporary to work around bug 303719 where the |
+ // startup timer is taking requests to log without the performance monitor |
+ // having created a database to store it. |
+ if (!database) |
+ return; |
content::BrowserThread::PostBlockingPoolSequencedTask( |
Database::kDatabaseSequenceToken, |
FROM_HERE, |
base::Bind( |
&AddMetricToDatabaseOnBackgroundThread, |
- base::Unretained(PerformanceMonitor::GetInstance()->database()), |
+ base::Unretained(database), |
Metric(startup_type_ == STARTUP_NORMAL ? METRIC_STARTUP_TIME |
: METRIC_TEST_STARTUP_TIME, |
base::Time::Now(), |
@@ -127,12 +134,19 @@ void StartupTimer::InsertElapsedSessionRestoreTime() { |
for (std::vector<base::TimeDelta>::const_iterator iter = |
elapsed_session_restore_times_.begin(); |
iter != elapsed_session_restore_times_.end(); ++iter) { |
+ performance_monitor::Database* database = |
+ PerformanceMonitor::GetInstance()->database(); |
+ // TODO(finnur): This is temporary to work around bug 303719 where the |
+ // startup timer is taking requests to log without the performance monitor |
+ // having created a database to store it. |
+ if (!database) |
+ return; |
content::BrowserThread::PostBlockingPoolSequencedTask( |
Database::kDatabaseSequenceToken, |
FROM_HERE, |
base::Bind( |
&AddMetricToDatabaseOnBackgroundThread, |
- base::Unretained(PerformanceMonitor::GetInstance()->database()), |
+ base::Unretained(database), |
Metric(METRIC_SESSION_RESTORE_TIME, |
base::Time::Now(), |
static_cast<double>(iter->ToInternalValue())))); |