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

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: 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"
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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 330
330 leveldb::Status IndexedDBTransaction::CommitPhaseTwo() { 331 leveldb::Status IndexedDBTransaction::CommitPhaseTwo() {
331 // Abort may have been called just as the blob write completed. 332 // Abort may have been called just as the blob write completed.
332 if (state_ == FINISHED) 333 if (state_ == FINISHED)
333 return leveldb::Status::OK(); 334 return leveldb::Status::OK();
334 335
335 DCHECK_EQ(state_, COMMITTING); 336 DCHECK_EQ(state_, COMMITTING);
336 337
337 state_ = FINISHED; 338 state_ = FINISHED;
338 339
340 UMA_HISTOGRAM_MEMORY_KB("WebCore.IndexedDB.Transaction.SizeOnCommit",
341 transaction_->transaction()->GetTransactionSize());
342
339 leveldb::Status s; 343 leveldb::Status s;
340 bool committed; 344 bool committed;
341 if (!used_) { 345 if (!used_) {
342 committed = true; 346 committed = true;
343 } else { 347 } else {
344 s = transaction_->CommitPhaseTwo(); 348 s = transaction_->CommitPhaseTwo();
345 committed = s.ok(); 349 committed = s.ok();
346 } 350 }
347 351
348 // Backing store resources (held via cursors) must be released 352 // Backing store resources (held via cursors) must be released
349 // before script callbacks are fired, as the script callbacks may 353 // before script callbacks are fired, as the script callbacks may
350 // release references and allow the backing store itself to be 354 // release references and allow the backing store itself to be
351 // released, and order is critical. 355 // released, and order is critical.
352 CloseOpenCursors(); 356 CloseOpenCursors();
357 UMA_HISTOGRAM_MEMORY_KB("WebCore.IndexedDB.TransactionSize",
pwnall 2017/05/23 23:01:09 Is this number different because of the blob journ
dmurph 2017/05/24 02:01:58 Had this wrong - put in right spot now, with comme
358 transaction_->transaction()->GetTransactionSize());
353 transaction_->Reset(); 359 transaction_->Reset();
354 360
355 // Transactions must also be marked as completed before the 361 // Transactions must also be marked as completed before the
356 // front-end is notified, as the transaction completion unblocks 362 // front-end is notified, as the transaction completion unblocks
357 // operations like closing connections. 363 // operations like closing connections.
358 database_->transaction_coordinator().DidFinishTransaction(this); 364 database_->transaction_coordinator().DidFinishTransaction(this);
359 365
360 if (committed) { 366 if (committed) {
361 abort_task_stack_.clear(); 367 abort_task_stack_.clear();
362 368
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 526
521 ::indexed_db::mojom::ObserverChangesPtr* 527 ::indexed_db::mojom::ObserverChangesPtr*
522 IndexedDBTransaction::GetPendingChangesForConnection(int32_t connection_id) { 528 IndexedDBTransaction::GetPendingChangesForConnection(int32_t connection_id) {
523 auto it = connection_changes_map_.find(connection_id); 529 auto it = connection_changes_map_.find(connection_id);
524 if (it != connection_changes_map_.end()) 530 if (it != connection_changes_map_.end())
525 return &it->second; 531 return &it->second;
526 return nullptr; 532 return nullptr;
527 } 533 }
528 534
529 } // namespace content 535 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698