Chromium Code Reviews| 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..cba537346434693f1af2ec5a8f12464f47dd1d7f 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" |
| @@ -36,6 +37,8 @@ const int32 kNoDatabaseCallbacks = -1; |
| const int64 kNoTransaction = -1; |
| } |
| +static const char* const kDatabaseOpenTime = "WebCore.IndexedDB.OpenTime"; |
|
Ilya Sherman
2014/08/14 22:37:49
nit: I'd include "histogram", and probably also "n
Ilya Sherman
2014/08/14 22:37:49
nit: "const char kDatabaseOpenTime[]" is slightly
|
| + |
| IndexedDBCallbacks::IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, |
| int32 ipc_thread_id, |
| int32 ipc_callbacks_id) |
| @@ -91,6 +94,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 (!db_open_start_time_.is_null()) { |
| + UMA_HISTOGRAM_MEDIUM_TIMES(kDatabaseOpenTime, |
| + base::TimeTicks::Now() - db_open_start_time_); |
| + db_open_start_time_ = base::TimeTicks(); |
| + } |
| } |
| void IndexedDBCallbacks::OnSuccess(const std::vector<base::string16>& value) { |
| @@ -126,6 +135,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 (!db_open_start_time_.is_null()) { |
| + UMA_HISTOGRAM_MEDIUM_TIMES(kDatabaseOpenTime, |
| + base::TimeTicks::Now() - db_open_start_time_); |
| + db_open_start_time_ = base::TimeTicks(); |
| + } |
| } |
| void IndexedDBCallbacks::OnDataLoss(blink::WebIDBDataLoss data_loss, |
| @@ -162,6 +177,12 @@ void IndexedDBCallbacks::OnUpgradeNeeded( |
| params.data_loss = data_loss_; |
| params.data_loss_message = data_loss_message_; |
| dispatcher_host_->Send(new IndexedDBMsg_CallbacksUpgradeNeeded(params)); |
| + |
| + if (!db_open_start_time_.is_null()) { |
| + UMA_HISTOGRAM_MEDIUM_TIMES(kDatabaseOpenTime, |
| + base::TimeTicks::Now() - db_open_start_time_); |
| + db_open_start_time_ = base::TimeTicks(); |
| + } |
| } |
| void IndexedDBCallbacks::OnSuccess(scoped_ptr<IndexedDBConnection> connection, |
| @@ -189,6 +210,12 @@ void IndexedDBCallbacks::OnSuccess(scoped_ptr<IndexedDBConnection> connection, |
| ipc_object_id, |
| IndexedDBDispatcherHost::ConvertMetadata(metadata))); |
| dispatcher_host_ = NULL; |
| + |
| + if (!db_open_start_time_.is_null()) { |
| + UMA_HISTOGRAM_MEDIUM_TIMES(kDatabaseOpenTime, |
| + base::TimeTicks::Now() - db_open_start_time_); |
| + db_open_start_time_ = base::TimeTicks(); |
| + } |
| } |
| static std::string CreateBlobData( |
| @@ -579,4 +606,9 @@ void IndexedDBCallbacks::OnSuccess() { |
| dispatcher_host_ = NULL; |
| } |
| +void IndexedDBCallbacks::SetDatbaseOpenStartTime( |
|
jsbell
2014/08/14 22:58:05
Typo (but at least it compiles!)
|
| + const base::TimeTicks& start_time) { |
| + db_open_start_time_ = start_time; |
| +} |
| + |
| } // namespace content |