Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 // sample values). | 189 // sample values). |
| 190 std::vector<int> GetAllNetErrorCodes() { | 190 std::vector<int> GetAllNetErrorCodes() { |
| 191 std::vector<int> all_error_codes; | 191 std::vector<int> all_error_codes; |
| 192 #define NET_ERROR(label, value) all_error_codes.push_back(-(value)); | 192 #define NET_ERROR(label, value) all_error_codes.push_back(-(value)); |
| 193 #include "net/base/net_error_list.h" | 193 #include "net/base/net_error_list.h" |
| 194 #undef NET_ERROR | 194 #undef NET_ERROR |
| 195 return all_error_codes; | 195 return all_error_codes; |
| 196 } | 196 } |
| 197 | 197 |
| 198 #if defined(OS_WIN) | 198 #if defined(OS_WIN) |
| 199 #pragma warning (disable: 4748) | 199 #pragma warning(disable: 4748) |
| 200 #pragma optimize( "", off ) | 200 #pragma optimize("", off) |
| 201 #endif | 201 #endif |
| 202 | 202 |
| 203 #if defined(OS_WIN) | 203 #if defined(OS_WIN) |
| 204 #pragma optimize( "", on ) | 204 #pragma optimize("", on) |
| 205 #pragma warning (default: 4748) | 205 #pragma warning(default: 4748) |
| 206 #endif | 206 #endif |
| 207 | 207 |
| 208 } // namespace | 208 } // namespace |
| 209 | 209 |
| 210 ResourceDispatcherHost::ResourceDispatcherHost() | 210 ResourceDispatcherHost::ResourceDispatcherHost() |
| 211 : ALLOW_THIS_IN_INITIALIZER_LIST( | 211 : ALLOW_THIS_IN_INITIALIZER_LIST( |
| 212 download_file_manager_(new DownloadFileManager(this))), | 212 download_file_manager_(new DownloadFileManager(this))), |
| 213 download_request_limiter_(new DownloadRequestLimiter()), | 213 download_request_limiter_(new DownloadRequestLimiter()), |
| 214 ALLOW_THIS_IN_INITIALIZER_LIST( | 214 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 215 save_file_manager_(new SaveFileManager(this))), | 215 save_file_manager_(new SaveFileManager(this))), |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 511 request_data.resource_type, | 511 request_data.resource_type, |
| 512 upload_size, | 512 upload_size, |
| 513 false, // is download | 513 false, // is download |
| 514 ResourceType::IsFrame(request_data.resource_type), // allow_download | 514 ResourceType::IsFrame(request_data.resource_type), // allow_download |
| 515 request_data.has_user_gesture, | 515 request_data.has_user_gesture, |
| 516 request_data.host_renderer_id, | 516 request_data.host_renderer_id, |
| 517 request_data.host_render_view_id); | 517 request_data.host_render_view_id); |
| 518 ApplyExtensionLocalizationFilter(request_data.url, request_data.resource_type, | 518 ApplyExtensionLocalizationFilter(request_data.url, request_data.resource_type, |
| 519 extra_info); | 519 extra_info); |
| 520 SetRequestInfo(request, extra_info); // Request takes ownership. | 520 SetRequestInfo(request, extra_info); // Request takes ownership. |
| 521 chrome_browser_net::SetOriginProcessUniqueIDForRequest( | 521 chrome_browser_net::SetOriginProcessIDForRequest( |
| 522 request_data.origin_child_id, request); | 522 request_data.origin_pid, request); |
| 523 | 523 |
| 524 if (request->url().SchemeIs(chrome::kBlobScheme) && context) { | 524 if (request->url().SchemeIs(chrome::kBlobScheme) && context) { |
| 525 // Hang on to a reference to ensure the blob is not released prior | 525 // Hang on to a reference to ensure the blob is not released prior |
| 526 // to the job being started. | 526 // to the job being started. |
| 527 webkit_blob::BlobStorageController* controller = | 527 webkit_blob::BlobStorageController* controller = |
| 528 context->blob_storage_context()->controller(); | 528 context->blob_storage_context()->controller(); |
| 529 extra_info->set_requested_blob_data( | 529 extra_info->set_requested_blob_data( |
| 530 controller->GetBlobDataFromUrl(request->url())); | 530 controller->GetBlobDataFromUrl(request->url())); |
| 531 } | 531 } |
| 532 | 532 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 726 request->set_method("GET"); | 726 request->set_method("GET"); |
| 727 request->set_referrer(CommandLine::ForCurrentProcess()->HasSwitch( | 727 request->set_referrer(CommandLine::ForCurrentProcess()->HasSwitch( |
| 728 switches::kNoReferrers) ? std::string() : referrer.spec()); | 728 switches::kNoReferrers) ? std::string() : referrer.spec()); |
| 729 request->set_context(request_context); | 729 request->set_context(request_context); |
| 730 request->set_load_flags(request->load_flags() | | 730 request->set_load_flags(request->load_flags() | |
| 731 net::LOAD_IS_DOWNLOAD); | 731 net::LOAD_IS_DOWNLOAD); |
| 732 | 732 |
| 733 ResourceDispatcherHostRequestInfo* extra_info = | 733 ResourceDispatcherHostRequestInfo* extra_info = |
| 734 CreateRequestInfoForBrowserRequest(handler, child_id, route_id, true); | 734 CreateRequestInfoForBrowserRequest(handler, child_id, route_id, true); |
| 735 SetRequestInfo(request, extra_info); // Request takes ownership. | 735 SetRequestInfo(request, extra_info); // Request takes ownership. |
| 736 chrome_browser_net::SetOriginProcessUniqueIDForRequest(child_id, request); | |
|
jam
2011/02/03 22:58:07
why take this out?
| |
| 737 | 736 |
| 738 BeginRequestInternal(request); | 737 BeginRequestInternal(request); |
| 739 } | 738 } |
| 740 | 739 |
| 741 // This function is only used for saving feature. | 740 // This function is only used for saving feature. |
| 742 void ResourceDispatcherHost::BeginSaveFile( | 741 void ResourceDispatcherHost::BeginSaveFile( |
| 743 const GURL& url, | 742 const GURL& url, |
| 744 const GURL& referrer, | 743 const GURL& referrer, |
| 745 int child_id, | 744 int child_id, |
| 746 int route_id, | 745 int route_id, |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 774 switches::kNoReferrers) ? std::string() : referrer.spec()); | 773 switches::kNoReferrers) ? std::string() : referrer.spec()); |
| 775 // So far, for saving page, we need fetch content from cache, in the | 774 // So far, for saving page, we need fetch content from cache, in the |
| 776 // future, maybe we can use a configuration to configure this behavior. | 775 // future, maybe we can use a configuration to configure this behavior. |
| 777 request->set_load_flags(net::LOAD_PREFERRING_CACHE); | 776 request->set_load_flags(net::LOAD_PREFERRING_CACHE); |
| 778 request->set_context(request_context); | 777 request->set_context(request_context); |
| 779 | 778 |
| 780 // Since we're just saving some resources we need, disallow downloading. | 779 // Since we're just saving some resources we need, disallow downloading. |
| 781 ResourceDispatcherHostRequestInfo* extra_info = | 780 ResourceDispatcherHostRequestInfo* extra_info = |
| 782 CreateRequestInfoForBrowserRequest(handler, child_id, route_id, false); | 781 CreateRequestInfoForBrowserRequest(handler, child_id, route_id, false); |
| 783 SetRequestInfo(request, extra_info); // Request takes ownership. | 782 SetRequestInfo(request, extra_info); // Request takes ownership. |
| 784 chrome_browser_net::SetOriginProcessUniqueIDForRequest(child_id, request); | |
|
jam
2011/02/03 22:58:07
ditto
| |
| 785 | 783 |
| 786 BeginRequestInternal(request); | 784 BeginRequestInternal(request); |
| 787 } | 785 } |
| 788 | 786 |
| 789 void ResourceDispatcherHost::FollowDeferredRedirect( | 787 void ResourceDispatcherHost::FollowDeferredRedirect( |
| 790 int child_id, | 788 int child_id, |
| 791 int request_id, | 789 int request_id, |
| 792 bool has_new_first_party_for_cookies, | 790 bool has_new_first_party_for_cookies, |
| 793 const GURL& new_first_party_for_cookies) { | 791 const GURL& new_first_party_for_cookies) { |
| 794 PendingRequestList::iterator i = pending_requests_.find( | 792 PendingRequestList::iterator i = pending_requests_.find( |
| (...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1937 return is_prefetch_enabled_; | 1935 return is_prefetch_enabled_; |
| 1938 } | 1936 } |
| 1939 | 1937 |
| 1940 // static | 1938 // static |
| 1941 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 1939 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
| 1942 is_prefetch_enabled_ = value; | 1940 is_prefetch_enabled_ = value; |
| 1943 } | 1941 } |
| 1944 | 1942 |
| 1945 // static | 1943 // static |
| 1946 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 1944 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
| OLD | NEW |