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

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

Issue 2904603003: [IndexedDB] Adding txn, value, and key size metrics (Closed)
Patch Set: 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/database_impl.h" 5 #include "content/browser/indexed_db/database_impl.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
10 #include "base/threading/thread_checker.h" 10 #include "base/threading/thread_checker.h"
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 scoped_refptr<IndexedDBCallbacks> callbacks) { 654 scoped_refptr<IndexedDBCallbacks> callbacks) {
655 DCHECK(idb_thread_checker_.CalledOnValidThread()); 655 DCHECK(idb_thread_checker_.CalledOnValidThread());
656 if (!connection_->IsConnected()) 656 if (!connection_->IsConnected())
657 return; 657 return;
658 658
659 IndexedDBTransaction* transaction = 659 IndexedDBTransaction* transaction =
660 connection_->GetTransaction(transaction_id); 660 connection_->GetTransaction(transaction_id);
661 if (!transaction) 661 if (!transaction)
662 return; 662 return;
663 663
664 uint64_t commit_size = mojo_value->bits.size(); 664 // Value size recorded in IDBObjectStore before we can auto-wrap in a blob.
665 UMA_HISTOGRAM_MEMORY_KB("WebCore.IndexedDB.PutKeySize", key.size_estimate());
666
667 uint64_t commit_size = mojo_value->bits.size() + key.size_estimate();
665 IndexedDBValue value; 668 IndexedDBValue value;
666 swap(value.bits, mojo_value->bits); 669 swap(value.bits, mojo_value->bits);
667 swap(value.blob_info, blob_info); 670 swap(value.blob_info, blob_info);
668 connection_->database()->Put(transaction, object_store_id, &value, &handles, 671 connection_->database()->Put(transaction, object_store_id, &value, &handles,
669 base::MakeUnique<IndexedDBKey>(key), mode, 672 base::MakeUnique<IndexedDBKey>(key), mode,
670 std::move(callbacks), index_keys); 673 std::move(callbacks), index_keys);
671 674
672 // Size can't be big enough to overflow because it represents the 675 // Size can't be big enough to overflow because it represents the
673 // actual bytes passed through IPC. 676 // actual bytes passed through IPC.
674 transaction->set_size(transaction->size() + commit_size); 677 transaction->set_size(transaction->size() + commit_size);
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 usage + transaction->size() <= quota) { 919 usage + transaction->size() <= quota) {
917 connection_->database()->Commit(transaction); 920 connection_->database()->Commit(transaction);
918 } else { 921 } else {
919 connection_->AbortTransaction( 922 connection_->AbortTransaction(
920 transaction, 923 transaction,
921 IndexedDBDatabaseError(blink::kWebIDBDatabaseExceptionQuotaError)); 924 IndexedDBDatabaseError(blink::kWebIDBDatabaseExceptionQuotaError));
922 } 925 }
923 } 926 }
924 927
925 } // namespace content 928 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698