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

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

Issue 267563004: Avoid issuing a Read() after draining a request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add reliable repro of crash. Created 6 years, 7 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 | Annotate | Revision Log
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 "content/browser/loader/buffered_resource_handler.h" 5 #include "content/browser/loader/buffered_resource_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 request()->url(), GURL(), response_->head.mime_type, allow_wildcard, 452 request()->url(), GURL(), response_->head.mime_type, allow_wildcard,
453 stale, &plugin, NULL); 453 stale, &plugin, NULL);
454 #else 454 #else
455 if (stale) 455 if (stale)
456 *stale = false; 456 *stale = false;
457 return false; 457 return false;
458 #endif 458 #endif
459 } 459 }
460 460
461 bool BufferedResourceHandler::CopyReadBufferToNextHandler(int request_id) { 461 bool BufferedResourceHandler::CopyReadBufferToNextHandler(int request_id) {
462 if (!bytes_read_) 462 if (!read_buffer_.get())
463 return true; 463 return true;
464 464
465 scoped_refptr<net::IOBuffer> buf; 465 scoped_refptr<net::IOBuffer> buf;
466 int buf_len = 0; 466 int buf_len = 0;
467 if (!next_handler_->OnWillRead(request_id, &buf, &buf_len, bytes_read_)) 467 if (!next_handler_->OnWillRead(request_id, &buf, &buf_len, bytes_read_))
468 return false; 468 return false;
469 469
470 CHECK((buf_len >= bytes_read_) && (bytes_read_ >= 0)); 470 CHECK((buf_len >= bytes_read_) && (bytes_read_ >= 0));
471 memcpy(buf->data(), read_buffer_->data(), bytes_read_); 471 memcpy(buf->data(), read_buffer_->data(), bytes_read_);
472 return true; 472 return true;
473 } 473 }
474 474
475 void BufferedResourceHandler::OnPluginsLoaded( 475 void BufferedResourceHandler::OnPluginsLoaded(
476 const std::vector<WebPluginInfo>& plugins) { 476 const std::vector<WebPluginInfo>& plugins) {
477 request()->LogUnblocked(); 477 request()->LogUnblocked();
478 bool defer = false; 478 bool defer = false;
479 if (!ProcessResponse(&defer)) { 479 if (!ProcessResponse(&defer)) {
480 controller()->Cancel(); 480 controller()->Cancel();
481 } else if (!defer) { 481 } else if (!defer) {
482 controller()->Resume(); 482 controller()->Resume();
483 } 483 }
484 } 484 }
485 485
486 } // namespace content 486 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698