Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Side by Side Diff: content/browser/indexed_db/indexed_db_transaction.cc

Issue 2904603003: [IndexedDB] Adding txn, value, and key size metrics (Closed)
Patch Set: added histograms, fixed kb Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/indexed_db/indexed_db_transaction.h" 5 #include "content/browser/indexed_db/indexed_db_transaction.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/metrics/histogram_macros.h"
11 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
12 #include "base/stl_util.h" 13 #include "base/stl_util.h"
13 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
14 #include "base/threading/thread_task_runner_handle.h" 15 #include "base/threading/thread_task_runner_handle.h"
15 #include "content/browser/indexed_db/indexed_db_backing_store.h" 16 #include "content/browser/indexed_db/indexed_db_backing_store.h"
16 #include "content/browser/indexed_db/indexed_db_cursor.h" 17 #include "content/browser/indexed_db/indexed_db_cursor.h"
17 #include "content/browser/indexed_db/indexed_db_database.h" 18 #include "content/browser/indexed_db/indexed_db_database.h"
18 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" 19 #include "content/browser/indexed_db/indexed_db_database_callbacks.h"
19 #include "content/browser/indexed_db/indexed_db_tracing.h" 20 #include "content/browser/indexed_db/indexed_db_tracing.h"
20 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" 21 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 335
335 DCHECK_EQ(state_, COMMITTING); 336 DCHECK_EQ(state_, COMMITTING);
336 337
337 state_ = FINISHED; 338 state_ = FINISHED;
338 339
339 leveldb::Status s; 340 leveldb::Status s;
340 bool committed; 341 bool committed;
341 if (!used_) { 342 if (!used_) {
342 committed = true; 343 committed = true;
343 } else { 344 } else {
345 const char* time_uma_name = nullptr;
346 const char* size_uma_name = nullptr;
347 switch (mode_) {
348 case blink::kWebIDBTransactionModeReadOnly:
349 time_uma_name = "WebCore.IndexedDB.Transaction.ReadOnly.TimeActive";
350 size_uma_name = "WebCore.IndexedDB.Transaction.ReadOnly.SizeOnCommit";
351 break;
352 case blink::kWebIDBTransactionModeReadWrite:
353 time_uma_name = "WebCore.IndexedDB.Transaction.ReadWrite.TimeActive";
354 size_uma_name = "WebCore.IndexedDB.Transaction.ReadWrite.SizeOnCommit";
355 break;
356 case blink::kWebIDBTransactionModeVersionChange:
357 time_uma_name =
358 "WebCore.IndexedDB.Transaction.VersionChange.TimeActive";
359 size_uma_name =
360 "WebCore.IndexedDB.Transaction.VersionChange.SizeOnCommit";
361 break;
362 default:
363 NOTREACHED();
364 }
365 UMA_HISTOGRAM_MEDIUM_TIMES(time_uma_name,
Mark P 2017/05/24 18:57:38 I don't think these macros will work. Have you te
dmurph 2017/05/24 19:25:59 Yep, fixed.
366 base::Time::Now() - diagnostics_.start_time);
367 UMA_HISTOGRAM_MEMORY_KB(
368 size_uma_name,
369 transaction_->transaction()->GetTransactionSize() / 1024);
370
344 s = transaction_->CommitPhaseTwo(); 371 s = transaction_->CommitPhaseTwo();
345 committed = s.ok(); 372 committed = s.ok();
346 } 373 }
347 374
348 // Backing store resources (held via cursors) must be released 375 // Backing store resources (held via cursors) must be released
349 // before script callbacks are fired, as the script callbacks may 376 // before script callbacks are fired, as the script callbacks may
350 // release references and allow the backing store itself to be 377 // release references and allow the backing store itself to be
351 // released, and order is critical. 378 // released, and order is critical.
352 CloseOpenCursors(); 379 CloseOpenCursors();
353 transaction_->Reset(); 380 transaction_->Reset();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 547
521 ::indexed_db::mojom::ObserverChangesPtr* 548 ::indexed_db::mojom::ObserverChangesPtr*
522 IndexedDBTransaction::GetPendingChangesForConnection(int32_t connection_id) { 549 IndexedDBTransaction::GetPendingChangesForConnection(int32_t connection_id) {
523 auto it = connection_changes_map_.find(connection_id); 550 auto it = connection_changes_map_.find(connection_id);
524 if (it != connection_changes_map_.end()) 551 if (it != connection_changes_map_.end())
525 return &it->second; 552 return &it->second;
526 return nullptr; 553 return nullptr;
527 } 554 }
528 555
529 } // namespace content 556 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698