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

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

Issue 10568005: Balance defers with Resume. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | 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/renderer_host/buffered_resource_handler.h" 5 #include "content/browser/renderer_host/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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 bool* defer) { 380 bool* defer) {
381 // Inform the original ResourceHandler that this will be handled entirely by 381 // Inform the original ResourceHandler that this will be handled entirely by
382 // the new ResourceHandler. 382 // the new ResourceHandler.
383 // TODO(darin): We should probably check the return values of these. 383 // TODO(darin): We should probably check the return values of these.
384 bool defer_ignored = false; 384 bool defer_ignored = false;
385 next_handler_->OnResponseStarted(request_id, response_, &defer_ignored); 385 next_handler_->OnResponseStarted(request_id, response_, &defer_ignored);
386 DCHECK(!defer_ignored); 386 DCHECK(!defer_ignored);
387 net::URLRequestStatus status(net::URLRequestStatus::HANDLED_EXTERNALLY, 0); 387 net::URLRequestStatus status(net::URLRequestStatus::HANDLED_EXTERNALLY, 0);
388 next_handler_->OnResponseCompleted(request_id, status, std::string()); 388 next_handler_->OnResponseCompleted(request_id, status, std::string());
389 389
390 // Remove the non-owning pointer to the CrossSiteResourceHandler, if any, 390 // Remove the non-owning pointer to the {Async,CrossSite}ResourceHandler, if
391 // from the extra request info because the CrossSiteResourceHandler (part of 391 // any, from the request info because the {Async,CrossSite}ResourceHandler
392 // the original ResourceHandler chain) will be deleted by the next statement. 392 // (part of the original ResourceHandler chain) will be deleted by the next
393 // statement.
393 ResourceRequestInfoImpl* info = 394 ResourceRequestInfoImpl* info =
394 ResourceRequestInfoImpl::ForRequest(request_); 395 ResourceRequestInfoImpl::ForRequest(request_);
395 info->set_cross_site_handler(NULL); 396 info->set_cross_site_handler(NULL);
397 info->set_async_handler(NULL);
396 398
397 // This is handled entirely within the new ResourceHandler, so just reset the 399 // This is handled entirely within the new ResourceHandler, so just reset the
398 // original ResourceHandler. 400 // original ResourceHandler.
399 next_handler_ = handler.Pass(); 401 next_handler_ = handler.Pass();
400 next_handler_->SetController(controller()); 402 next_handler_->SetController(controller());
401 403
402 next_handler_needs_response_started_ = true; 404 next_handler_needs_response_started_ = true;
403 next_handler_needs_will_read_ = true; 405 next_handler_needs_will_read_ = true;
404 406
405 return ForwardPendingEventsToNextHandler(request_id, defer); 407 return ForwardPendingEventsToNextHandler(request_id, defer);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 453
452 bool defer = false; 454 bool defer = false;
453 if (!CompleteResponseStarted(request_id, &defer)) { 455 if (!CompleteResponseStarted(request_id, &defer)) {
454 controller()->Cancel(); 456 controller()->Cancel();
455 } else if (!defer && needs_resume) { 457 } else if (!defer && needs_resume) {
456 controller()->Resume(); 458 controller()->Resume();
457 } 459 }
458 } 460 }
459 461
460 } // namespace content 462 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/async_resource_handler.cc ('k') | content/browser/renderer_host/cross_site_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698