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

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

Issue 11571025: Initial CL for Downloads resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated Pawel's comment. Created 7 years, 11 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 491 }
492 492
493 net::Error ResourceDispatcherHostImpl::BeginDownload( 493 net::Error ResourceDispatcherHostImpl::BeginDownload(
494 scoped_ptr<net::URLRequest> request, 494 scoped_ptr<net::URLRequest> request,
495 bool is_content_initiated, 495 bool is_content_initiated,
496 ResourceContext* context, 496 ResourceContext* context,
497 int child_id, 497 int child_id,
498 int route_id, 498 int route_id,
499 bool prefer_cache, 499 bool prefer_cache,
500 scoped_ptr<DownloadSaveInfo> save_info, 500 scoped_ptr<DownloadSaveInfo> save_info,
501 content::DownloadId download_id,
501 const DownloadStartedCallback& started_callback) { 502 const DownloadStartedCallback& started_callback) {
502 if (is_shutdown_) 503 if (is_shutdown_)
503 return CallbackAndReturn(started_callback, net::ERR_INSUFFICIENT_RESOURCES); 504 return CallbackAndReturn(started_callback, net::ERR_INSUFFICIENT_RESOURCES);
504 505
505 const GURL& url = request->original_url(); 506 const GURL& url = request->original_url();
506 507
507 // http://crbug.com/90971 508 // http://crbug.com/90971
508 char url_buf[128]; 509 char url_buf[128];
509 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf)); 510 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf));
510 base::debug::Alias(url_buf); 511 base::debug::Alias(url_buf);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 } 544 }
544 545
545 ResourceRequestInfoImpl* extra_info = 546 ResourceRequestInfoImpl* extra_info =
546 CreateRequestInfo(child_id, route_id, true, context); 547 CreateRequestInfo(child_id, route_id, true, context);
547 extra_info->AssociateWithRequest(request.get()); // Request takes ownership. 548 extra_info->AssociateWithRequest(request.get()); // Request takes ownership.
548 549
549 // From this point forward, the |DownloadResourceHandler| is responsible for 550 // From this point forward, the |DownloadResourceHandler| is responsible for
550 // |started_callback|. 551 // |started_callback|.
551 scoped_ptr<ResourceHandler> handler( 552 scoped_ptr<ResourceHandler> handler(
552 CreateResourceHandlerForDownload(request.get(), is_content_initiated, 553 CreateResourceHandlerForDownload(request.get(), is_content_initiated,
553 true, save_info.Pass(), 554 true, download_id, save_info.Pass(),
554 started_callback)); 555 started_callback));
555 556
556 BeginRequestInternal(request.Pass(), handler.Pass()); 557 BeginRequestInternal(request.Pass(), handler.Pass());
557 558
558 return net::OK; 559 return net::OK;
559 } 560 }
560 561
561 void ResourceDispatcherHostImpl::ClearLoginDelegateForRequest( 562 void ResourceDispatcherHostImpl::ClearLoginDelegateForRequest(
562 net::URLRequest* request) { 563 net::URLRequest* request) {
563 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); 564 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request);
(...skipping 10 matching lines...) Expand all
574 FROM_HERE, 575 FROM_HERE,
575 base::Bind(&ResourceDispatcherHostImpl::OnShutdown, 576 base::Bind(&ResourceDispatcherHostImpl::OnShutdown,
576 base::Unretained(this))); 577 base::Unretained(this)));
577 } 578 }
578 579
579 scoped_ptr<ResourceHandler> 580 scoped_ptr<ResourceHandler>
580 ResourceDispatcherHostImpl::CreateResourceHandlerForDownload( 581 ResourceDispatcherHostImpl::CreateResourceHandlerForDownload(
581 net::URLRequest* request, 582 net::URLRequest* request,
582 bool is_content_initiated, 583 bool is_content_initiated,
583 bool must_download, 584 bool must_download,
585 DownloadId id,
584 scoped_ptr<DownloadSaveInfo> save_info, 586 scoped_ptr<DownloadSaveInfo> save_info,
585 const DownloadResourceHandler::OnStartedCallback& started_cb) { 587 const DownloadResourceHandler::OnStartedCallback& started_cb) {
586 scoped_ptr<ResourceHandler> handler( 588 scoped_ptr<ResourceHandler> handler(
587 new DownloadResourceHandler(request, started_cb, save_info.Pass())); 589 new DownloadResourceHandler(id, request, started_cb, save_info.Pass()));
588 if (delegate_) { 590 if (delegate_) {
589 const ResourceRequestInfo* request_info( 591 const ResourceRequestInfo* request_info(
590 ResourceRequestInfo::ForRequest(request)); 592 ResourceRequestInfo::ForRequest(request));
591 593
592 ScopedVector<ResourceThrottle> throttles; 594 ScopedVector<ResourceThrottle> throttles;
593 delegate_->DownloadStarting( 595 delegate_->DownloadStarting(
594 request, request_info->GetContext(), request_info->GetChildID(), 596 request, request_info->GetContext(), request_info->GetChildID(),
595 request_info->GetRouteID(), request_info->GetRequestID(), 597 request_info->GetRouteID(), request_info->GetRequestID(),
596 is_content_initiated, must_download, &throttles); 598 is_content_initiated, must_download, &throttles);
597 if (!throttles.empty()) { 599 if (!throttles.empty()) {
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 1725
1724 return i->second.get(); 1726 return i->second.get();
1725 } 1727 }
1726 1728
1727 ResourceLoader* ResourceDispatcherHostImpl::GetLoader(int child_id, 1729 ResourceLoader* ResourceDispatcherHostImpl::GetLoader(int child_id,
1728 int request_id) const { 1730 int request_id) const {
1729 return GetLoader(GlobalRequestID(child_id, request_id)); 1731 return GetLoader(GlobalRequestID(child_id, request_id));
1730 } 1732 }
1731 1733
1732 } // namespace content 1734 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.h ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698