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

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

Issue 2681953002: Rename set_up_quic_server_info_factory to is_main_cache (Closed)
Patch Set: Created 3 years, 10 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/http/http_cache.h ('k') | net/http/mock_http_cache.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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 http_cache_); 288 http_cache_);
289 } 289 }
290 290
291 private: 291 private:
292 HttpCache* const http_cache_; 292 HttpCache* const http_cache_;
293 }; 293 };
294 294
295 //----------------------------------------------------------------------------- 295 //-----------------------------------------------------------------------------
296 HttpCache::HttpCache(HttpNetworkSession* session, 296 HttpCache::HttpCache(HttpNetworkSession* session,
297 std::unique_ptr<BackendFactory> backend_factory, 297 std::unique_ptr<BackendFactory> backend_factory,
298 bool set_up_quic_server_info) 298 bool is_main_cache)
299 : HttpCache(base::MakeUnique<HttpNetworkLayer>(session), 299 : HttpCache(base::MakeUnique<HttpNetworkLayer>(session),
300 std::move(backend_factory), 300 std::move(backend_factory),
301 set_up_quic_server_info) {} 301 is_main_cache) {}
302 302
303 HttpCache::HttpCache(std::unique_ptr<HttpTransactionFactory> network_layer, 303 HttpCache::HttpCache(std::unique_ptr<HttpTransactionFactory> network_layer,
304 std::unique_ptr<BackendFactory> backend_factory, 304 std::unique_ptr<BackendFactory> backend_factory,
305 bool set_up_quic_server_info) 305 bool is_main_cache)
306 : net_log_(nullptr), 306 : net_log_(nullptr),
307 backend_factory_(std::move(backend_factory)), 307 backend_factory_(std::move(backend_factory)),
308 building_backend_(false), 308 building_backend_(false),
309 bypass_lock_for_test_(false), 309 bypass_lock_for_test_(false),
310 fail_conditionalization_for_test_(false), 310 fail_conditionalization_for_test_(false),
311 mode_(NORMAL), 311 mode_(NORMAL),
312 network_layer_(std::move(network_layer)), 312 network_layer_(std::move(network_layer)),
313 clock_(new base::DefaultClock()), 313 clock_(new base::DefaultClock()),
314 weak_factory_(this) { 314 weak_factory_(this) {
315 HttpNetworkSession* session = network_layer_->GetSession(); 315 HttpNetworkSession* session = network_layer_->GetSession();
316 // Session may be NULL in unittests. 316 // Session may be NULL in unittests.
317 // TODO(mmenke): Seems like tests could be changed to provide a session, 317 // TODO(mmenke): Seems like tests could be changed to provide a session,
318 // rather than having logic only used in unit tests here. 318 // rather than having logic only used in unit tests here.
319 if (session) { 319 if (session) {
320 net_log_ = session->net_log(); 320 net_log_ = session->net_log();
321 if (set_up_quic_server_info && 321 if (is_main_cache &&
322 !session->quic_stream_factory()->has_quic_server_info_factory()) { 322 !session->quic_stream_factory()->has_quic_server_info_factory()) {
323 // QuicStreamFactory takes ownership of QuicServerInfoFactoryAdaptor. 323 // QuicStreamFactory takes ownership of QuicServerInfoFactoryAdaptor.
324 session->quic_stream_factory()->set_quic_server_info_factory( 324 session->quic_stream_factory()->set_quic_server_info_factory(
325 new QuicServerInfoFactoryAdaptor(this)); 325 new QuicServerInfoFactoryAdaptor(this));
326 } 326 }
327 } 327 }
328 } 328 }
329 329
330 HttpCache::~HttpCache() { 330 HttpCache::~HttpCache() {
331 // Transactions should see an invalid cache after this point; otherwise they 331 // Transactions should see an invalid cache after this point; otherwise they
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 building_backend_ = false; 1154 building_backend_ = false;
1155 DeletePendingOp(pending_op); 1155 DeletePendingOp(pending_op);
1156 } 1156 }
1157 1157
1158 // The cache may be gone when we return from the callback. 1158 // The cache may be gone when we return from the callback.
1159 if (!item->DoCallback(result, disk_cache_.get())) 1159 if (!item->DoCallback(result, disk_cache_.get()))
1160 item->NotifyTransaction(result, NULL); 1160 item->NotifyTransaction(result, NULL);
1161 } 1161 }
1162 1162
1163 } // namespace net 1163 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_cache.h ('k') | net/http/mock_http_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698