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

Side by Side Diff: net/base/sdch_dictionary_fetcher.cc

Issue 599143002: Switch DCHECK() guarding against URLRequest::Read() failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@DoLoopSpin
Patch Set: Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/base/sdch_dictionary_fetcher.h" 5 #include "net/base/sdch_dictionary_fetcher.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 return OK; 197 return OK;
198 } 198 }
199 199
200 next_state_ = STATE_REQUEST_READING; 200 next_state_ = STATE_REQUEST_READING;
201 int bytes_read = 0; 201 int bytes_read = 0;
202 if (!current_request_->Read(buffer_.get(), kBufferSize, &bytes_read)) { 202 if (!current_request_->Read(buffer_.get(), kBufferSize, &bytes_read)) {
203 if (current_request_->status().is_io_pending()) 203 if (current_request_->status().is_io_pending())
204 return ERR_IO_PENDING; 204 return ERR_IO_PENDING;
205 205
206 DCHECK_NE(current_request_->status().error(), OK);
207 if (current_request_->status().error() == OK) { 206 if (current_request_->status().error() == OK) {
208 // This "should never happen", but if it does the result will be 207 // This "should never happen", but if it does the result will be
209 // an infinite loop. It's not clear how to handle a read failure 208 // an infinite loop. It's not clear how to handle a read failure
210 // without a promise to invoke the callback at some point in the future, 209 // without a promise to invoke the callback at some point in the future,
211 // so the request is failed. 210 // so the request is failed.
212 SdchManager::SdchErrorRecovery(SdchManager::DICTIONARY_FETCH_READ_FAILED); 211 SdchManager::SdchErrorRecovery(SdchManager::DICTIONARY_FETCH_READ_FAILED);
212 DLOG(FATAL) <<
213 "URLRequest::Read() returned false without IO pending or error!";
213 return ERR_FAILED; 214 return ERR_FAILED;
214 } 215 }
215 216
216 return current_request_->status().error(); 217 return current_request_->status().error();
217 } 218 }
218 219
219 if (bytes_read != 0) 220 if (bytes_read != 0)
220 dictionary_.append(buffer_->data(), bytes_read); 221 dictionary_.append(buffer_->data(), bytes_read);
221 else 222 else
222 next_state_ = STATE_REQUEST_COMPLETE; 223 next_state_ = STATE_REQUEST_COMPLETE;
(...skipping 11 matching lines...) Expand all
234 current_request_.reset(); 235 current_request_.reset();
235 buffer_ = NULL; 236 buffer_ = NULL;
236 dictionary_.clear(); 237 dictionary_.clear();
237 238
238 next_state_ = STATE_IDLE; 239 next_state_ = STATE_IDLE;
239 240
240 return OK; 241 return OK;
241 } 242 }
242 243
243 } // namespace net 244 } // 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