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

Side by Side Diff: net/http/http_cache.cc

Issue 2730053002: Revert of Server push cancellation: add a finch trial parameter (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/BUILD.gn ('k') | net/http/http_network_session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_cache.h" 5 #include "net/http/http_cache.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 20 matching lines...) Expand all
31 #include "base/trace_event/memory_allocator_dump.h" 31 #include "base/trace_event/memory_allocator_dump.h"
32 #include "base/trace_event/memory_usage_estimator.h" 32 #include "base/trace_event/memory_usage_estimator.h"
33 #include "base/trace_event/process_memory_dump.h" 33 #include "base/trace_event/process_memory_dump.h"
34 #include "net/base/cache_type.h" 34 #include "net/base/cache_type.h"
35 #include "net/base/io_buffer.h" 35 #include "net/base/io_buffer.h"
36 #include "net/base/load_flags.h" 36 #include "net/base/load_flags.h"
37 #include "net/base/net_errors.h" 37 #include "net/base/net_errors.h"
38 #include "net/base/upload_data_stream.h" 38 #include "net/base/upload_data_stream.h"
39 #include "net/disk_cache/disk_cache.h" 39 #include "net/disk_cache/disk_cache.h"
40 #include "net/http/disk_cache_based_quic_server_info.h" 40 #include "net/http/disk_cache_based_quic_server_info.h"
41 #include "net/http/http_cache_lookup_manager.h"
42 #include "net/http/http_cache_transaction.h" 41 #include "net/http/http_cache_transaction.h"
43 #include "net/http/http_network_layer.h" 42 #include "net/http/http_network_layer.h"
44 #include "net/http/http_network_session.h" 43 #include "net/http/http_network_session.h"
45 #include "net/http/http_request_info.h" 44 #include "net/http/http_request_info.h"
46 #include "net/http/http_response_headers.h" 45 #include "net/http/http_response_headers.h"
47 #include "net/http/http_response_info.h" 46 #include "net/http/http_response_info.h"
48 #include "net/http/http_util.h" 47 #include "net/http/http_util.h"
49 #include "net/log/net_log_with_source.h" 48 #include "net/log/net_log_with_source.h"
50 #include "net/quic/chromium/quic_server_info.h" 49 #include "net/quic/chromium/quic_server_info.h"
51 50
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 bypass_lock_for_test_(false), 336 bypass_lock_for_test_(false),
338 fail_conditionalization_for_test_(false), 337 fail_conditionalization_for_test_(false),
339 mode_(NORMAL), 338 mode_(NORMAL),
340 network_layer_(std::move(network_layer)), 339 network_layer_(std::move(network_layer)),
341 clock_(new base::DefaultClock()), 340 clock_(new base::DefaultClock()),
342 weak_factory_(this) { 341 weak_factory_(this) {
343 HttpNetworkSession* session = network_layer_->GetSession(); 342 HttpNetworkSession* session = network_layer_->GetSession();
344 // Session may be NULL in unittests. 343 // Session may be NULL in unittests.
345 // TODO(mmenke): Seems like tests could be changed to provide a session, 344 // TODO(mmenke): Seems like tests could be changed to provide a session,
346 // rather than having logic only used in unit tests here. 345 // rather than having logic only used in unit tests here.
347 if (!session) 346 if (session) {
348 return; 347 net_log_ = session->net_log();
349 348 if (is_main_cache &&
350 net_log_ = session->net_log(); 349 !session->quic_stream_factory()->has_quic_server_info_factory()) {
351 if (!is_main_cache) 350 // QuicStreamFactory takes ownership of QuicServerInfoFactoryAdaptor.
352 return; 351 session->quic_stream_factory()->set_quic_server_info_factory(
353 352 new QuicServerInfoFactoryAdaptor(this));
354 session->SetServerPushDelegate( 353 }
355 base::MakeUnique<HttpCacheLookupManager>(this));
356
357 if (!session->quic_stream_factory()->has_quic_server_info_factory()) {
358 // QuicStreamFactory takes ownership of QuicServerInfoFactoryAdaptor.
359 session->quic_stream_factory()->set_quic_server_info_factory(
360 new QuicServerInfoFactoryAdaptor(this));
361 } 354 }
362 } 355 }
363 356
364 HttpCache::~HttpCache() { 357 HttpCache::~HttpCache() {
365 // Transactions should see an invalid cache after this point; otherwise they 358 // Transactions should see an invalid cache after this point; otherwise they
366 // could see an inconsistent object (half destroyed). 359 // could see an inconsistent object (half destroyed).
367 weak_factory_.InvalidateWeakPtrs(); 360 weak_factory_.InvalidateWeakPtrs();
368 361
369 // If we have any active entries remaining, then we need to deactivate them. 362 // If we have any active entries remaining, then we need to deactivate them.
370 // We may have some pending calls to OnProcessPendingQueue, but since those 363 // We may have some pending calls to OnProcessPendingQueue, but since those
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 building_backend_ = false; 1195 building_backend_ = false;
1203 DeletePendingOp(pending_op); 1196 DeletePendingOp(pending_op);
1204 } 1197 }
1205 1198
1206 // The cache may be gone when we return from the callback. 1199 // The cache may be gone when we return from the callback.
1207 if (!item->DoCallback(result, disk_cache_.get())) 1200 if (!item->DoCallback(result, disk_cache_.get()))
1208 item->NotifyTransaction(result, NULL); 1201 item->NotifyTransaction(result, NULL);
1209 } 1202 }
1210 1203
1211 } // namespace net 1204 } // namespace net
OLDNEW
« no previous file with comments | « net/BUILD.gn ('k') | net/http/http_network_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698