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

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 // XXX Remove the non-owning pointer to the CrossSiteResourceHandler, if any,
jam 2012/06/19 06:03:34 ?
391 // from the extra request info because the CrossSiteResourceHandler (part of 391 // from the extra request info because the CrossSiteResourceHandler (part of
392 // the original ResourceHandler chain) will be deleted by the next statement. 392 // the original ResourceHandler chain) will be deleted by the next statement.
393 ResourceRequestInfoImpl* info = 393 ResourceRequestInfoImpl* info =
394 ResourceRequestInfoImpl::ForRequest(request_); 394 ResourceRequestInfoImpl::ForRequest(request_);
395 info->set_cross_site_handler(NULL); 395 info->set_cross_site_handler(NULL);
396 info->set_async_handler(NULL);
396 397
397 // This is handled entirely within the new ResourceHandler, so just reset the 398 // This is handled entirely within the new ResourceHandler, so just reset the
398 // original ResourceHandler. 399 // original ResourceHandler.
399 next_handler_ = handler.Pass(); 400 next_handler_ = handler.Pass();
400 next_handler_->SetController(controller()); 401 next_handler_->SetController(controller());
401 402
402 next_handler_needs_response_started_ = true; 403 next_handler_needs_response_started_ = true;
403 next_handler_needs_will_read_ = true; 404 next_handler_needs_will_read_ = true;
404 405
405 return ForwardPendingEventsToNextHandler(request_id, defer); 406 return ForwardPendingEventsToNextHandler(request_id, defer);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 452
452 bool defer = false; 453 bool defer = false;
453 if (!CompleteResponseStarted(request_id, &defer)) { 454 if (!CompleteResponseStarted(request_id, &defer)) {
454 controller()->Cancel(); 455 controller()->Cancel();
455 } else if (!defer && needs_resume) { 456 } else if (!defer && needs_resume) {
456 controller()->Resume(); 457 controller()->Resume();
457 } 458 }
458 } 459 }
459 460
460 } // namespace content 461 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698