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

Side by Side Diff: net/disk_cache/simple/simple_entry_impl.cc

Issue 2853263002: SimpleCache: histogram queuing delays and I/O portion of more ops. (Closed)
Patch Set: Add a couple more sync metrics. 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
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_synchronous_entry.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/disk_cache/simple/simple_entry_impl.h" 5 #include "net/disk_cache/simple/simple_entry_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 710
711 DCHECK_EQ(STATE_UNINITIALIZED, state_); 711 DCHECK_EQ(STATE_UNINITIALIZED, state_);
712 DCHECK(!synchronous_entry_); 712 DCHECK(!synchronous_entry_);
713 state_ = STATE_IO_PENDING; 713 state_ = STATE_IO_PENDING;
714 const base::TimeTicks start_time = base::TimeTicks::Now(); 714 const base::TimeTicks start_time = base::TimeTicks::Now();
715 std::unique_ptr<SimpleEntryCreationResults> results( 715 std::unique_ptr<SimpleEntryCreationResults> results(
716 new SimpleEntryCreationResults(SimpleEntryStat( 716 new SimpleEntryCreationResults(SimpleEntryStat(
717 last_used_, last_modified_, data_size_, sparse_data_size_))); 717 last_used_, last_modified_, data_size_, sparse_data_size_)));
718 Closure task = 718 Closure task =
719 base::Bind(&SimpleSynchronousEntry::OpenEntry, cache_type_, path_, key_, 719 base::Bind(&SimpleSynchronousEntry::OpenEntry, cache_type_, path_, key_,
720 entry_hash_, have_index, results.get()); 720 entry_hash_, have_index, start_time, results.get());
721 Closure reply = 721 Closure reply =
722 base::Bind(&SimpleEntryImpl::CreationOperationComplete, this, callback, 722 base::Bind(&SimpleEntryImpl::CreationOperationComplete, this, callback,
723 start_time, base::Passed(&results), out_entry, 723 start_time, base::Passed(&results), out_entry,
724 net::NetLogEventType::SIMPLE_CACHE_ENTRY_OPEN_END); 724 net::NetLogEventType::SIMPLE_CACHE_ENTRY_OPEN_END);
725 worker_pool_->PostTaskAndReply(FROM_HERE, task, reply); 725 worker_pool_->PostTaskAndReply(FROM_HERE, task, reply);
726 } 726 }
727 727
728 void SimpleEntryImpl::CreateEntryInternal(bool have_index, 728 void SimpleEntryImpl::CreateEntryInternal(bool have_index,
729 const CompletionCallback& callback, 729 const CompletionCallback& callback,
730 Entry** out_entry) { 730 Entry** out_entry) {
(...skipping 19 matching lines...) Expand all
750 last_used_ = last_modified_ = base::Time::Now(); 750 last_used_ = last_modified_ = base::Time::Now();
751 751
752 // If creation succeeds, we should mark all streams to be saved on close. 752 // If creation succeeds, we should mark all streams to be saved on close.
753 for (int i = 0; i < kSimpleEntryStreamCount; ++i) 753 for (int i = 0; i < kSimpleEntryStreamCount; ++i)
754 have_written_[i] = true; 754 have_written_[i] = true;
755 755
756 const base::TimeTicks start_time = base::TimeTicks::Now(); 756 const base::TimeTicks start_time = base::TimeTicks::Now();
757 std::unique_ptr<SimpleEntryCreationResults> results( 757 std::unique_ptr<SimpleEntryCreationResults> results(
758 new SimpleEntryCreationResults(SimpleEntryStat( 758 new SimpleEntryCreationResults(SimpleEntryStat(
759 last_used_, last_modified_, data_size_, sparse_data_size_))); 759 last_used_, last_modified_, data_size_, sparse_data_size_)));
760 Closure task = base::Bind(&SimpleSynchronousEntry::CreateEntry, 760 Closure task =
761 cache_type_, 761 base::Bind(&SimpleSynchronousEntry::CreateEntry, cache_type_, path_, key_,
762 path_, 762 entry_hash_, have_index, start_time, results.get());
763 key_,
764 entry_hash_,
765 have_index,
766 results.get());
767 Closure reply = 763 Closure reply =
768 base::Bind(&SimpleEntryImpl::CreationOperationComplete, this, callback, 764 base::Bind(&SimpleEntryImpl::CreationOperationComplete, this, callback,
769 start_time, base::Passed(&results), out_entry, 765 start_time, base::Passed(&results), out_entry,
770 net::NetLogEventType::SIMPLE_CACHE_ENTRY_CREATE_END); 766 net::NetLogEventType::SIMPLE_CACHE_ENTRY_CREATE_END);
771 worker_pool_->PostTaskAndReply(FROM_HERE, task, reply); 767 worker_pool_->PostTaskAndReply(FROM_HERE, task, reply);
772 } 768 }
773 769
774 void SimpleEntryImpl::CloseInternal() { 770 void SimpleEntryImpl::CloseInternal() {
775 DCHECK(io_thread_checker_.CalledOnValidThread()); 771 DCHECK(io_thread_checker_.CalledOnValidThread());
776 typedef SimpleSynchronousEntry::CRCRecord CRCRecord; 772 typedef SimpleSynchronousEntry::CRCRecord CRCRecord;
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 } 1560 }
1565 crc32s_end_offset_[stream_index] = offset + length; 1561 crc32s_end_offset_[stream_index] = offset + length;
1566 } else if (offset < crc32s_end_offset_[stream_index]) { 1562 } else if (offset < crc32s_end_offset_[stream_index]) {
1567 // If a range for which the crc32 was already computed is rewritten, the 1563 // If a range for which the crc32 was already computed is rewritten, the
1568 // computation of the crc32 need to start from 0 again. 1564 // computation of the crc32 need to start from 0 again.
1569 crc32s_end_offset_[stream_index] = 0; 1565 crc32s_end_offset_[stream_index] = 0;
1570 } 1566 }
1571 } 1567 }
1572 1568
1573 } // namespace disk_cache 1569 } // namespace disk_cache
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_synchronous_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698