Index: content/browser/indexed_db/indexed_db_callbacks.cc |
diff --git a/content/browser/indexed_db/indexed_db_callbacks.cc b/content/browser/indexed_db/indexed_db_callbacks.cc |
index cee89b1fb75b9875062a21a3646913e424f57b2a..23d561c9f3f376c4dc0e6906706acb327ff3e5a3 100644 |
--- a/content/browser/indexed_db/indexed_db_callbacks.cc |
+++ b/content/browser/indexed_db/indexed_db_callbacks.cc |
@@ -7,6 +7,7 @@ |
#include <algorithm> |
#include "base/guid.h" |
+#include "base/metrics/histogram.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/time/time.h" |
#include "content/browser/child_process_security_policy_impl.h" |
@@ -91,6 +92,12 @@ void IndexedDBCallbacks::OnError(const IndexedDBDatabaseError& error) { |
dispatcher_host_->Send(new IndexedDBMsg_CallbacksError( |
ipc_thread_id_, ipc_callbacks_id_, error.code(), error.message())); |
dispatcher_host_ = NULL; |
+ |
+ if (!conn_open_start_time_.is_null()) { |
+ UMA_HISTOGRAM_MEDIUM_TIMES("WebCore.IndexedDB.OpenTime.Error", |
+ base::TimeTicks::Now() - conn_open_start_time_); |
+ conn_open_start_time_ = base::TimeTicks(); |
+ } |
} |
void IndexedDBCallbacks::OnSuccess(const std::vector<base::string16>& value) { |
@@ -126,6 +133,12 @@ void IndexedDBCallbacks::OnBlocked(int64 existing_version) { |
sent_blocked_ = true; |
dispatcher_host_->Send(new IndexedDBMsg_CallbacksIntBlocked( |
ipc_thread_id_, ipc_callbacks_id_, existing_version)); |
+ |
+ if (!conn_open_start_time_.is_null()) { |
+ UMA_HISTOGRAM_MEDIUM_TIMES("WebCore.IndexedDB.OpenTime.Blocked", |
+ base::TimeTicks::Now() - conn_open_start_time_); |
+ conn_open_start_time_ = base::TimeTicks(); |
+ } |
} |
void IndexedDBCallbacks::OnDataLoss(blink::WebIDBDataLoss data_loss, |
@@ -162,6 +175,12 @@ void IndexedDBCallbacks::OnUpgradeNeeded( |
params.data_loss = data_loss_; |
params.data_loss_message = data_loss_message_; |
dispatcher_host_->Send(new IndexedDBMsg_CallbacksUpgradeNeeded(params)); |
+ |
+ if (!conn_open_start_time_.is_null()) { |
+ UMA_HISTOGRAM_MEDIUM_TIMES("WebCore.IndexedDB.OpenTime.UpgradeNeeded", |
+ base::TimeTicks::Now() - conn_open_start_time_); |
+ conn_open_start_time_ = base::TimeTicks(); |
+ } |
} |
void IndexedDBCallbacks::OnSuccess(scoped_ptr<IndexedDBConnection> connection, |
@@ -189,6 +208,12 @@ void IndexedDBCallbacks::OnSuccess(scoped_ptr<IndexedDBConnection> connection, |
ipc_object_id, |
IndexedDBDispatcherHost::ConvertMetadata(metadata))); |
dispatcher_host_ = NULL; |
+ |
+ if (!conn_open_start_time_.is_null()) { |
+ UMA_HISTOGRAM_MEDIUM_TIMES("WebCore.IndexedDB.OpenTime.Success", |
+ base::TimeTicks::Now() - conn_open_start_time_); |
+ conn_open_start_time_ = base::TimeTicks(); |
+ } |
} |
static std::string CreateBlobData( |
@@ -579,4 +604,9 @@ void IndexedDBCallbacks::OnSuccess() { |
dispatcher_host_ = NULL; |
} |
+void IndexedDBCallbacks::SetConnectionOpenStartTime( |
+ const base::TimeTicks& start_time) { |
+ conn_open_start_time_ = start_time; |
+} |
+ |
} // namespace content |