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 /net/http | |
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
Diffstat (limited to 'net/http')
-rw-r--r-- | net/http/http_cache.cc | 22 | ||||
-rw-r--r-- | net/http/http_cache.h | 11 | ||||
-rw-r--r-- | net/http/http_cache_transaction.cc | 60 | ||||
-rw-r--r-- | net/http/http_cache_transaction.h | 2 | ||||
-rw-r--r-- | net/http/http_cache_unittest.cc | 72 | ||||
-rw-r--r-- | net/http/http_network_session.h | 4 |
6 files changed, 47 insertions, 124 deletions
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 { |