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

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

Issue 2946633002: Check the validity of cache_ weak ptr in DoFinishHeaders (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | no next file » | 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_transaction.h" 5 #include "net/http/http_cache_transaction.h"
6 6
7 #include "build/build_config.h" // For OS_POSIX 7 #include "build/build_config.h" // For OS_POSIX
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 1815 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 1826
1827 entry_ = nullptr; 1827 entry_ = nullptr;
1828 if (network_trans_) 1828 if (network_trans_)
1829 network_trans_.reset(); 1829 network_trans_.reset();
1830 1830
1831 TransitionToState(STATE_GET_BACKEND); 1831 TransitionToState(STATE_GET_BACKEND);
1832 return OK; 1832 return OK;
1833 } 1833 }
1834 1834
1835 int HttpCache::Transaction::DoFinishHeaders(int result) { 1835 int HttpCache::Transaction::DoFinishHeaders(int result) {
1836 if (!entry_ || result != OK) { 1836 if (!cache_.get() || !entry_ || result != OK) {
1837 TransitionToState(STATE_NONE); 1837 TransitionToState(STATE_NONE);
1838 return result; 1838 return result;
1839 } 1839 }
1840 1840
1841 TransitionToState(STATE_FINISH_HEADERS_COMPLETE); 1841 TransitionToState(STATE_FINISH_HEADERS_COMPLETE);
1842 1842
1843 // If it was an auth failure or 416, this transaction should continue to be 1843 // If it was an auth failure or 416, this transaction should continue to be
1844 // headers_transaction till consumer takes an action, so no need to do 1844 // headers_transaction till consumer takes an action, so no need to do
1845 // anything now. 1845 // anything now.
1846 if (auth_response_.headers.get() || 1846 if (auth_response_.headers.get() ||
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
3130 } 3130 }
3131 3131
3132 void HttpCache::Transaction::TransitionToState(State state) { 3132 void HttpCache::Transaction::TransitionToState(State state) {
3133 // Ensure that the state is only set once per Do* state. 3133 // Ensure that the state is only set once per Do* state.
3134 DCHECK(in_do_loop_); 3134 DCHECK(in_do_loop_);
3135 DCHECK_EQ(STATE_UNSET, next_state_) << "Next state is " << state; 3135 DCHECK_EQ(STATE_UNSET, next_state_) << "Next state is " << state;
3136 next_state_ = state; 3136 next_state_ = state;
3137 } 3137 }
3138 3138
3139 } // namespace net 3139 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698