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

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: made sure size is 0'd out Created 3 years, 6 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"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 374
375 DCHECK_EQ(state_, COMMITTING); 375 DCHECK_EQ(state_, COMMITTING);
376 376
377 state_ = FINISHED; 377 state_ = FINISHED;
378 378
379 leveldb::Status s; 379 leveldb::Status s;
380 bool committed; 380 bool committed;
381 if (!used_) { 381 if (!used_) {
382 committed = true; 382 committed = true;
383 } else { 383 } else {
384 base::TimeDelta active_time = base::Time::Now() - diagnostics_.start_time;
385 uint64_t size = transaction_->GetTransactionSize() / 1024;
386 switch (mode_) {
387 case blink::kWebIDBTransactionModeReadOnly:
388 UMA_HISTOGRAM_MEDIUM_TIMES(
389 "WebCore.IndexedDB.Transaction.ReadOnly.TimeActive", active_time);
390 UMA_HISTOGRAM_MEMORY_KB(
391 "WebCore.IndexedDB.Transaction.ReadOnly.SizeOnCommit", size);
392 break;
393 case blink::kWebIDBTransactionModeReadWrite:
394 UMA_HISTOGRAM_MEDIUM_TIMES(
395 "WebCore.IndexedDB.Transaction.ReadWrite.TimeActive", active_time);
396 UMA_HISTOGRAM_MEMORY_KB(
397 "WebCore.IndexedDB.Transaction.ReadWrite.SizeOnCommit", size);
398 break;
399 case blink::kWebIDBTransactionModeVersionChange:
400 UMA_HISTOGRAM_MEDIUM_TIMES(
401 "WebCore.IndexedDB.Transaction.VersionChange.TimeActive",
402 active_time);
403 UMA_HISTOGRAM_MEMORY_KB(
404 "WebCore.IndexedDB.Transaction.VersionChange.SizeOnCommit", size);
405 break;
406 default:
407 NOTREACHED();
408 }
409
384 s = transaction_->CommitPhaseTwo(); 410 s = transaction_->CommitPhaseTwo();
385 committed = s.ok(); 411 committed = s.ok();
386 } 412 }
387 413
388 // Backing store resources (held via cursors) must be released 414 // Backing store resources (held via cursors) must be released
389 // before script callbacks are fired, as the script callbacks may 415 // before script callbacks are fired, as the script callbacks may
390 // release references and allow the backing store itself to be 416 // release references and allow the backing store itself to be
391 // released, and order is critical. 417 // released, and order is critical.
392 CloseOpenCursors(); 418 CloseOpenCursors();
393 transaction_->Reset(); 419 transaction_->Reset();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 586
561 ::indexed_db::mojom::ObserverChangesPtr* 587 ::indexed_db::mojom::ObserverChangesPtr*
562 IndexedDBTransaction::GetPendingChangesForConnection(int32_t connection_id) { 588 IndexedDBTransaction::GetPendingChangesForConnection(int32_t connection_id) {
563 auto it = connection_changes_map_.find(connection_id); 589 auto it = connection_changes_map_.find(connection_id);
564 if (it != connection_changes_map_.end()) 590 if (it != connection_changes_map_.end())
565 return &it->second; 591 return &it->second;
566 return nullptr; 592 return nullptr;
567 } 593 }
568 594
569 } // namespace content 595 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_fake_backing_store.cc ('k') | content/browser/indexed_db/leveldb/leveldb_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698