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

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

Issue 2315443003: Stop sending serialized SSLStatus to the renderer. (Closed)
Patch Set: self review fix and merge fix Created 4 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
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 "content/browser/loader/mojo_async_resource_handler.h" 5 #include "content/browser/loader/mojo_async_resource_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 *available = std::min(*available, static_cast<uint32_t>(kMaxChunkSize)); 258 *available = std::min(*available, static_cast<uint32_t>(kMaxChunkSize));
259 return result; 259 return result;
260 } 260 }
261 261
262 MojoResult MojoAsyncResourceHandler::EndWrite(uint32_t written) { 262 MojoResult MojoAsyncResourceHandler::EndWrite(uint32_t written) {
263 return mojo::EndWriteDataRaw(shared_writer_->writer(), written); 263 return mojo::EndWriteDataRaw(shared_writer_->writer(), written);
264 } 264 }
265 265
266 void MojoAsyncResourceHandler::OnResponseCompleted( 266 void MojoAsyncResourceHandler::OnResponseCompleted(
267 const net::URLRequestStatus& status, 267 const net::URLRequestStatus& status,
268 const std::string& security_info,
269 bool* defer) { 268 bool* defer) {
270 shared_writer_ = nullptr; 269 shared_writer_ = nullptr;
271 buffer_ = nullptr; 270 buffer_ = nullptr;
272 handle_watcher_.Cancel(); 271 handle_watcher_.Cancel();
273 272
274 const ResourceRequestInfoImpl* info = GetRequestInfo(); 273 const ResourceRequestInfoImpl* info = GetRequestInfo();
275 274
276 // TODO(gavinp): Remove this CHECK when we figure out the cause of 275 // TODO(gavinp): Remove this CHECK when we figure out the cause of
277 // http://crbug.com/124680 . This check mirrors closely check in 276 // http://crbug.com/124680 . This check mirrors closely check in
278 // WebURLLoaderImpl::OnCompletedRequest that routes this message to a WebCore 277 // WebURLLoaderImpl::OnCompletedRequest that routes this message to a WebCore
279 // ResourceHandleInternal which asserts on its state and crashes. By crashing 278 // ResourceHandleInternal which asserts on its state and crashes. By crashing
280 // when the message is sent, we should get better crash reports. 279 // when the message is sent, we should get better crash reports.
281 CHECK(status.status() != net::URLRequestStatus::SUCCESS || 280 CHECK(status.status() != net::URLRequestStatus::SUCCESS ||
282 sent_received_response_message_); 281 sent_received_response_message_);
283 282
284 int error_code = status.error(); 283 int error_code = status.error();
285 bool was_ignored_by_handler = info->WasIgnoredByHandler(); 284 bool was_ignored_by_handler = info->WasIgnoredByHandler();
286 285
287 DCHECK_NE(status.status(), net::URLRequestStatus::IO_PENDING); 286 DCHECK_NE(status.status(), net::URLRequestStatus::IO_PENDING);
288 // If this check fails, then we're in an inconsistent state because all 287 // If this check fails, then we're in an inconsistent state because all
289 // requests ignored by the handler should be canceled (which should result in 288 // requests ignored by the handler should be canceled (which should result in
290 // the ERR_ABORTED error code). 289 // the ERR_ABORTED error code).
291 DCHECK(!was_ignored_by_handler || error_code == net::ERR_ABORTED); 290 DCHECK(!was_ignored_by_handler || error_code == net::ERR_ABORTED);
292 291
293 ResourceRequestCompletionStatus request_complete_data; 292 ResourceRequestCompletionStatus request_complete_data;
294 request_complete_data.error_code = error_code; 293 request_complete_data.error_code = error_code;
295 request_complete_data.was_ignored_by_handler = was_ignored_by_handler; 294 request_complete_data.was_ignored_by_handler = was_ignored_by_handler;
296 request_complete_data.exists_in_cache = request()->response_info().was_cached; 295 request_complete_data.exists_in_cache = request()->response_info().was_cached;
297 request_complete_data.security_info = security_info;
298 request_complete_data.completion_time = base::TimeTicks::Now(); 296 request_complete_data.completion_time = base::TimeTicks::Now();
299 request_complete_data.encoded_data_length = 297 request_complete_data.encoded_data_length =
300 request()->GetTotalReceivedBytes(); 298 request()->GetTotalReceivedBytes();
301 299
302 url_loader_client_->OnComplete(request_complete_data); 300 url_loader_client_->OnComplete(request_complete_data);
303 } 301 }
304 302
305 bool MojoAsyncResourceHandler::CopyReadDataToDataPipe(bool* defer) { 303 bool MojoAsyncResourceHandler::CopyReadDataToDataPipe(bool* defer) {
306 while (true) { 304 while (true) {
307 scoped_refptr<net::IOBufferWithSize> dest; 305 scoped_refptr<net::IOBufferWithSize> dest;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 389
392 controller()->CancelWithError(net::ERR_INSUFFICIENT_RESOURCES); 390 controller()->CancelWithError(net::ERR_INSUFFICIENT_RESOURCES);
393 return false; 391 return false;
394 } 392 }
395 393
396 void MojoAsyncResourceHandler::OnWritable(MojoResult unused) { 394 void MojoAsyncResourceHandler::OnWritable(MojoResult unused) {
397 Resume(); 395 Resume();
398 } 396 }
399 397
400 } // namespace content 398 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/mojo_async_resource_handler.h ('k') | content/browser/loader/mojo_async_resource_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698