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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 filter_->Send(new ViewMsg_Resource_RequestComplete( | 386 filter_->Send(new ViewMsg_Resource_RequestComplete( |
387 route_id, | 387 route_id, |
388 request_id, | 388 request_id, |
389 status, | 389 status, |
390 std::string(), // No security info needed, connection was not | 390 std::string(), // No security info needed, connection was not |
391 base::Time())); // established. | 391 base::Time())); // established. |
392 } | 392 } |
393 return; | 393 return; |
394 } | 394 } |
395 | 395 |
396 // Ensure the Chrome plugins are loaded, as they may intercept network | |
397 // requests. Does nothing if they are already loaded. | |
398 // TODO(mpcomplete): This takes 200 ms! Investigate parallelizing this by | |
399 // starting the load earlier in a BG thread. | |
400 PluginService::GetInstance()->LoadChromePlugins(this); | |
401 | |
402 // Construct the event handler. | 396 // Construct the event handler. |
403 scoped_refptr<ResourceHandler> handler; | 397 scoped_refptr<ResourceHandler> handler; |
404 if (sync_result) { | 398 if (sync_result) { |
405 handler = new SyncResourceHandler( | 399 handler = new SyncResourceHandler( |
406 filter_, request_data.url, sync_result, this); | 400 filter_, request_data.url, sync_result, this); |
407 } else { | 401 } else { |
408 handler = new AsyncResourceHandler( | 402 handler = new AsyncResourceHandler( |
409 filter_, route_id, request_data.url, this); | 403 filter_, route_id, request_data.url, this); |
410 } | 404 } |
411 | 405 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 VLOG(1) << "Denied unauthorized download request for " | 690 VLOG(1) << "Denied unauthorized download request for " |
697 << url.possibly_invalid_spec(); | 691 << url.possibly_invalid_spec(); |
698 return; | 692 return; |
699 } | 693 } |
700 | 694 |
701 BrowserThread::PostTask( | 695 BrowserThread::PostTask( |
702 BrowserThread::UI, FROM_HERE, | 696 BrowserThread::UI, FROM_HERE, |
703 NewRunnableFunction(&download_util::NotifyDownloadInitiated, | 697 NewRunnableFunction(&download_util::NotifyDownloadInitiated, |
704 child_id, route_id)); | 698 child_id, route_id)); |
705 | 699 |
706 // Ensure the Chrome plugins are loaded, as they may intercept network | |
707 // requests. Does nothing if they are already loaded. | |
708 PluginService::GetInstance()->LoadChromePlugins(this); | |
709 net::URLRequest* request = new net::URLRequest(url, this); | 700 net::URLRequest* request = new net::URLRequest(url, this); |
710 | 701 |
711 request_id_--; | 702 request_id_--; |
712 | 703 |
713 scoped_refptr<ResourceHandler> handler( | 704 scoped_refptr<ResourceHandler> handler( |
714 new DownloadResourceHandler(this, | 705 new DownloadResourceHandler(this, |
715 child_id, | 706 child_id, |
716 route_id, | 707 route_id, |
717 request_id_, | 708 request_id_, |
718 url, | 709 url, |
(...skipping 30 matching lines...) Expand all Loading... |
749 // This function is only used for saving feature. | 740 // This function is only used for saving feature. |
750 void ResourceDispatcherHost::BeginSaveFile( | 741 void ResourceDispatcherHost::BeginSaveFile( |
751 const GURL& url, | 742 const GURL& url, |
752 const GURL& referrer, | 743 const GURL& referrer, |
753 int child_id, | 744 int child_id, |
754 int route_id, | 745 int route_id, |
755 net::URLRequestContext* request_context) { | 746 net::URLRequestContext* request_context) { |
756 if (is_shutdown_) | 747 if (is_shutdown_) |
757 return; | 748 return; |
758 | 749 |
759 // Ensure the Chrome plugins are loaded, as they may intercept network | |
760 // requests. Does nothing if they are already loaded. | |
761 PluginService::GetInstance()->LoadChromePlugins(this); | |
762 | |
763 scoped_refptr<ResourceHandler> handler( | 750 scoped_refptr<ResourceHandler> handler( |
764 new SaveFileResourceHandler(child_id, | 751 new SaveFileResourceHandler(child_id, |
765 route_id, | 752 route_id, |
766 url, | 753 url, |
767 save_file_manager_.get())); | 754 save_file_manager_.get())); |
768 request_id_--; | 755 request_id_--; |
769 | 756 |
770 bool known_proto = net::URLRequest::IsHandledURL(url); | 757 bool known_proto = net::URLRequest::IsHandledURL(url); |
771 if (!known_proto) { | 758 if (!known_proto) { |
772 // Since any URLs which have non-standard scheme have been filtered | 759 // Since any URLs which have non-standard scheme have been filtered |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 return is_prefetch_enabled_; | 1931 return is_prefetch_enabled_; |
1945 } | 1932 } |
1946 | 1933 |
1947 // static | 1934 // static |
1948 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 1935 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
1949 is_prefetch_enabled_ = value; | 1936 is_prefetch_enabled_ = value; |
1950 } | 1937 } |
1951 | 1938 |
1952 // static | 1939 // static |
1953 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 1940 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
OLD | NEW |