OLD | NEW |
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 <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #include "content/common/view_messages.h" | 60 #include "content/common/view_messages.h" |
61 #include "content/public/browser/browser_thread.h" | 61 #include "content/public/browser/browser_thread.h" |
62 #include "content/public/browser/content_browser_client.h" | 62 #include "content/public/browser/content_browser_client.h" |
63 #include "content/public/browser/download_manager.h" | 63 #include "content/public/browser/download_manager.h" |
64 #include "content/public/browser/download_url_parameters.h" | 64 #include "content/public/browser/download_url_parameters.h" |
65 #include "content/public/browser/global_request_id.h" | 65 #include "content/public/browser/global_request_id.h" |
66 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 66 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
67 #include "content/public/browser/resource_request_details.h" | 67 #include "content/public/browser/resource_request_details.h" |
68 #include "content/public/browser/resource_throttle.h" | 68 #include "content/public/browser/resource_throttle.h" |
69 #include "content/public/browser/stream_handle.h" | 69 #include "content/public/browser/stream_handle.h" |
| 70 #include "content/public/browser/stream_info.h" |
70 #include "content/public/browser/user_metrics.h" | 71 #include "content/public/browser/user_metrics.h" |
71 #include "content/public/common/content_switches.h" | 72 #include "content/public/common/content_switches.h" |
72 #include "content/public/common/process_type.h" | 73 #include "content/public/common/process_type.h" |
73 #include "ipc/ipc_message_macros.h" | 74 #include "ipc/ipc_message_macros.h" |
74 #include "ipc/ipc_message_start.h" | 75 #include "ipc/ipc_message_start.h" |
75 #include "net/base/auth.h" | 76 #include "net/base/auth.h" |
76 #include "net/base/load_flags.h" | 77 #include "net/base/load_flags.h" |
77 #include "net/base/mime_util.h" | 78 #include "net/base/mime_util.h" |
78 #include "net/base/net_errors.h" | 79 #include "net/base/net_errors.h" |
79 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 80 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 | 731 |
731 StreamContext* stream_context = | 732 StreamContext* stream_context = |
732 GetStreamContextForResourceContext(info->GetContext()); | 733 GetStreamContextForResourceContext(info->GetContext()); |
733 | 734 |
734 scoped_ptr<StreamResourceHandler> handler( | 735 scoped_ptr<StreamResourceHandler> handler( |
735 new StreamResourceHandler(request, | 736 new StreamResourceHandler(request, |
736 stream_context->registry(), | 737 stream_context->registry(), |
737 origin)); | 738 origin)); |
738 | 739 |
739 info->set_is_stream(true); | 740 info->set_is_stream(true); |
740 delegate_->OnStreamCreated( | 741 scoped_ptr<StreamInfo> stream_info(new StreamInfo); |
741 request, | 742 stream_info->handle = handler->stream()->CreateHandle(); |
742 handler->stream()->CreateHandle( | 743 stream_info->original_url = request->url(); |
743 request->url(), | 744 stream_info->mime_type = mime_type; |
744 mime_type, | 745 // Make a copy of the response headers so it is safe to pass across threads; |
745 response->head.headers)); | 746 // the old handler (AsyncResourceHandler) may modify it in parallel via the |
| 747 // ResourceDispatcherHostDelegate. |
| 748 stream_info->response_headers = |
| 749 new net::HttpResponseHeaders(response->head.headers->raw_headers()); |
| 750 delegate_->OnStreamCreated(request, stream_info.Pass()); |
746 return handler.PassAs<ResourceHandler>(); | 751 return handler.PassAs<ResourceHandler>(); |
747 } | 752 } |
748 | 753 |
749 ResourceDispatcherHostLoginDelegate* | 754 ResourceDispatcherHostLoginDelegate* |
750 ResourceDispatcherHostImpl::CreateLoginDelegate( | 755 ResourceDispatcherHostImpl::CreateLoginDelegate( |
751 ResourceLoader* loader, | 756 ResourceLoader* loader, |
752 net::AuthChallengeInfo* auth_info) { | 757 net::AuthChallengeInfo* auth_info) { |
753 if (!delegate_) | 758 if (!delegate_) |
754 return NULL; | 759 return NULL; |
755 | 760 |
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2149 | 2154 |
2150 // Add a flag to selectively bypass the data reduction proxy if the resource | 2155 // Add a flag to selectively bypass the data reduction proxy if the resource |
2151 // type is not an image. | 2156 // type is not an image. |
2152 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2157 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
2153 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2158 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
2154 | 2159 |
2155 return load_flags; | 2160 return load_flags; |
2156 } | 2161 } |
2157 | 2162 |
2158 } // namespace content | 2163 } // namespace content |
OLD | NEW |