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

Side by Side Diff: content/browser/loader/navigation_resource_handler.cc

Issue 2368913002: Fix stream errors that occur after a stream starts not propagating. (Closed)
Patch Set: review comments Created 4 years, 2 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
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 "content/browser/loader/navigation_resource_handler.h" 5 #include "content/browser/loader/navigation_resource_handler.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/browser/loader/navigation_url_loader_impl_core.h" 10 #include "content/browser/loader/navigation_url_loader_impl_core.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 bool NavigationResourceHandler::OnReadCompleted(int bytes_read, bool* defer) { 157 bool NavigationResourceHandler::OnReadCompleted(int bytes_read, bool* defer) {
158 writer_.OnReadCompleted(bytes_read, defer); 158 writer_.OnReadCompleted(bytes_read, defer);
159 return true; 159 return true;
160 } 160 }
161 161
162 void NavigationResourceHandler::OnResponseCompleted( 162 void NavigationResourceHandler::OnResponseCompleted(
163 const net::URLRequestStatus& status, 163 const net::URLRequestStatus& status,
164 bool* defer) { 164 bool* defer) {
165 // If the request has already committed, close the stream and leave it as-is. 165 // If the request has already committed, close the stream and leave it as-is.
166 //
167 // TODO(davidben): The net error code should be passed through StreamWriter
168 // down to the stream's consumer. See https://crbug.com/426162.
169 if (writer_.stream()) { 166 if (writer_.stream()) {
170 writer_.Finalize(); 167 writer_.Finalize(status.error());
171 return; 168 return;
172 } 169 }
173 170
174 if (core_) { 171 if (core_) {
175 DCHECK_NE(net::OK, status.error()); 172 DCHECK_NE(net::OK, status.error());
176 core_->NotifyRequestFailed(request()->response_info().was_cached, 173 core_->NotifyRequestFailed(request()->response_info().was_cached,
177 status.error()); 174 status.error());
178 DetachFromCore(); 175 DetachFromCore();
179 } 176 }
180 } 177 }
181 178
182 void NavigationResourceHandler::OnDataDownloaded(int bytes_downloaded) { 179 void NavigationResourceHandler::OnDataDownloaded(int bytes_downloaded) {
183 NOTREACHED(); 180 NOTREACHED();
184 } 181 }
185 182
186 void NavigationResourceHandler::DetachFromCore() { 183 void NavigationResourceHandler::DetachFromCore() {
187 DCHECK(core_); 184 DCHECK(core_);
188 core_->set_resource_handler(nullptr); 185 core_->set_resource_handler(nullptr);
189 core_ = nullptr; 186 core_ = nullptr;
190 } 187 }
191 188
192 } // namespace content 189 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/fileapi_message_filter.cc ('k') | content/browser/loader/stream_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698