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

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

Issue 2519473002: Fixes the cache lock issue. (Closed)
Patch Set: Initial patch Created 4 years 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_lookup_manager.h" 5 #include "net/http/http_cache_lookup_manager.h"
6 6
7 #include "net/base/load_flags.h" 7 #include "net/base/load_flags.h"
8 8
9 namespace net { 9 namespace net {
10 10
11 HttpCacheLookupManager::LookupTransaction::LookupTransaction( 11 HttpCacheLookupManager::LookupTransaction::LookupTransaction(
12 std::unique_ptr<ServerPushHelper> server_push_helper) 12 std::unique_ptr<ServerPushHelper> server_push_helper)
13 : push_helper_(std::move(server_push_helper)), 13 : push_helper_(std::move(server_push_helper)),
14 request_(new HttpRequestInfo()), 14 request_(new HttpRequestInfo()),
15 transaction_(nullptr) {} 15 transaction_(nullptr) {}
16 16
17 HttpCacheLookupManager::LookupTransaction::~LookupTransaction() {} 17 HttpCacheLookupManager::LookupTransaction::~LookupTransaction() {
18 transaction_->Orphan(std::move(transaction_));
19 }
18 20
19 int HttpCacheLookupManager::LookupTransaction::StartLookup( 21 int HttpCacheLookupManager::LookupTransaction::StartLookup(
20 HttpCache* cache, 22 HttpCache* cache,
21 const CompletionCallback& callback, 23 const CompletionCallback& callback,
22 const NetLogWithSource& net_log) { 24 const NetLogWithSource& net_log) {
23 request_->url = push_helper_->GetURL(); 25 request_->url = push_helper_->GetURL();
24 request_->method = "GET"; 26 request_->method = "GET";
25 request_->load_flags = LOAD_ONLY_FROM_CACHE | LOAD_SKIP_CACHE_VALIDATION; 27 request_->load_flags = LOAD_ONLY_FROM_CACHE | LOAD_SKIP_CACHE_VALIDATION;
26 cache->CreateTransaction(DEFAULT_PRIORITY, &transaction_); 28 cache->CreateTransaction(DEFAULT_PRIORITY, &transaction_);
27 return transaction_->Start(request_.get(), callback, net_log); 29 return transaction_->Start(request_.get(), callback, net_log);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 auto it = lookup_transactions_.find(url); 63 auto it = lookup_transactions_.find(url);
62 DCHECK(it != lookup_transactions_.end()); 64 DCHECK(it != lookup_transactions_.end());
63 65
64 if (rv == OK) 66 if (rv == OK)
65 it->second->CancelPush(); 67 it->second->CancelPush();
66 68
67 lookup_transactions_.erase(it); 69 lookup_transactions_.erase(it);
68 } 70 }
69 71
70 } // namespace net 72 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698