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 "content/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 uint64 upload_size = 0; | 459 uint64 upload_size = 0; |
460 if (request_data.upload_data) { | 460 if (request_data.upload_data) { |
461 request->set_upload(request_data.upload_data); | 461 request->set_upload(request_data.upload_data); |
462 upload_size = request_data.upload_data->GetContentLength(); | 462 upload_size = request_data.upload_data->GetContentLength(); |
463 } | 463 } |
464 | 464 |
465 // Install a PrerenderResourceHandler if the requested URL could | 465 // Install a PrerenderResourceHandler if the requested URL could |
466 // be prerendered. This should be in front of the [a]syncResourceHandler, | 466 // be prerendered. This should be in front of the [a]syncResourceHandler, |
467 // but after the BufferedResourceHandler since it depends on the MIME | 467 // but after the BufferedResourceHandler since it depends on the MIME |
468 // sniffing capabilities in the BufferedResourceHandler. | 468 // sniffing capabilities in the BufferedResourceHandler. |
469 bool is_from_prerender = ((load_flags & net::LOAD_PRERENDER) != 0); | |
cbentzel
2011/03/15 18:42:24
load_flags & net::LOAD_PRERENDER is sufficient.
y
dominich
2011/03/15 20:41:14
Done.
| |
469 prerender::PrerenderResourceHandler* pre_handler = | 470 prerender::PrerenderResourceHandler* pre_handler = |
470 prerender::PrerenderResourceHandler::MaybeCreate(*request, | 471 prerender::PrerenderResourceHandler::MaybeCreate(*request, |
471 context, | 472 context, |
472 handler); | 473 handler, |
474 is_from_prerender, | |
475 child_id, | |
476 route_id); | |
473 if (pre_handler) | 477 if (pre_handler) |
474 handler = pre_handler; | 478 handler = pre_handler; |
475 | 479 |
476 // Install a CrossSiteResourceHandler if this request is coming from a | 480 // Install a CrossSiteResourceHandler if this request is coming from a |
477 // RenderViewHost with a pending cross-site request. We only check this for | 481 // RenderViewHost with a pending cross-site request. We only check this for |
478 // MAIN_FRAME requests. Unblock requests only come from a blocked page, do | 482 // MAIN_FRAME requests. Unblock requests only come from a blocked page, do |
479 // not count as cross-site, otherwise it gets blocked indefinitely. | 483 // not count as cross-site, otherwise it gets blocked indefinitely. |
480 if (request_data.resource_type == ResourceType::MAIN_FRAME && | 484 if (request_data.resource_type == ResourceType::MAIN_FRAME && |
481 process_type == ChildProcessInfo::RENDER_PROCESS && | 485 process_type == ChildProcessInfo::RENDER_PROCESS && |
482 CrossSiteRequestManager::GetInstance()-> | 486 CrossSiteRequestManager::GetInstance()-> |
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1958 return is_prefetch_enabled_; | 1962 return is_prefetch_enabled_; |
1959 } | 1963 } |
1960 | 1964 |
1961 // static | 1965 // static |
1962 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 1966 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
1963 is_prefetch_enabled_ = value; | 1967 is_prefetch_enabled_ = value; |
1964 } | 1968 } |
1965 | 1969 |
1966 // static | 1970 // static |
1967 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 1971 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
OLD | NEW |