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

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

Issue 2692813002: Server push cancellation: add a finch trial parameter (Closed)
Patch Set: Spin the message loop to ensure the client receives the response Created 3 years, 8 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"
41 #include "net/http/http_cache_transaction.h" 42 #include "net/http/http_cache_transaction.h"
42 #include "net/http/http_network_layer.h" 43 #include "net/http/http_network_layer.h"
43 #include "net/http/http_network_session.h" 44 #include "net/http/http_network_session.h"
44 #include "net/http/http_request_info.h" 45 #include "net/http/http_request_info.h"
45 #include "net/http/http_response_headers.h" 46 #include "net/http/http_response_headers.h"
46 #include "net/http/http_response_info.h" 47 #include "net/http/http_response_info.h"
47 #include "net/http/http_util.h" 48 #include "net/http/http_util.h"
48 #include "net/log/net_log_with_source.h" 49 #include "net/log/net_log_with_source.h"
49 #include "net/quic/chromium/quic_server_info.h" 50 #include "net/quic/chromium/quic_server_info.h"
50 51
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 bypass_lock_for_test_(false), 337 bypass_lock_for_test_(false),
337 fail_conditionalization_for_test_(false), 338 fail_conditionalization_for_test_(false),
338 mode_(NORMAL), 339 mode_(NORMAL),
339 network_layer_(std::move(network_layer)), 340 network_layer_(std::move(network_layer)),
340 clock_(new base::DefaultClock()), 341 clock_(new base::DefaultClock()),
341 weak_factory_(this) { 342 weak_factory_(this) {
342 HttpNetworkSession* session = network_layer_->GetSession(); 343 HttpNetworkSession* session = network_layer_->GetSession();
343 // Session may be NULL in unittests. 344 // Session may be NULL in unittests.
344 // TODO(mmenke): Seems like tests could be changed to provide a session, 345 // TODO(mmenke): Seems like tests could be changed to provide a session,
345 // rather than having logic only used in unit tests here. 346 // rather than having logic only used in unit tests here.
346 if (session) { 347 if (!session)
347 net_log_ = session->net_log(); 348 return;
348 if (is_main_cache && 349
349 !session->quic_stream_factory()->has_quic_server_info_factory()) { 350 net_log_ = session->net_log();
350 // QuicStreamFactory takes ownership of QuicServerInfoFactoryAdaptor. 351 if (!is_main_cache)
351 session->quic_stream_factory()->set_quic_server_info_factory( 352 return;
352 new QuicServerInfoFactoryAdaptor(this)); 353
353 } 354 session->SetServerPushDelegate(
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));
354 } 361 }
355 } 362 }
356 363
357 HttpCache::~HttpCache() { 364 HttpCache::~HttpCache() {
358 // Transactions should see an invalid cache after this point; otherwise they 365 // Transactions should see an invalid cache after this point; otherwise they
359 // could see an inconsistent object (half destroyed). 366 // could see an inconsistent object (half destroyed).
360 weak_factory_.InvalidateWeakPtrs(); 367 weak_factory_.InvalidateWeakPtrs();
361 368
362 // If we have any active entries remaining, then we need to deactivate them. 369 // If we have any active entries remaining, then we need to deactivate them.
363 // We may have some pending calls to OnProcessPendingQueue, but since those 370 // We may have some pending calls to OnProcessPendingQueue, but since those
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 building_backend_ = false; 1203 building_backend_ = false;
1197 DeletePendingOp(pending_op); 1204 DeletePendingOp(pending_op);
1198 } 1205 }
1199 1206
1200 // The cache may be gone when we return from the callback. 1207 // The cache may be gone when we return from the callback.
1201 if (!item->DoCallback(result, disk_cache_.get())) 1208 if (!item->DoCallback(result, disk_cache_.get()))
1202 item->NotifyTransaction(result, NULL); 1209 item->NotifyTransaction(result, NULL);
1203 } 1210 }
1204 1211
1205 } // namespace net 1212 } // 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