diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 00:39:04 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 00:39:04 +0000 |
commit | a6ec0897e904792a60a12a58b26dd2214dbcfa39 (patch) | |
tree | c0040197acf7510b074af818ef8335b832e22e25 | |
parent | 1b4209f4c56fbdb6fe72aca508e8aa1c534964d4 (diff) | |
download | chromium_src-a6ec0897e904792a60a12a58b26dd2214dbcfa39.zip chromium_src-a6ec0897e904792a60a12a58b26dd2214dbcfa39.tar.gz chromium_src-a6ec0897e904792a60a12a58b26dd2214dbcfa39.tar.bz2 |
Revert r70628. It broke Linux valgrind bots. See for example
http://build.chromium.org/p/chromium.memory/builders/Linux%20Tests%20%28valgrind%29%281%29/builds/963
First pass at adding http/backend cache events to the NetLog.
Adds sources and events for ActiveCacheEntry and EntryImpl
objects, as well as adding cache read/write events to
HttpCacheTransactions. Most new read/write events are
only logged when NetLog logging mode is set to log all events.
Also, net-internals now merges begin and end events that have
parameters, as long as only one of them has parameters.
I think this increases readability, at the cost of making
it a little more difficult to follow timings with just the "st"
values.
BUG=59382
TEST=none yet, other than updates to existing tests.
Originally applied: http://src.chromium.org/viewvc/chrome?view=rev&revision=70618
Reverted: http://src.chromium.org/viewvc/chrome?view=rev&revision=70619
Fixed and trying again...
Review URL: http://codereview.chromium.org/6125001
BUG=none
TEST=linux valgrind goes green.
Review URL: http://codereview.chromium.org/6142003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70688 0039d316-1c4b-4281-b951-d872f2087c98
40 files changed, 142 insertions, 619 deletions
diff --git a/chrome/browser/net/connection_tester.cc b/chrome/browser/net/connection_tester.cc index f23d619..18960eb 100644 --- a/chrome/browser/net/connection_tester.cc +++ b/chrome/browser/net/connection_tester.cc @@ -71,7 +71,6 @@ class ExperimentURLRequestContext : public URLRequestContext { dnsrr_resolver_, NULL /* dns_cert_checker */, NULL /* ssl_host_info_factory */, proxy_service_, ssl_config_service_, http_auth_handler_factory_, NULL, NULL), - NULL /* net_log */, net::HttpCache::DefaultBackend::InMemory(0)); // In-memory cookie store. cookie_store_ = new net::CookieMonster(NULL, NULL); diff --git a/chrome/browser/net/passive_log_collector.cc b/chrome/browser/net/passive_log_collector.cc index 21e2935..0d41479 100644 --- a/chrome/browser/net/passive_log_collector.cc +++ b/chrome/browser/net/passive_log_collector.cc @@ -70,7 +70,6 @@ PassiveLogCollector::PassiveLogCollector() trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_REQUEST] = &dns_request_tracker_; trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB] = &dns_job_tracker_; - trackers_[net::NetLog::SOURCE_DISK_CACHE_ENTRY] = &disk_cache_entry_tracker_; // Make sure our mapping is up-to-date. for (size_t i = 0; i < arraysize(trackers_); ++i) DCHECK(trackers_[i]) << "Unhandled SourceType: " << i; @@ -561,28 +560,3 @@ PassiveLogCollector::DNSJobTracker::DoAddEntry(const ChromeNetLog::Entry& entry, return ACTION_NONE; } } - -//---------------------------------------------------------------------------- -// DiskCacheEntryTracker -//---------------------------------------------------------------------------- - -const size_t PassiveLogCollector::DiskCacheEntryTracker::kMaxNumSources = 100; -const size_t PassiveLogCollector::DiskCacheEntryTracker::kMaxGraveyardSize = 25; - -PassiveLogCollector::DiskCacheEntryTracker::DiskCacheEntryTracker() - : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) { -} - -PassiveLogCollector::SourceTracker::Action -PassiveLogCollector::DiskCacheEntryTracker::DoAddEntry( - const ChromeNetLog::Entry& entry, SourceInfo* out_info) { - AddEntryToSourceInfo(entry, out_info); - - // If the request has ended, move it to the graveyard. - if (entry.type == net::NetLog::TYPE_DISK_CACHE_ENTRY && - entry.phase == net::NetLog::PHASE_END) { - return ACTION_MOVE_TO_GRAVEYARD; - } - - return ACTION_NONE; -} diff --git a/chrome/browser/net/passive_log_collector.h b/chrome/browser/net/passive_log_collector.h index a415d59..114e439 100644 --- a/chrome/browser/net/passive_log_collector.h +++ b/chrome/browser/net/passive_log_collector.h @@ -304,22 +304,6 @@ class PassiveLogCollector : public ChromeNetLog::ThreadSafeObserver { DISALLOW_COPY_AND_ASSIGN(DNSJobTracker); }; - // Tracks the log entries for the last seen SOURCE_DISK_CACHE_ENTRY. - class DiskCacheEntryTracker : public SourceTracker { - public: - static const size_t kMaxNumSources; - static const size_t kMaxGraveyardSize; - - DiskCacheEntryTracker(); - - protected: - virtual Action DoAddEntry(const ChromeNetLog::Entry& entry, - SourceInfo* out_info); - - private: - DISALLOW_COPY_AND_ASSIGN(DiskCacheEntryTracker); - }; - PassiveLogCollector(); ~PassiveLogCollector(); @@ -356,7 +340,6 @@ class PassiveLogCollector : public ChromeNetLog::ThreadSafeObserver { SpdySessionTracker spdy_session_tracker_; DNSRequestTracker dns_request_tracker_; DNSJobTracker dns_job_tracker_; - DiskCacheEntryTracker disk_cache_entry_tracker_; // This array maps each NetLog::SourceType to one of the tracker instances // defined above. Use of this array avoid duplicating the list of trackers diff --git a/chrome/browser/resources/net_internals/logviewpainter.js b/chrome/browser/resources/net_internals/logviewpainter.js index 28df383..82686c6 100644 --- a/chrome/browser/resources/net_internals/logviewpainter.js +++ b/chrome/browser/resources/net_internals/logviewpainter.js @@ -49,9 +49,10 @@ function addSourceEntry_(node, sourceEntry) { function canCollapseBeginWithEnd(beginEntry) { return beginEntry && beginEntry.isBegin() && + !beginEntry.orig.params && beginEntry.end && beginEntry.end.index == beginEntry.index + 1 && - (!beginEntry.orig.params || !beginEntry.end.orig.params) && + !beginEntry.end.orig.params && beginEntry.orig.wasPassivelyCaptured == beginEntry.end.orig.wasPassivelyCaptured; } @@ -69,43 +70,43 @@ PrintSourceEntriesAsText = function(sourceEntries, doSecurityStripping) { for (var i = 0; i < entries.length; ++i) { var entry = entries[i]; - // Avoid printing the END for a BEGIN that was immediately before, unless - // both have extra parameters. - if (!entry.isEnd() || !canCollapseBeginWithEnd(entry.begin)) { - tablePrinter.addRow(); - - // Annotate this entry with "(P)" if it was passively captured. - tablePrinter.addCell(entry.orig.wasPassivelyCaptured ? '(P) ' : ''); - - tablePrinter.addCell('t='); - var date = g_browser.convertTimeTicksToDate(entry.orig.time) ; - var tCell = tablePrinter.addCell(date.getTime()); - tCell.alignRight = true; - tablePrinter.addCell(' [st='); - var stCell = tablePrinter.addCell(date.getTime() - startTime); - stCell.alignRight = true; - tablePrinter.addCell('] '); - - var indentationStr = makeRepeatedString(' ', entry.getDepth() * 3); - var mainCell = - tablePrinter.addCell(indentationStr + getTextForEvent(entry)); - tablePrinter.addCell(' '); - - // Get the elapsed time. - if (entry.isBegin()) { - tablePrinter.addCell('[dt='); - var dt = '?'; - // Definite time. - if (entry.end) { - dt = entry.end.orig.time - entry.orig.time; - } - var dtCell = tablePrinter.addCell(dt); - dtCell.alignRight = true; - - tablePrinter.addCell(']'); - } else { - mainCell.allowOverflow = true; + // Avoid printing the END for a BEGIN that was immediately before. + if (entry.isEnd() && canCollapseBeginWithEnd(entry.begin)) + continue; + + tablePrinter.addRow(); + + // Annotate this entry with "(P)" if it was passively captured. + tablePrinter.addCell(entry.orig.wasPassivelyCaptured ? '(P) ' : ''); + + tablePrinter.addCell('t='); + var date = g_browser.convertTimeTicksToDate(entry.orig.time) ; + var tCell = tablePrinter.addCell(date.getTime()); + tCell.alignRight = true; + tablePrinter.addCell(' [st='); + var stCell = tablePrinter.addCell(date.getTime() - startTime); + stCell.alignRight = true; + tablePrinter.addCell('] '); + + var indentationStr = makeRepeatedString(' ', entry.getDepth() * 3); + var mainCell = + tablePrinter.addCell(indentationStr + getTextForEvent(entry)); + tablePrinter.addCell(' '); + + // Get the elapsed time. + if (entry.isBegin()) { + tablePrinter.addCell('[dt='); + var dt = '?'; + // Definite time. + if (entry.end) { + dt = entry.end.orig.time - entry.orig.time; } + var dtCell = tablePrinter.addCell(dt); + dtCell.alignRight = true; + + tablePrinter.addCell(']'); + } else { + mainCell.allowOverflow = true; } // Output the extra parameters. diff --git a/chrome/browser/resources/net_internals/main.css b/chrome/browser/resources/net_internals/main.css index 8c6982c..be3abee 100644 --- a/chrome/browser/resources/net_internals/main.css +++ b/chrome/browser/resources/net_internals/main.css @@ -92,10 +92,6 @@ body { color: #308080; } -#eventsListTableBody .source_DISK_CACHE_ENTRY { - color: gray; -} - #eventsListTableBody .source_SOCKET { color: purple; } diff --git a/chrome/browser/resources/net_internals/sourceentry.js b/chrome/browser/resources/net_internals/sourceentry.js index 6c02c03..4a4df6e 100644 --- a/chrome/browser/resources/net_internals/sourceentry.js +++ b/chrome/browser/resources/net_internals/sourceentry.js @@ -232,9 +232,6 @@ SourceEntry.prototype.getDescription = function() { case LogSourceType.HOST_RESOLVER_IMPL_JOB: description = e.params.host; break; - case LogSourceType.DISK_CACHE_ENTRY: - description = e.params.key; - break; case LogSourceType.SPDY_SESSION: if (e.params.host) description = e.params.host + ' (' + e.params.proxy + ')'; diff --git a/chrome/service/net/service_url_request_context.cc b/chrome/service/net/service_url_request_context.cc index 46d3b7c..7f589e0 100644 --- a/chrome/service/net/service_url_request_context.cc +++ b/chrome/service/net/service_url_request_context.cc @@ -135,7 +135,6 @@ ServiceURLRequestContext::ServiceURLRequestContext( http_auth_handler_factory_, NULL /* network_delegate */, NULL /* net_log */), - NULL /* net_log */, net::HttpCache::DefaultBackend::InMemory(0)); // In-memory cookie store. cookie_store_ = new net::CookieMonster(NULL, NULL); diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp index 177ad5f..9aa885f 100644 --- a/chrome/test/plugin/plugin_test.cpp +++ b/chrome/test/plugin/plugin_test.cpp @@ -303,7 +303,6 @@ class PluginInstallerDownloadTest http_auth_handler_factory_, network_delegate_, NULL), - NULL /* net_log */, net::HttpCache::DefaultBackend::InMemory(0)); } diff --git a/chrome_frame/metrics_service.cc b/chrome_frame/metrics_service.cc index e94b069..3311853 100644 --- a/chrome_frame/metrics_service.cc +++ b/chrome_frame/metrics_service.cc @@ -190,7 +190,6 @@ class ChromeFrameUploadRequestContext : public URLRequestContext { http_auth_handler_factory_, network_delegate_, NULL), - NULL /* net_log */, net::HttpCache::DefaultBackend::InMemory(0)); } diff --git a/chrome_frame/test/test_server_test.cc b/chrome_frame/test/test_server_test.cc index 9040e22..0bb9ba2 100644 --- a/chrome_frame/test/test_server_test.cc +++ b/chrome_frame/test/test_server_test.cc @@ -81,7 +81,6 @@ class URLRequestTestContext : public URLRequestContext { http_auth_handler_factory_, NULL /* network_delegate */, NULL /* net_log */), - NULL /* net_log */, net::HttpCache::DefaultBackend::InMemory(0)); // In-memory cookie store. cookie_store_ = new net::CookieMonster(NULL, NULL); diff --git a/net/base/capturing_net_log.cc b/net/base/capturing_net_log.cc index c6d34240..fccd5ae 100644 --- a/net/base/capturing_net_log.cc +++ b/net/base/capturing_net_log.cc @@ -18,9 +18,7 @@ CapturingNetLog::Entry::Entry(EventType type, CapturingNetLog::Entry::~Entry() {} CapturingNetLog::CapturingNetLog(size_t max_num_entries) - : last_id_(-1), - max_num_entries_(max_num_entries), - log_level_(LOG_ALL_BUT_BYTES) { + : last_id_(-1), max_num_entries_(max_num_entries) { } CapturingNetLog::~CapturingNetLog() {} @@ -41,8 +39,7 @@ uint32 CapturingNetLog::NextID() { } NetLog::LogLevel CapturingNetLog::GetLogLevel() const { - AutoLock lock(lock_); - return log_level_; + return LOG_ALL_BUT_BYTES; } void CapturingNetLog::GetEntries(EntryList* entry_list) const { @@ -55,11 +52,6 @@ void CapturingNetLog::Clear() { entries_.clear(); } -void CapturingNetLog::SetLogLevel(NetLog::LogLevel log_level) { - AutoLock lock(lock_); - log_level_ = log_level; -} - CapturingBoundNetLog::CapturingBoundNetLog(const NetLog::Source& source, CapturingNetLog* net_log) : source_(source), capturing_net_log_(net_log) { @@ -79,8 +71,4 @@ void CapturingBoundNetLog::Clear() { capturing_net_log_->Clear(); } -void CapturingBoundNetLog::SetLogLevel(NetLog::LogLevel log_level) { - capturing_net_log_->SetLogLevel(log_level); -} - } // namespace net diff --git a/net/base/capturing_net_log.h b/net/base/capturing_net_log.h index 193d641..9254725 100644 --- a/net/base/capturing_net_log.h +++ b/net/base/capturing_net_log.h @@ -61,8 +61,6 @@ class CapturingNetLog : public NetLog { void Clear(); - void SetLogLevel(NetLog::LogLevel log_level); - private: // Needs to be "mutable" so can use it in GetEntries(). mutable Lock lock_; @@ -73,8 +71,6 @@ class CapturingNetLog : public NetLog { size_t max_num_entries_; EntryList entries_; - NetLog::LogLevel log_level_; - DISALLOW_COPY_AND_ASSIGN(CapturingNetLog); }; @@ -101,9 +97,6 @@ class CapturingBoundNetLog { void Clear(); - // Sets the log level of the underlying CapturingNetLog. - void SetLogLevel(NetLog::LogLevel log_level); - private: NetLog::Source source_; scoped_ptr<CapturingNetLog> capturing_net_log_; diff --git a/net/base/net_log.cc b/net/base/net_log.cc index 0f1bac4..c9e7319 100644 --- a/net/base/net_log.cc +++ b/net/base/net_log.cc @@ -3,13 +3,11 @@ // found in the LICENSE file. #include "net/base/net_log.h" - #include "base/logging.h" #include "base/string_number_conversions.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "net/base/net_errors.h" namespace net { @@ -159,18 +157,6 @@ void BoundNetLog::EndEvent( AddEntry(event_type, NetLog::PHASE_END, params); } -void BoundNetLog::EndEventWithNetErrorCode(NetLog::EventType event_type, - int net_error) const { - DCHECK_NE(net_error, net::ERR_IO_PENDING); - if (net_error >= 0) { - EndEvent(event_type, NULL); - } else { - EndEvent( - event_type, - make_scoped_refptr(new NetLogIntegerParameter("net_error", net_error))); - } -} - // static BoundNetLog BoundNetLog::Make(NetLog* net_log, NetLog::SourceType source_type) { diff --git a/net/base/net_log.h b/net/base/net_log.h index 1d37129..b8f903d 100644 --- a/net/base/net_log.h +++ b/net/base/net_log.h @@ -34,8 +34,6 @@ namespace net { // TODO(eroman): Remove the 'const' qualitifer from the BoundNetLog methods. // TODO(eroman): Start a new Source each time net::URLRequest redirects // (simpler to reason about each as a separate entity). -// TODO(mmenke): Replace EndEvent calls with EndEventWithNetErrorCode, where -// appropriate. class NetLog { public: @@ -195,13 +193,6 @@ class BoundNetLog { void EndEvent(NetLog::EventType event_type, const scoped_refptr<NetLog::EventParameters>& params) const; - // Just like EndEvent, except |net_error| is a net error code. If it's - // negative, a parameter called "net_error" with a value of |net_error| is - // associated with the event. Otherwise, the end event has no parameters. - // |net_error| must not be ERR_IO_PENDING, as it's not a true error. - void EndEventWithNetErrorCode(NetLog::EventType event_type, - int net_error) const; - NetLog::LogLevel GetLogLevel() const; // Returns true if the log level is LOG_ALL. diff --git a/net/base/net_log_event_type_list.h b/net/base/net_log_event_type_list.h index 0f1eecf..f1bc4f8 100644 --- a/net/base/net_log_event_type_list.h +++ b/net/base/net_log_event_type_list.h @@ -501,85 +501,22 @@ EVENT_TYPE(URL_REQUEST_REDIRECTED) // HttpCache // ------------------------------------------------------------------------ -// Measures the time while getting a reference to the back end. -EVENT_TYPE(HTTP_CACHE_GET_BACKEND) - // Measures the time while opening a disk cache entry. EVENT_TYPE(HTTP_CACHE_OPEN_ENTRY) // Measures the time while creating a disk cache entry. EVENT_TYPE(HTTP_CACHE_CREATE_ENTRY) -// Measures the time it takes to add a HttpCache::Transaction to an http cache -// entry's list of active Transactions. -EVENT_TYPE(HTTP_CACHE_ADD_TO_ENTRY) - // Measures the time while deleting a disk cache entry. EVENT_TYPE(HTTP_CACHE_DOOM_ENTRY) -// Measures the time while reading/writing a disk cache entry's response headers -// or metadata. +// Measures the time while reading the response info from a disk cache entry. EVENT_TYPE(HTTP_CACHE_READ_INFO) -EVENT_TYPE(HTTP_CACHE_WRITE_INFO) - -// Measures the time while reading/writing a disk cache entry's body. -EVENT_TYPE(HTTP_CACHE_READ_DATA) -EVENT_TYPE(HTTP_CACHE_WRITE_DATA) - -// ------------------------------------------------------------------------ -// Disk Cache -// ------------------------------------------------------------------------ - -// The creation/destruction of a disk_cache::EntryImpl object. The "creation" -// is considered to be the point at which an Entry is first considered to be -// good and associated with a key. -// -// For the BEGIN phase, the following parameters are attached: -// { -// "created": <true if the Entry was created, rather than being opened>; -// "key": <The Entry's key>; -// } -EVENT_TYPE(DISK_CACHE_ENTRY) - -// Logs the time required to read/write data from/to a cache entry. -// -// For the BEGIN phase, the following parameters are attached: -// { -// "index": <Index being read/written>; -// "offset": <Offset being read/written>; -// "buf_len": <Length of buffer being read to/written from>; -// "truncate": <If present for a write, the truncate flag is set to true. -// Not present in reads or writes where it is false> -// } -// -// For the END phase, the following parameters are attached: -// { -// "bytes_copied": <Number of bytes copied. Not present on error>; -// "net_error": <Network error code. Only present on error>; -// } -EVENT_TYPE(DISK_CACHE_READ_DATA) -EVENT_TYPE(DISK_CACHE_WRITE_DATA) - -// Logged when SparseControl starts/stops handling IO for an Entry. -EVENT_TYPE(SPARSE_CONTROL) - -// Logged when SparseControl starts/stops reading/writing a child Entry's data -// -// For the BEGIN phase, the following parameters are attached: -// { -// "source_dependency": <Source id of the child entry> -// } -EVENT_TYPE(SPARSE_CONTROL_READ) -EVENT_TYPE(SPARSE_CONTROL_WRITE) - -// Indicates the time taken by a sparse control to get a range. -EVENT_TYPE(SPARSE_CONTROL_GET_RANGE) - -// Logged when an entry is closed. -EVENT_TYPE(DISK_CACHE_CLOSE) -// Logged when an entry is doomed. -EVENT_TYPE(DISK_CACHE_DOOM) +// Measures the time that an HttpCache::Transaction is stalled waiting for +// the cache entry to become available (for example if we are waiting for +// exclusive access to an existing entry). +EVENT_TYPE(HTTP_CACHE_WAITING) // ------------------------------------------------------------------------ // HttpNetworkTransaction diff --git a/net/base/net_log_source_type_list.h b/net/base/net_log_source_type_list.h index ba34955..231ecd2 100644 --- a/net/base/net_log_source_type_list.h +++ b/net/base/net_log_source_type_list.h @@ -15,6 +15,5 @@ SOURCE_TYPE(SOCKET, 5) SOURCE_TYPE(SPDY_SESSION, 6) SOURCE_TYPE(HOST_RESOLVER_IMPL_REQUEST, 7) SOURCE_TYPE(HOST_RESOLVER_IMPL_JOB, 8) -SOURCE_TYPE(DISK_CACHE_ENTRY, 9) -SOURCE_TYPE(COUNT, 10) // Always keep this as the last entry. +SOURCE_TYPE(COUNT, 9) // Always keep this as the last entry. diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 223c970..58a6e9e 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -194,12 +194,11 @@ class CacheCreator { public: CacheCreator(const FilePath& path, bool force, int max_bytes, net::CacheType type, uint32 flags, - base::MessageLoopProxy* thread, net::NetLog* net_log, - disk_cache::Backend** backend, + base::MessageLoopProxy* thread, disk_cache::Backend** backend, net::CompletionCallback* callback) : path_(path), force_(force), retry_(false), max_bytes_(max_bytes), type_(type), flags_(flags), thread_(thread), backend_(backend), - callback_(callback), cache_(NULL), net_log_(net_log), + callback_(callback), cache_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST( my_callback_(this, &CacheCreator::OnIOComplete)) { } @@ -224,14 +223,13 @@ class CacheCreator { disk_cache::Backend** backend_; net::CompletionCallback* callback_; disk_cache::BackendImpl* cache_; - net::NetLog* net_log_; net::CompletionCallbackImpl<CacheCreator> my_callback_; DISALLOW_COPY_AND_ASSIGN(CacheCreator); }; int CacheCreator::Run() { - cache_ = new disk_cache::BackendImpl(path_, thread_, net_log_); + cache_ = new disk_cache::BackendImpl(path_, thread_); cache_->SetMaxSize(max_bytes_); cache_->SetType(type_); cache_->SetFlags(flags_); @@ -297,8 +295,7 @@ namespace disk_cache { int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, bool force, base::MessageLoopProxy* thread, - net::NetLog* net_log, Backend** backend, - CompletionCallback* callback) { + Backend** backend, CompletionCallback* callback) { DCHECK(callback); if (type == net::MEMORY_CACHE) { *backend = MemBackendImpl::CreateBackend(max_bytes); @@ -307,7 +304,7 @@ int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, DCHECK(thread); return BackendImpl::CreateBackend(path, force, max_bytes, type, kNone, thread, - net_log, backend, callback); + backend, callback); } // Returns the preferred maximum number of bytes for the cache given the @@ -354,12 +351,11 @@ int PreferedCacheSize(int64 available) { int BackendImpl::CreateBackend(const FilePath& full_path, bool force, int max_bytes, net::CacheType type, uint32 flags, base::MessageLoopProxy* thread, - net::NetLog* net_log, Backend** backend, + Backend** backend, CompletionCallback* callback) { DCHECK(callback); CacheCreator* creator = new CacheCreator(full_path, force, max_bytes, type, - flags, thread, net_log, backend, - callback); + flags, thread, backend, callback); // This object will self-destroy when finished. return creator->Run(); } @@ -370,8 +366,7 @@ int BackendImpl::Init(CompletionCallback* callback) { } BackendImpl::BackendImpl(const FilePath& path, - base::MessageLoopProxy* cache_thread, - net::NetLog* net_log) + base::MessageLoopProxy* cache_thread) : ALLOW_THIS_IN_INITIALIZER_LIST(background_queue_(this, cache_thread)), path_(path), block_files_(path), @@ -388,7 +383,6 @@ BackendImpl::BackendImpl(const FilePath& path, new_eviction_(false), first_timer_(true), throttle_requests_(false), - net_log_(net_log), done_(true, false), ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) { @@ -396,8 +390,7 @@ BackendImpl::BackendImpl(const FilePath& path, BackendImpl::BackendImpl(const FilePath& path, uint32 mask, - base::MessageLoopProxy* cache_thread, - net::NetLog* net_log) + base::MessageLoopProxy* cache_thread) : ALLOW_THIS_IN_INITIALIZER_LIST(background_queue_(this, cache_thread)), path_(path), block_files_(path), @@ -414,7 +407,6 @@ BackendImpl::BackendImpl(const FilePath& path, new_eviction_(false), first_timer_(true), throttle_requests_(false), - net_log_(net_log), done_(true, false), ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) { @@ -856,8 +848,6 @@ EntryImpl* BackendImpl::CreateEntryImpl(const std::string& key) { return NULL; } - cache_entry->BeginLogging(net_log_, true); - // We are not failing the operation; let's add this to the map. open_entries_[entry_address.value()] = cache_entry; @@ -1547,7 +1537,6 @@ int BackendImpl::NewEntry(Addr address, EntryImpl** entry, bool* dirty) { open_entries_[address.value()] = cache_entry; } - cache_entry->BeginLogging(net_log_, false); cache_entry.swap(entry); return 0; } diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h index b481525..5637fbd 100644 --- a/net/disk_cache/backend_impl.h +++ b/net/disk_cache/backend_impl.h @@ -19,10 +19,6 @@ #include "net/disk_cache/stats.h" #include "net/disk_cache/trace.h" -namespace net { -class NetLog; -} // namespace net - namespace disk_cache { enum BackendFlags { @@ -42,11 +38,10 @@ enum BackendFlags { class BackendImpl : public Backend { friend class Eviction; public: - BackendImpl(const FilePath& path, base::MessageLoopProxy* cache_thread, - net::NetLog* net_log); + BackendImpl(const FilePath& path, base::MessageLoopProxy* cache_thread); // mask can be used to limit the usable size of the hash table, for testing. BackendImpl(const FilePath& path, uint32 mask, - base::MessageLoopProxy* cache_thread, net::NetLog* net_log); + base::MessageLoopProxy* cache_thread); ~BackendImpl(); // Returns a new backend with the desired flags. See the declaration of @@ -54,8 +49,7 @@ class BackendImpl : public Backend { static int CreateBackend(const FilePath& full_path, bool force, int max_bytes, net::CacheType type, uint32 flags, base::MessageLoopProxy* thread, - net::NetLog* net_log, Backend** backend, - CompletionCallback* callback); + Backend** backend, CompletionCallback* callback); // Performs general initialization for this current instance of the cache. int Init(CompletionCallback* callback); @@ -363,8 +357,6 @@ class BackendImpl : public Backend { bool first_timer_; // True if the timer has not been called. bool throttle_requests_; - net::NetLog* net_log_; - Stats stats_; // Usage statistcs. base::RepeatingTimer<BackendImpl> timer_; // Usage timer. base::WaitableEvent done_; // Signals the end of background work. diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index eaa00eb..9077996 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -195,7 +195,7 @@ TEST_F(DiskCacheTest, CreateBackend) { disk_cache::Backend* cache = NULL; int rv = disk_cache::BackendImpl::CreateBackend( path, false, 0, net::DISK_CACHE, disk_cache::kNoRandom, - cache_thread.message_loop_proxy(), NULL, &cache, &cb); + cache_thread.message_loop_proxy(), &cache, &cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); ASSERT_TRUE(cache); delete cache; @@ -208,14 +208,14 @@ TEST_F(DiskCacheTest, CreateBackend) { // Now test the public API. rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, path, 0, false, cache_thread.message_loop_proxy(), - NULL, &cache, &cb); + &cache, &cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); ASSERT_TRUE(cache); delete cache; cache = NULL; rv = disk_cache::CreateCacheBackend(net::MEMORY_CACHE, FilePath(), 0, false, - NULL, NULL, &cache, &cb); + NULL, &cache, &cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); ASSERT_TRUE(cache); delete cache; @@ -260,8 +260,7 @@ TEST_F(DiskCacheTest, ShutdownWithPendingIO) { disk_cache::Backend* cache; int rv = disk_cache::BackendImpl::CreateBackend( path, false, 0, net::DISK_CACHE, disk_cache::kNoRandom, - base::MessageLoopProxy::CreateForCurrentThread(), NULL, - &cache, &cb); + base::MessageLoopProxy::CreateForCurrentThread(), &cache, &cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); disk_cache::EntryImpl* entry; @@ -312,7 +311,7 @@ TEST_F(DiskCacheTest, ShutdownWithPendingIO2) { disk_cache::Backend* cache; int rv = disk_cache::BackendImpl::CreateBackend( path, false, 0, net::DISK_CACHE, disk_cache::kNoRandom, - cache_thread.message_loop_proxy(), NULL, &cache, &cb); + cache_thread.message_loop_proxy(), &cache, &cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); disk_cache::Entry* entry; @@ -349,7 +348,7 @@ TEST_F(DiskCacheTest, TruncatedIndex) { disk_cache::Backend* backend = NULL; int rv = disk_cache::BackendImpl::CreateBackend( path, false, 0, net::DISK_CACHE, disk_cache::kNone, - cache_thread.message_loop_proxy(), NULL, &backend, &cb); + cache_thread.message_loop_proxy(), &backend, &cb); ASSERT_NE(net::OK, cb.GetResult(rv)); ASSERT_TRUE(backend == NULL); @@ -1279,7 +1278,7 @@ TEST_F(DiskCacheTest, DeleteOld) { disk_cache::Backend* cache; int rv = disk_cache::BackendImpl::CreateBackend( path, true, 0, net::DISK_CACHE, disk_cache::kNoRandom, - cache_thread.message_loop_proxy(), NULL, &cache, &cb); + cache_thread.message_loop_proxy(), &cache, &cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); MessageLoopHelper helper; @@ -1652,8 +1651,7 @@ TEST_F(DiskCacheTest, Backend_UsageStats) { ASSERT_TRUE(DeleteCache(path)); scoped_ptr<disk_cache::BackendImpl> cache; cache.reset(new disk_cache::BackendImpl( - path, base::MessageLoopProxy::CreateForCurrentThread(), - NULL)); + path, base::MessageLoopProxy::CreateForCurrentThread())); ASSERT_TRUE(NULL != cache.get()); cache->SetUnitTestMode(); ASSERT_EQ(net::OK, cache->SyncInit()); @@ -1771,11 +1769,11 @@ TEST_F(DiskCacheTest, MultipleInstances) { int rv = disk_cache::BackendImpl::CreateBackend( store1.path(), false, 0, net::DISK_CACHE, disk_cache::kNone, - cache_thread.message_loop_proxy(), NULL, &cache[0], &cb); + cache_thread.message_loop_proxy(), &cache[0], &cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); rv = disk_cache::BackendImpl::CreateBackend( store2.path(), false, 0, net::MEDIA_CACHE, disk_cache::kNone, - cache_thread.message_loop_proxy(), NULL, &cache[1], &cb); + cache_thread.message_loop_proxy(), &cache[1], &cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); ASSERT_TRUE(cache[0] != NULL && cache[1] != NULL); diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h index 18dd447..59efe06 100644 --- a/net/disk_cache/disk_cache.h +++ b/net/disk_cache/disk_cache.h @@ -25,7 +25,6 @@ class MessageLoopProxy; namespace net { class IOBuffer; -class NetLog; } namespace disk_cache { @@ -51,8 +50,7 @@ typedef net::CompletionCallback CompletionCallback; // completes (the callback is notified). int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, bool force, base::MessageLoopProxy* thread, - net::NetLog* net_log, Backend** backend, - CompletionCallback* callback); + Backend** backend, CompletionCallback* callback); // The root interface for a disk cache instance. class Backend { diff --git a/net/disk_cache/disk_cache_perftest.cc b/net/disk_cache/disk_cache_perftest.cc index 14f15c6..241fc04 100644 --- a/net/disk_cache/disk_cache_perftest.cc +++ b/net/disk_cache/disk_cache_perftest.cc @@ -169,7 +169,7 @@ TEST_F(DiskCacheTest, CacheBackendPerformance) { disk_cache::Backend* cache; int rv = disk_cache::CreateCacheBackend( net::DISK_CACHE, test_cache.path(), 0, false, - cache_thread.message_loop_proxy(), NULL, &cache, &cb); + cache_thread.message_loop_proxy(), &cache, &cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); @@ -198,7 +198,7 @@ TEST_F(DiskCacheTest, CacheBackendPerformance) { rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, test_cache.path(), 0, false, cache_thread.message_loop_proxy(), - NULL, &cache, &cb); + &cache, &cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); ret = TimeRead(num_entries, cache, entries, true); diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc index 6c9b91c..cffe3fa 100644 --- a/net/disk_cache/disk_cache_test_base.cc +++ b/net/disk_cache/disk_cache_test_base.cc @@ -75,7 +75,7 @@ void DiskCacheTestWithCache::InitDiskCache() { TestCompletionCallback cb; int rv = disk_cache::BackendImpl::CreateBackend( path, force_creation_, size_, type_, - disk_cache::kNoRandom, thread, NULL, &cache_, &cb); + disk_cache::kNoRandom, thread, &cache_, &cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); } @@ -84,9 +84,9 @@ void DiskCacheTestWithCache::InitDiskCacheImpl(const FilePath& path) { use_current_thread_ ? base::MessageLoopProxy::CreateForCurrentThread() : cache_thread_.message_loop_proxy(); if (mask_) - cache_impl_ = new disk_cache::BackendImpl(path, mask_, thread, NULL); + cache_impl_ = new disk_cache::BackendImpl(path, mask_, thread); else - cache_impl_ = new disk_cache::BackendImpl(path, thread, NULL); + cache_impl_ = new disk_cache::BackendImpl(path, thread); cache_ = cache_impl_; ASSERT_TRUE(NULL != cache_); diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc index ed16db0..76690e6 100644 --- a/net/disk_cache/disk_cache_test_util.cc +++ b/net/disk_cache/disk_cache_test_util.cc @@ -94,7 +94,7 @@ bool CopyTestCache(const std::string& name) { bool CheckCacheIntegrity(const FilePath& path, bool new_eviction) { scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl( - path, base::MessageLoopProxy::CreateForCurrentThread(), NULL)); + path, base::MessageLoopProxy::CreateForCurrentThread())); if (!cache.get()) return false; if (new_eviction) diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc index 3cb895f..e5e6482 100644 --- a/net/disk_cache/entry_impl.cc +++ b/net/disk_cache/entry_impl.cc @@ -7,7 +7,6 @@ #include "base/message_loop.h" #include "base/metrics/histogram.h" #include "base/string_util.h" -#include "base/values.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "net/disk_cache/backend_impl.h" @@ -25,93 +24,14 @@ namespace { // Index for the file used to store the key, if any (files_[kKeyFileIndex]). const int kKeyFileIndex = 3; -// NetLog parameters for the creation of an EntryImpl. Contains an entry's name -// and whether it was created or opened. -class EntryCreationParameters : public net::NetLog::EventParameters { - public: - EntryCreationParameters(const std::string& key, bool created) - : key_(key), created_(created) { - } - - Value* ToValue() const { - DictionaryValue* dict = new DictionaryValue(); - dict->SetString("key", key_); - dict->SetBoolean("created", created_); - return dict; - } - - private: - const std::string key_; - const bool created_; - - DISALLOW_COPY_AND_ASSIGN(EntryCreationParameters); -}; - -// NetLog parameters for non-sparse reading and writing to an EntryImpl. -class ReadWriteDataParams : public net::NetLog::EventParameters { - public: - // For reads, |truncate| must be false. - ReadWriteDataParams(int index, int offset, int buf_len, bool truncate) - : index_(index), offset_(offset), buf_len_(buf_len), truncate_(truncate) { - } - - Value* ToValue() const { - DictionaryValue* dict = new DictionaryValue(); - dict->SetInteger("index", index_); - dict->SetInteger("offset", offset_); - dict->SetInteger("buf_len", buf_len_); - if (truncate_) - dict->SetBoolean("truncate", truncate_); - return dict; - } - - private: - const int index_; - const int offset_; - const int buf_len_; - const bool truncate_; - - DISALLOW_COPY_AND_ASSIGN(ReadWriteDataParams); -}; - -// NetLog parameters logged when non-sparse reads and writes complete. -class FileIOCompleteParameters : public net::NetLog::EventParameters { - public: - // |bytes_copied| is either the number of bytes copied or a network error - // code. |bytes_copied| must not be ERR_IO_PENDING, as it's not a valid - // result for an operation. - explicit FileIOCompleteParameters(int bytes_copied) - : bytes_copied_(bytes_copied) { - } - - Value* ToValue() const { - DCHECK_NE(bytes_copied_, net::ERR_IO_PENDING); - DictionaryValue* dict = new DictionaryValue(); - if (bytes_copied_ < 0) { - dict->SetInteger("net_error", bytes_copied_); - } else { - dict->SetInteger("bytes_copied", bytes_copied_); - } - return dict; - } - - private: - const int bytes_copied_; - - DISALLOW_COPY_AND_ASSIGN(FileIOCompleteParameters); -}; - // This class implements FileIOCallback to buffer the callback from a file IO // operation from the actual net class. class SyncCallback: public disk_cache::FileIOCallback { public: - // |end_event_type| is the event type to log on completion. Logs nothing on - // discard, or when the NetLog is not set to log all events. SyncCallback(disk_cache::EntryImpl* entry, net::IOBuffer* buffer, - net::CompletionCallback* callback, - net::NetLog::EventType end_event_type) + net::CompletionCallback* callback ) : entry_(entry), callback_(callback), buf_(buffer), - start_(TimeTicks::Now()), end_event_type_(end_event_type) { + start_(TimeTicks::Now()) { entry->AddRef(); entry->IncrementIoCount(); } @@ -119,13 +39,11 @@ class SyncCallback: public disk_cache::FileIOCallback { virtual void OnFileIOComplete(int bytes_copied); void Discard(); - private: disk_cache::EntryImpl* entry_; net::CompletionCallback* callback_; scoped_refptr<net::IOBuffer> buf_; TimeTicks start_; - net::NetLog::EventType end_event_type_; DISALLOW_COPY_AND_ASSIGN(SyncCallback); }; @@ -133,11 +51,6 @@ class SyncCallback: public disk_cache::FileIOCallback { void SyncCallback::OnFileIOComplete(int bytes_copied) { entry_->DecrementIoCount(); if (callback_) { - if (entry_->net_log().IsLoggingAllEvents()) { - entry_->net_log().EndEvent( - end_event_type_, - make_scoped_refptr(new FileIOCompleteParameters(bytes_copied))); - } entry_->ReportIOTime(disk_cache::EntryImpl::kAsyncIO, start_); callback_->Run(bytes_copied); } @@ -395,7 +308,6 @@ EntryImpl::~EntryImpl() { if (doomed_) { DeleteEntryData(true); } else { - net_log_.AddEvent(net::NetLog::TYPE_DISK_CACHE_CLOSE, NULL); bool ret = true; for (int index = 0; index < kNumStreams; index++) { if (user_buffers_[index].get()) { @@ -421,7 +333,6 @@ EntryImpl::~EntryImpl() { } Trace("~EntryImpl out 0x%p", reinterpret_cast<void*>(this)); - net_log_.EndEvent(net::NetLog::TYPE_DISK_CACHE_ENTRY, NULL); backend_->OnEntryDestroyEnd(); } @@ -576,46 +487,6 @@ void EntryImpl::DoomImpl() { int EntryImpl::ReadDataImpl(int index, int offset, net::IOBuffer* buf, int buf_len, CompletionCallback* callback) { - if (net_log_.IsLoggingAllEvents()) { - net_log_.BeginEvent( - net::NetLog::TYPE_DISK_CACHE_READ_DATA, - make_scoped_refptr( - new ReadWriteDataParams(index, offset, buf_len, false))); - } - - int result = InternalReadData(index, offset, buf, buf_len, callback); - - if (result != net::ERR_IO_PENDING && net_log_.IsLoggingAllEvents()) { - net_log_.EndEvent( - net::NetLog::TYPE_DISK_CACHE_READ_DATA, - make_scoped_refptr(new FileIOCompleteParameters(result))); - } - return result; -} - -int EntryImpl::WriteDataImpl(int index, int offset, net::IOBuffer* buf, - int buf_len, CompletionCallback* callback, - bool truncate) { - if (net_log_.IsLoggingAllEvents()) { - net_log_.BeginEvent( - net::NetLog::TYPE_DISK_CACHE_WRITE_DATA, - make_scoped_refptr( - new ReadWriteDataParams(index, offset, buf_len, truncate))); - } - - int result = InternalWriteData(index, offset, buf, buf_len, callback, - truncate); - - if (result != net::ERR_IO_PENDING && net_log_.IsLoggingAllEvents()) { - net_log_.EndEvent( - net::NetLog::TYPE_DISK_CACHE_WRITE_DATA, - make_scoped_refptr(new FileIOCompleteParameters(result))); - } - return result; -} - -int EntryImpl::InternalReadData(int index, int offset, net::IOBuffer* buf, - int buf_len, CompletionCallback* callback) { DCHECK(node_.Data()->dirty || read_only_); DVLOG(2) << "Read from " << index << " at " << offset << " : " << buf_len; if (index < 0 || index >= kNumStreams) @@ -665,10 +536,8 @@ int EntryImpl::InternalReadData(int index, int offset, net::IOBuffer* buf, } SyncCallback* io_callback = NULL; - if (callback) { - io_callback = new SyncCallback(this, buf, callback, - net::NetLog::TYPE_DISK_CACHE_READ_DATA); - } + if (callback) + io_callback = new SyncCallback(this, buf, callback); bool completed; if (!file->Read(buf->data(), buf_len, file_offset, io_callback, &completed)) { @@ -684,9 +553,9 @@ int EntryImpl::InternalReadData(int index, int offset, net::IOBuffer* buf, return (completed || !callback) ? buf_len : net::ERR_IO_PENDING; } -int EntryImpl::InternalWriteData(int index, int offset, net::IOBuffer* buf, - int buf_len, CompletionCallback* callback, - bool truncate) { +int EntryImpl::WriteDataImpl(int index, int offset, net::IOBuffer* buf, + int buf_len, CompletionCallback* callback, + bool truncate) { DCHECK(node_.Data()->dirty || read_only_); DVLOG(2) << "Write to " << index << " at " << offset << " : " << buf_len; if (index < 0 || index >= kNumStreams) @@ -759,10 +628,8 @@ int EntryImpl::InternalWriteData(int index, int offset, net::IOBuffer* buf, return 0; SyncCallback* io_callback = NULL; - if (callback) { - io_callback = new SyncCallback(this, buf, callback, - net::NetLog::TYPE_DISK_CACHE_WRITE_DATA); - } + if (callback) + io_callback = new SyncCallback(this, buf, callback); bool completed; if (!file->Write(buf->data(), buf_len, file_offset, io_callback, @@ -890,7 +757,6 @@ bool EntryImpl::IsSameEntry(const std::string& key, uint32 hash) { } void EntryImpl::InternalDoom() { - net_log_.AddEvent(net::NetLog::TYPE_DISK_CACHE_DOOM, NULL); DCHECK(node_.HasData()); if (!node_.Data()->dirty) { node_.Data()->dirty = backend_->GetCurrentEntryId(); @@ -1048,19 +914,6 @@ void EntryImpl::ReportIOTime(Operation op, const base::TimeTicks& start) { } } -void EntryImpl::BeginLogging(net::NetLog* net_log, bool created) { - DCHECK(!net_log_.net_log()); - net_log_ = net::BoundNetLog::Make( - net_log, net::NetLog::SOURCE_DISK_CACHE_ENTRY); - net_log_.BeginEvent( - net::NetLog::TYPE_DISK_CACHE_ENTRY, - make_scoped_refptr(new EntryCreationParameters(GetKey(), created))); -} - -const net::BoundNetLog& EntryImpl::net_log() const { - return net_log_; -} - // ------------------------------------------------------------------------ bool EntryImpl::CreateDataBlock(int index, int size) { diff --git a/net/disk_cache/entry_impl.h b/net/disk_cache/entry_impl.h index d24e861..e27f23a 100644 --- a/net/disk_cache/entry_impl.h +++ b/net/disk_cache/entry_impl.h @@ -7,7 +7,6 @@ #pragma once #include "base/scoped_ptr.h" -#include "net/base/net_log.h" #include "net/disk_cache/disk_cache.h" #include "net/disk_cache/storage_block.h" #include "net/disk_cache/storage_block-inl.h" @@ -130,14 +129,6 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> { // Generates a histogram for the time spent working on this operation. void ReportIOTime(Operation op, const base::TimeTicks& start); - // Logs a begin event and enables logging for the EntryImpl. Will also cause - // an end event to be logged on destruction. The EntryImpl must have its key - // initialized before this is called. |created| is true if the Entry was - // created rather than opened. - void BeginLogging(net::NetLog* net_log, bool created); - - const net::BoundNetLog& net_log() const; - private: enum { kNumStreams = 3 @@ -146,13 +137,6 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> { ~EntryImpl(); - // Do all the work for ReadDataImpl and WriteDataImpl. Implemented as - // separate functions to make logging of results simpler. - int InternalReadData(int index, int offset, net::IOBuffer* buf, - int buf_len, CompletionCallback* callback); - int InternalWriteData(int index, int offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* callback, bool truncate); - // Initializes the storage for an internal or external data block. bool CreateDataBlock(int index, int size); @@ -236,8 +220,6 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> { bool read_only_; // True if not yet writing. scoped_ptr<SparseControl> sparse_; // Support for sparse entries. - net::BoundNetLog net_log_; - DISALLOW_COPY_AND_ASSIGN(EntryImpl); }; diff --git a/net/disk_cache/sparse_control.cc b/net/disk_cache/sparse_control.cc index ebc8250..32f44ab 100644 --- a/net/disk_cache/sparse_control.cc +++ b/net/disk_cache/sparse_control.cc @@ -138,30 +138,6 @@ void ChildrenDeleter::DeleteChildren() { this, &ChildrenDeleter::DeleteChildren)); } -// Logs the end event for |operation|, if all events are being logged. -void LogOperationEnd(const net::BoundNetLog& net_log, - disk_cache::SparseControl::SparseOperation operation, - int result) { - if (net_log.IsLoggingAllEvents()) { - net::NetLog::EventType event_type; - switch (operation) { - case disk_cache::SparseControl::kReadOperation: - event_type = net::NetLog::TYPE_SPARSE_CONTROL_READ; - break; - case disk_cache::SparseControl::kWriteOperation: - event_type = net::NetLog::TYPE_SPARSE_CONTROL_WRITE; - break; - case disk_cache::SparseControl::kGetRangeOperation: - event_type = net::NetLog::TYPE_SPARSE_CONTROL_GET_RANGE; - break; - default: - NOTREACHED(); - return; - } - net_log.EndEventWithNetErrorCode(event_type, result); - } -} - } // namespace. namespace disk_cache { @@ -247,7 +223,6 @@ int SparseControl::StartIO(SparseOperation op, int64 offset, net::IOBuffer* buf, finished_ = false; abort_ = false; - entry_->net_log().BeginEvent(net::NetLog::TYPE_SPARSE_CONTROL, NULL); DoChildrenIO(); if (!pending_) { @@ -635,11 +610,8 @@ void SparseControl::InitChildData() { void SparseControl::DoChildrenIO() { while (DoChildIO()) continue; - if (finished_) { - entry_->net_log().EndEvent(net::NetLog::TYPE_SPARSE_CONTROL, NULL); - if (pending_) - DoUserCallback(); - } + if (pending_ && finished_) + DoUserCallback(); } bool SparseControl::DoChildIO() { @@ -660,32 +632,14 @@ bool SparseControl::DoChildIO() { int rv = 0; switch (operation_) { case kReadOperation: - if (entry_->net_log().IsLoggingAllEvents()) { - entry_->net_log().BeginEvent( - net::NetLog::TYPE_SPARSE_CONTROL_READ, - make_scoped_refptr(new net::NetLogSourceParameter( - "source_dependency", - child_->net_log().source()))); - } rv = child_->ReadDataImpl(kSparseData, child_offset_, user_buf_, child_len_, callback); break; case kWriteOperation: - if (entry_->net_log().IsLoggingAllEvents()) { - entry_->net_log().BeginEvent( - net::NetLog::TYPE_SPARSE_CONTROL_WRITE, - make_scoped_refptr(new net::NetLogSourceParameter( - "source_dependency", - child_->net_log().source()))); - } rv = child_->WriteDataImpl(kSparseData, child_offset_, user_buf_, child_len_, callback, false); break; case kGetRangeOperation: - if (entry_->net_log().IsLoggingAllEvents()) { - entry_->net_log().BeginEvent(net::NetLog::TYPE_SPARSE_CONTROL_GET_RANGE, - NULL); - } rv = DoGetAvailableRange(); break; default: @@ -758,7 +712,6 @@ int SparseControl::DoGetAvailableRange() { } void SparseControl::DoChildIOCompleted(int result) { - LogOperationEnd(entry_->net_log(), operation_, result); if (result < 0) { // We fail the whole operation if we encounter an error. result_ = result; @@ -784,8 +737,6 @@ void SparseControl::OnChildIOCompleted(int result) { // We'll return the current result of the operation, which may be less than // the bytes to read or write, but the user cancelled the operation. abort_ = false; - entry_->net_log().AddEvent(net::NetLog::TYPE_CANCELLED, NULL); - entry_->net_log().EndEvent(net::NetLog::TYPE_SPARSE_CONTROL, NULL); DoUserCallback(); return DoAbortCallbacks(); } diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc index ee2db24..41a98c9 100644 --- a/net/disk_cache/stress_cache.cc +++ b/net/disk_cache/stress_cache.cc @@ -104,7 +104,7 @@ void StressTheCache(int iteration) { int rv = disk_cache::BackendImpl::CreateBackend( path, false, cache_size, net::DISK_CACHE, disk_cache::kNoLoadProtection | disk_cache::kNoRandom, - cache_thread.message_loop_proxy(), NULL, &cache, &cb); + cache_thread.message_loop_proxy(), &cache, &cb); if (cb.GetResult(rv) != net::OK) { printf("Unable to initialize cache.\n"); diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index 5710491..51cc55f 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -55,18 +55,17 @@ HttpCache::BackendFactory* HttpCache::DefaultBackend::InMemory(int max_bytes) { return new DefaultBackend(MEMORY_CACHE, FilePath(), max_bytes, NULL); } -int HttpCache::DefaultBackend::CreateBackend(NetLog* net_log, - disk_cache::Backend** backend, +int HttpCache::DefaultBackend::CreateBackend(disk_cache::Backend** backend, CompletionCallback* callback) { DCHECK_GE(max_bytes_, 0); return disk_cache::CreateCacheBackend(type_, path_, max_bytes_, true, - thread_, net_log, backend, callback); + thread_, backend, callback); } //----------------------------------------------------------------------------- -HttpCache::ActiveEntry::ActiveEntry(disk_cache::Entry* entry) - : disk_entry(entry), +HttpCache::ActiveEntry::ActiveEntry(disk_cache::Entry* e) + : disk_entry(e), writer(NULL), will_process_pending_queue(false), doomed(false) { @@ -289,8 +288,7 @@ HttpCache::HttpCache(HostResolver* host_resolver, HttpNetworkDelegate* network_delegate, NetLog* net_log, BackendFactory* backend_factory) - : net_log_(net_log), - backend_factory_(backend_factory), + : backend_factory_(backend_factory), building_backend_(false), mode_(NORMAL), ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor( @@ -305,8 +303,7 @@ HttpCache::HttpCache(HostResolver* host_resolver, HttpCache::HttpCache(HttpNetworkSession* session, BackendFactory* backend_factory) - : net_log_(session->net_log()), - backend_factory_(backend_factory), + : backend_factory_(backend_factory), building_backend_(false), mode_(NORMAL), network_layer_(HttpNetworkLayer::CreateFactory(session)), @@ -314,10 +311,8 @@ HttpCache::HttpCache(HttpNetworkSession* session, } HttpCache::HttpCache(HttpTransactionFactory* network_layer, - NetLog* net_log, BackendFactory* backend_factory) - : net_log_(net_log), - backend_factory_(backend_factory), + : backend_factory_(backend_factory), building_backend_(false), mode_(NORMAL), network_layer_(network_layer), @@ -469,8 +464,7 @@ int HttpCache::CreateBackend(disk_cache::Backend** backend, BackendCallback* my_callback = new BackendCallback(this, pending_op); pending_op->callback = my_callback; - int rv = backend_factory_->CreateBackend(net_log_, &pending_op->backend, - my_callback); + int rv = backend_factory_->CreateBackend(&pending_op->backend, my_callback); if (rv != ERR_IO_PENDING) { pending_op->writer->ClearCallback(); my_callback->Run(rv); diff --git a/net/http/http_cache.h b/net/http/http_cache.h index 0641ca4..8ff6442 100644 --- a/net/http/http_cache.h +++ b/net/http/http_cache.h @@ -87,8 +87,7 @@ class HttpCache : public HttpTransactionFactory, // notification arrives. // The implementation must not access the factory object after invoking the // |callback| because the object can be deleted from within the callback. - virtual int CreateBackend(NetLog* net_log, - disk_cache::Backend** backend, + virtual int CreateBackend(disk_cache::Backend** backend, CompletionCallback* callback) = 0; }; @@ -106,8 +105,7 @@ class HttpCache : public HttpTransactionFactory, static BackendFactory* InMemory(int max_bytes); // BackendFactory implementation. - virtual int CreateBackend(NetLog* net_log, - disk_cache::Backend** backend, + virtual int CreateBackend(disk_cache::Backend** backend, CompletionCallback* callback); private: @@ -142,7 +140,6 @@ class HttpCache : public HttpTransactionFactory, // by the HttpCache and will be destroyed using |delete| when the HttpCache is // destroyed. HttpCache(HttpTransactionFactory* network_layer, - NetLog* net_log, BackendFactory* backend_factory); HttpTransactionFactory* network_layer() { return network_layer_.get(); } @@ -218,7 +215,7 @@ class HttpCache : public HttpTransactionFactory, bool will_process_pending_queue; bool doomed; - explicit ActiveEntry(disk_cache::Entry* entry); + explicit ActiveEntry(disk_cache::Entry*); ~ActiveEntry(); }; @@ -347,8 +344,6 @@ class HttpCache : public HttpTransactionFactory, // Variables ---------------------------------------------------------------- - NetLog* net_log_; - // Used when lazily constructing the disk_cache_. scoped_ptr<BackendFactory> backend_factory_; bool building_backend_; diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index b506edc..d795c83 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc @@ -398,10 +398,6 @@ LoadState HttpCache::Transaction::GetWriterLoadState() const { return LOAD_STATE_WAITING_FOR_CACHE; } -const BoundNetLog& HttpCache::Transaction::net_log() const { - return net_log_; -} - //----------------------------------------------------------------------------- void HttpCache::Transaction::DoCallback(int rv) { @@ -583,14 +579,13 @@ int HttpCache::Transaction::DoLoop(int result) { int HttpCache::Transaction::DoGetBackend() { cache_pending_ = true; next_state_ = STATE_GET_BACKEND_COMPLETE; - net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_GET_BACKEND, NULL); + net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WAITING, NULL); return cache_->GetBackendForTransaction(this); } int HttpCache::Transaction::DoGetBackendComplete(int result) { DCHECK(result == OK || result == ERR_FAILED); - net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_GET_BACKEND, - result); + net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_WAITING, NULL); cache_pending_ = false; if (!ShouldPassThrough()) { @@ -762,7 +757,7 @@ int HttpCache::Transaction::DoOpenEntryComplete(int result) { // It is important that we go to STATE_ADD_TO_ENTRY whenever the result is // OK, otherwise the cache will end up with an active entry without any // transaction attached. - net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY, result); + net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY, NULL); cache_pending_ = false; if (result == OK) { next_state_ = STATE_ADD_TO_ENTRY; @@ -805,8 +800,7 @@ int HttpCache::Transaction::DoCreateEntryComplete(int result) { // It is important that we go to STATE_ADD_TO_ENTRY whenever the result is // OK, otherwise the cache will end up with an active entry without any // transaction attached. - net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY, - result); + net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY, NULL); cache_pending_ = false; next_state_ = STATE_ADD_TO_ENTRY; @@ -837,7 +831,7 @@ int HttpCache::Transaction::DoDoomEntry() { } int HttpCache::Transaction::DoDoomEntryComplete(int result) { - net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY, result); + net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY, NULL); next_state_ = STATE_CREATE_ENTRY; cache_pending_ = false; if (result == ERR_CACHE_RACE) @@ -850,15 +844,14 @@ int HttpCache::Transaction::DoAddToEntry() { DCHECK(new_entry_); cache_pending_ = true; next_state_ = STATE_ADD_TO_ENTRY_COMPLETE; - net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY, NULL); + net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WAITING, NULL); DCHECK(entry_lock_waiting_since_.is_null()); entry_lock_waiting_since_ = base::TimeTicks::Now(); return cache_->AddTransactionToEntry(new_entry_, this); } int HttpCache::Transaction::DoAddToEntryComplete(int result) { - net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY, - result); + net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_WAITING, NULL); const base::TimeDelta entry_lock_wait = base::TimeTicks::Now() - entry_lock_waiting_since_; @@ -1009,19 +1002,12 @@ int HttpCache::Transaction::DoTruncateCachedData() { cache_callback_->AddRef(); // Balanced in DoTruncateCachedDataComplete. if (!entry_) return OK; - if (net_log_.IsLoggingAllEvents()) - net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_DATA, NULL); // Truncate the stream. return WriteToEntry(kResponseContentIndex, 0, NULL, 0, cache_callback_); } int HttpCache::Transaction::DoTruncateCachedDataComplete(int result) { - if (net_log_.IsLoggingAllEvents() && entry_) { - net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_WRITE_DATA, - result); - } - // Balance the AddRef from DoTruncateCachedData. cache_callback_->Release(); next_state_ = STATE_TRUNCATE_CACHED_METADATA; @@ -1034,17 +1020,10 @@ int HttpCache::Transaction::DoTruncateCachedMetadata() { if (!entry_) return OK; - if (net_log_.IsLoggingAllEvents()) - net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_INFO, NULL); return WriteToEntry(kMetadataIndex, 0, NULL, 0, cache_callback_); } int HttpCache::Transaction::DoTruncateCachedMetadataComplete(int result) { - if (net_log_.IsLoggingAllEvents() && entry_) { - net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_WRITE_INFO, - result); - } - // Balance the AddRef from DoTruncateCachedMetadata. cache_callback_->Release(); @@ -1094,7 +1073,7 @@ int HttpCache::Transaction::DoCacheReadResponse() { int HttpCache::Transaction::DoCacheReadResponseComplete(int result) { cache_callback_->Release(); // Balance the AddRef from DoCacheReadResponse. - net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_READ_INFO, result); + net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO, NULL); if (result != io_buf_len_ || !HttpCache::ParseResponseInfo(read_buf_->data(), io_buf_len_, &response_, &truncated_)) { @@ -1134,14 +1113,10 @@ int HttpCache::Transaction::DoCacheReadResponseComplete(int result) { } int HttpCache::Transaction::DoCacheWriteResponse() { - if (net_log_.IsLoggingAllEvents() && entry_) - net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_INFO, NULL); return WriteResponseInfoToEntry(false); } int HttpCache::Transaction::DoCacheWriteTruncatedResponse() { - if (net_log_.IsLoggingAllEvents() && entry_) - net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_INFO, NULL); return WriteResponseInfoToEntry(true); } @@ -1150,10 +1125,6 @@ int HttpCache::Transaction::DoCacheWriteResponseComplete(int result) { target_state_ = STATE_NONE; if (!entry_) return OK; - if (net_log_.IsLoggingAllEvents()) { - net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_WRITE_INFO, - result); - } // Balance the AddRef from WriteResponseInfoToEntry. write_headers_callback_->Release(); @@ -1181,7 +1152,7 @@ int HttpCache::Transaction::DoCacheReadMetadata() { int HttpCache::Transaction::DoCacheReadMetadataComplete(int result) { cache_callback_->Release(); // Balance the AddRef from DoCacheReadMetadata. - net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_READ_INFO, result); + net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO, NULL); if (result != response_.metadata->size()) { DLOG(ERROR) << "ReadData failed: " << result; return ERR_CACHE_READ_FAILURE; @@ -1212,9 +1183,6 @@ int HttpCache::Transaction::DoCacheReadData() { DCHECK(entry_); next_state_ = STATE_CACHE_READ_DATA_COMPLETE; cache_callback_->AddRef(); // Balanced in DoCacheReadDataComplete. - - if (net_log_.IsLoggingAllEvents()) - net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_READ_DATA, NULL); if (partial_.get()) { return partial_->CacheRead(entry_->disk_entry, read_buf_, io_buf_len_, cache_callback_); @@ -1226,10 +1194,6 @@ int HttpCache::Transaction::DoCacheReadData() { int HttpCache::Transaction::DoCacheReadDataComplete(int result) { cache_callback_->Release(); // Balance the AddRef from DoCacheReadData. - if (net_log_.IsLoggingAllEvents()) { - net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_READ_DATA, - result); - } if (!cache_) return ERR_UNEXPECTED; @@ -1249,18 +1213,12 @@ int HttpCache::Transaction::DoCacheReadDataComplete(int result) { int HttpCache::Transaction::DoCacheWriteData(int num_bytes) { next_state_ = STATE_CACHE_WRITE_DATA_COMPLETE; write_len_ = num_bytes; - if (net_log_.IsLoggingAllEvents() && entry_) - net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_DATA, NULL); cache_callback_->AddRef(); // Balanced in DoCacheWriteDataComplete. return AppendResponseDataToEntry(read_buf_, num_bytes, cache_callback_); } int HttpCache::Transaction::DoCacheWriteDataComplete(int result) { - if (net_log_.IsLoggingAllEvents() && entry_) { - net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_WRITE_DATA, - result); - } // Balance the AddRef from DoCacheWriteData. cache_callback_->Release(); if (!cache_) diff --git a/net/http/http_cache_transaction.h b/net/http/http_cache_transaction.h index 316c15b..6b46750 100644 --- a/net/http/http_cache_transaction.h +++ b/net/http/http_cache_transaction.h @@ -110,8 +110,6 @@ class HttpCache::Transaction : public HttpTransaction { CompletionCallback* io_callback() { return &io_callback_; } - const BoundNetLog& net_log() const; - private: static const size_t kNumValidationHeaders = 2; // Helper struct to pair a header name with its value, for diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index bf8cb6b..a40a5b8 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -536,8 +536,7 @@ class MockDiskCache : public disk_cache::Backend { class MockBackendFactory : public net::HttpCache::BackendFactory { public: - virtual int CreateBackend(net::NetLog* /* net_log */, - disk_cache::Backend** backend, + virtual int CreateBackend(disk_cache::Backend** backend, net::CompletionCallback* callback) { *backend = new MockDiskCache(); return net::OK; @@ -547,11 +546,11 @@ class MockBackendFactory : public net::HttpCache::BackendFactory { class MockHttpCache { public: MockHttpCache() - : http_cache_(new MockNetworkLayer(), NULL, new MockBackendFactory()) { + : http_cache_(new MockNetworkLayer(), new MockBackendFactory()) { } explicit MockHttpCache(net::HttpCache::BackendFactory* disk_cache_factory) - : http_cache_(new MockNetworkLayer(), NULL, disk_cache_factory) { + : http_cache_(new MockNetworkLayer(), disk_cache_factory) { } net::HttpCache* http_cache() { return &http_cache_; } @@ -611,8 +610,7 @@ class MockHttpCache { } // Helper function to synchronously create a backend entry. - bool CreateBackendEntry(const std::string& key, disk_cache::Entry** entry, - net::NetLog* /* net_log */) { + bool CreateBackendEntry(const std::string& key, disk_cache::Entry** entry) { TestCompletionCallback cb; int rv = disk_cache()->CreateEntry(key, entry, &cb); return (cb.GetResult(rv) == net::OK); @@ -632,8 +630,7 @@ class MockDiskCacheNoCB : public MockDiskCache { class MockBackendNoCbFactory : public net::HttpCache::BackendFactory { public: - virtual int CreateBackend(net::NetLog* /* net_log */, - disk_cache::Backend** backend, + virtual int CreateBackend(disk_cache::Backend** backend, net::CompletionCallback* callback) { *backend = new MockDiskCacheNoCB(); return net::OK; @@ -646,8 +643,7 @@ class MockBlockingBackendFactory : public net::HttpCache::BackendFactory { MockBlockingBackendFactory() : backend_(NULL), callback_(NULL), block_(true), fail_(false) {} - virtual int CreateBackend(net::NetLog* /* net_log */, - disk_cache::Backend** backend, + virtual int CreateBackend(disk_cache::Backend** backend, net::CompletionCallback* callback) { if (!block_) { if (!fail_) @@ -1041,7 +1037,6 @@ TEST(HttpCache, SimpleGETNoDiskCache) { cache.disk_cache()->set_fail_requests(); net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded); - log.SetLogLevel(net::NetLog::LOG_BASIC); // Read from the network, and don't use the cache. RunTransactionTestWithLog(cache.http_cache(), kSimpleGET_Transaction, @@ -1054,9 +1049,9 @@ TEST(HttpCache, SimpleGETNoDiskCache) { EXPECT_EQ(6u, entries.size()); EXPECT_TRUE(net::LogContainsBeginEvent( - entries, 0, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND)); + entries, 0, net::NetLog::TYPE_HTTP_CACHE_WAITING)); EXPECT_TRUE(net::LogContainsEndEvent( - entries, 1, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND)); + entries, 1, net::NetLog::TYPE_HTTP_CACHE_WAITING)); EXPECT_TRUE(net::LogContainsBeginEvent( entries, 2, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY)); EXPECT_TRUE(net::LogContainsEndEvent( @@ -1148,9 +1143,6 @@ TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Hit) { net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded); - // This prevents a number of write events from being logged. - log.SetLogLevel(net::NetLog::LOG_BASIC); - // write to the cache RunTransactionTestWithLog(cache.http_cache(), kSimpleGET_Transaction, log.bound()); @@ -1161,9 +1153,9 @@ TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Hit) { EXPECT_EQ(8u, entries.size()); EXPECT_TRUE(net::LogContainsBeginEvent( - entries, 0, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND)); + entries, 0, net::NetLog::TYPE_HTTP_CACHE_WAITING)); EXPECT_TRUE(net::LogContainsEndEvent( - entries, 1, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND)); + entries, 1, net::NetLog::TYPE_HTTP_CACHE_WAITING)); EXPECT_TRUE(net::LogContainsBeginEvent( entries, 2, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY)); EXPECT_TRUE(net::LogContainsEndEvent( @@ -1173,9 +1165,9 @@ TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Hit) { EXPECT_TRUE(net::LogContainsEndEvent( entries, 5, net::NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY)); EXPECT_TRUE(net::LogContainsBeginEvent( - entries, 6, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY)); + entries, 6, net::NetLog::TYPE_HTTP_CACHE_WAITING)); EXPECT_TRUE(net::LogContainsEndEvent( - entries, 7, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY)); + entries, 7, net::NetLog::TYPE_HTTP_CACHE_WAITING)); // force this transaction to read from the cache MockTransaction transaction(kSimpleGET_Transaction); @@ -1190,17 +1182,17 @@ TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Hit) { EXPECT_EQ(8u, entries.size()); EXPECT_TRUE(net::LogContainsBeginEvent( - entries, 0, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND)); + entries, 0, net::NetLog::TYPE_HTTP_CACHE_WAITING)); EXPECT_TRUE(net::LogContainsEndEvent( - entries, 1, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND)); + entries, 1, net::NetLog::TYPE_HTTP_CACHE_WAITING)); EXPECT_TRUE(net::LogContainsBeginEvent( entries, 2, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY)); EXPECT_TRUE(net::LogContainsEndEvent( entries, 3, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY)); EXPECT_TRUE(net::LogContainsBeginEvent( - entries, 4, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY)); + entries, 4, net::NetLog::TYPE_HTTP_CACHE_WAITING)); EXPECT_TRUE(net::LogContainsEndEvent( - entries, 5, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY)); + entries, 5, net::NetLog::TYPE_HTTP_CACHE_WAITING)); EXPECT_TRUE(net::LogContainsBeginEvent( entries, 6, net::NetLog::TYPE_HTTP_CACHE_READ_INFO)); EXPECT_TRUE(net::LogContainsEndEvent( @@ -1281,9 +1273,6 @@ TEST(HttpCache, SimpleGET_LoadBypassCache) { net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded); - // This prevents a number of write events from being logged. - log.SetLogLevel(net::NetLog::LOG_BASIC); - RunTransactionTestWithLog(cache.http_cache(), transaction, log.bound()); // Check that the NetLog was filled as expected. @@ -1292,9 +1281,9 @@ TEST(HttpCache, SimpleGET_LoadBypassCache) { EXPECT_EQ(8u, entries.size()); EXPECT_TRUE(net::LogContainsBeginEvent( - entries, 0, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND)); + entries, 0, net::NetLog::TYPE_HTTP_CACHE_WAITING)); EXPECT_TRUE(net::LogContainsEndEvent( - entries, 1, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND)); + entries, 1, net::NetLog::TYPE_HTTP_CACHE_WAITING)); EXPECT_TRUE(net::LogContainsBeginEvent( entries, 2, net::NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY)); EXPECT_TRUE(net::LogContainsEndEvent( @@ -1304,9 +1293,9 @@ TEST(HttpCache, SimpleGET_LoadBypassCache) { EXPECT_TRUE(net::LogContainsEndEvent( entries, 5, net::NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY)); EXPECT_TRUE(net::LogContainsBeginEvent( - entries, 6, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY)); + entries, 6, net::NetLog::TYPE_HTTP_CACHE_WAITING)); EXPECT_TRUE(net::LogContainsEndEvent( - entries, 7, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY)); + entries, 7, net::NetLog::TYPE_HTTP_CACHE_WAITING)); EXPECT_EQ(2, cache.network_layer()->transaction_count()); EXPECT_EQ(0, cache.disk_cache()->open_count()); @@ -3313,8 +3302,7 @@ TEST(HttpCache, GET_Previous206_NotSparse) { // Create a disk cache entry that stores 206 headers while not being sparse. disk_cache::Entry* entry; - ASSERT_TRUE(cache.CreateBackendEntry(kSimpleGET_Transaction.url, &entry, - NULL)); + ASSERT_TRUE(cache.CreateBackendEntry(kSimpleGET_Transaction.url, &entry)); std::string raw_headers(kRangeGET_TransactionOK.status); raw_headers.append("\n"); @@ -3357,8 +3345,7 @@ TEST(HttpCache, RangeGET_Previous206_NotSparse_2) { // Create a disk cache entry that stores 206 headers while not being sparse. disk_cache::Entry* entry; - ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry, - NULL)); + ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry)); std::string raw_headers(kRangeGET_TransactionOK.status); raw_headers.append("\n"); @@ -3956,8 +3943,7 @@ TEST(HttpCache, RangeGET_OK_LoadOnlyFromCache) { TEST(HttpCache, WriteResponseInfo_Truncated) { MockHttpCache cache; disk_cache::Entry* entry; - ASSERT_TRUE(cache.CreateBackendEntry("http://www.google.com", &entry, - NULL)); + ASSERT_TRUE(cache.CreateBackendEntry("http://www.google.com", &entry)); std::string headers("HTTP/1.1 200 OK"); headers = net::HttpUtil::AssembleRawHeaders(headers.data(), headers.size()); @@ -4156,8 +4142,7 @@ TEST(HttpCache, GET_IncompleteResource) { // Create a disk cache entry that stores an incomplete resource. disk_cache::Entry* entry; - ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry, - NULL)); + ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry)); std::string raw_headers("HTTP/1.1 200 OK\n" "Last-Modified: Sat, 18 Apr 2009 01:10:43 GMT\n" @@ -4217,8 +4202,7 @@ TEST(HttpCache, GET_IncompleteResource2) { // Create a disk cache entry that stores an incomplete resource. disk_cache::Entry* entry; - ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry, - NULL)); + ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry)); // Content-length will be intentionally bad. @@ -4277,8 +4261,7 @@ TEST(HttpCache, GET_CancelIncompleteResource) { // Create a disk cache entry that stores an incomplete resource. disk_cache::Entry* entry; - ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry, - NULL)); + ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry)); std::string raw_headers("HTTP/1.1 200 OK\n" "Last-Modified: Sat, 18 Apr 2009 01:10:43 GMT\n" @@ -4343,8 +4326,7 @@ TEST(HttpCache, RangeGET_IncompleteResource) { // Create a disk cache entry that stores an incomplete resource. disk_cache::Entry* entry; - ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry, - NULL)); + ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry)); // Content-length will be intentionally bogus. std::string raw_headers("HTTP/1.1 200 OK\n" diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index b36d7f7..5a3b96c 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h @@ -130,10 +130,6 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>, return &http_stream_factory_; } - NetLog* net_log() { - return net_log_; - } - // Creates a Value summary of the state of the socket pools. The caller is // responsible for deleting the returned value. Value* SocketPoolInfoToValue() const { diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc index 043f71e..ec0fb58 100644 --- a/net/proxy/proxy_script_fetcher_impl_unittest.cc +++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc @@ -47,7 +47,6 @@ class RequestContext : public URLRequestContext { net::HttpNetworkLayer::CreateFactory(host_resolver_, cert_verifier_, NULL, NULL, NULL, proxy_service_, ssl_config_service_, NULL, NULL, NULL), - NULL, net::HttpCache::DefaultBackend::InMemory(0)); } diff --git a/net/spdy/spdy_test_util.h b/net/spdy/spdy_test_util.h index 1b052fa..aeabe6a 100644 --- a/net/spdy/spdy_test_util.h +++ b/net/spdy/spdy_test_util.h @@ -419,7 +419,6 @@ class SpdyURLRequestContext : public URLRequestContext { http_auth_handler_factory_, network_delegate_, NULL), - NULL /* net_log */, net::HttpCache::DefaultBackend::InMemory(0)); } diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc index 40c6a41..44672ed 100644 --- a/net/tools/crash_cache/crash_cache.cc +++ b/net/tools/crash_cache/crash_cache.cc @@ -135,7 +135,7 @@ int SimpleInsert(const FilePath& path, RankCrashes action, disk_cache::Backend* cache; int rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, path, 0, false, cache_thread->message_loop_proxy(), - NULL, &cache, &cb); + &cache, &cb); if (cb.GetResult(rv) != net::OK || cache->GetEntryCount()) return GENERIC; @@ -176,7 +176,7 @@ int SimpleRemove(const FilePath& path, RankCrashes action, // Use a simple LRU for eviction. int rv = disk_cache::CreateCacheBackend(net::MEDIA_CACHE, path, 0, false, cache_thread->message_loop_proxy(), - NULL, &cache, &cb); + &cache, &cb); if (cb.GetResult(rv) != net::OK || cache->GetEntryCount()) return GENERIC; @@ -219,7 +219,7 @@ int HeadRemove(const FilePath& path, RankCrashes action, // Use a simple LRU for eviction. int rv = disk_cache::CreateCacheBackend(net::MEDIA_CACHE, path, 0, false, cache_thread->message_loop_proxy(), - NULL, &cache, &cb); + &cache, &cb); if (cb.GetResult(rv) != net::OK || cache->GetEntryCount()) return GENERIC; @@ -256,7 +256,7 @@ int LoadOperations(const FilePath& path, RankCrashes action, // Work with a tiny index table (16 entries). disk_cache::BackendImpl* cache = new disk_cache::BackendImpl( - path, 0xf, cache_thread->message_loop_proxy(), NULL); + path, 0xf, cache_thread->message_loop_proxy()); if (!cache || !cache->SetMaxSize(0x100000)) return GENERIC; diff --git a/net/tools/dump_cache/upgrade.cc b/net/tools/dump_cache/upgrade.cc index fae924c..30fbc8c6 100644 --- a/net/tools/dump_cache/upgrade.cc +++ b/net/tools/dump_cache/upgrade.cc @@ -326,7 +326,7 @@ bool MasterSM::DoInit() { FilePath::FromWStringHack(path_), 0, false, cache_thread_.message_loop_proxy(), - NULL, &cache, &cb); + &cache, &cb); if (cb.GetResult(rv) != net::OK) { printf("Unable to initialize new files\n"); return false; @@ -607,7 +607,7 @@ SlaveSM::SlaveSM(const std::wstring& path, HANDLE channel) FilePath::FromWStringHack(path), 0, false, cache_thread_.message_loop_proxy(), - NULL, &cache, &cb); + &cache, &cb); if (cb.GetResult(rv) != net::OK) { printf("Unable to open cache files\n"); return; diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h index c336b41..b13d268 100644 --- a/net/url_request/url_request_unittest.h +++ b/net/url_request/url_request_unittest.h @@ -173,7 +173,6 @@ class TestURLRequestContext : public URLRequestContext { http_auth_handler_factory_, network_delegate_, NULL), - NULL /* net_log */, net::HttpCache::DefaultBackend::InMemory(0)); // In-memory cookie store. cookie_store_ = new net::CookieMonster(NULL, NULL); diff --git a/net/url_request/view_cache_helper_unittest.cc b/net/url_request/view_cache_helper_unittest.cc index 3903c2b..5338ee5 100644 --- a/net/url_request/view_cache_helper_unittest.cc +++ b/net/url_request/view_cache_helper_unittest.cc @@ -25,7 +25,7 @@ class TestURLRequestContext : public URLRequestContext { }; TestURLRequestContext::TestURLRequestContext() - : cache_(reinterpret_cast<net::HttpTransactionFactory*>(NULL), NULL, + : cache_(reinterpret_cast<net::HttpTransactionFactory*>(NULL), net::HttpCache::DefaultBackend::InMemory(0)) { http_transaction_factory_ = &cache_; } diff --git a/webkit/appcache/appcache_disk_cache.cc b/webkit/appcache/appcache_disk_cache.cc index 9aa0280..dbba211 100644 --- a/webkit/appcache/appcache_disk_cache.cc +++ b/webkit/appcache/appcache_disk_cache.cc @@ -108,7 +108,7 @@ int AppCacheDiskCache::Init(net::CacheType cache_type, this, &AppCacheDiskCache::OnCreateBackendComplete); int rv = disk_cache::CreateCacheBackend( - cache_type, cache_directory, cache_size, force, cache_thread, NULL, + cache_type, cache_directory, cache_size, force, cache_thread, &(create_backend_callback_->backend_ptr_), create_backend_callback_); if (rv == net::ERR_IO_PENDING) init_callback_ = callback; |