| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/browser/renderer_host/cross_site_resource_handler.h" | 30 #include "chrome/browser/renderer_host/cross_site_resource_handler.h" |
| 31 #include "chrome/browser/renderer_host/download_resource_handler.h" | 31 #include "chrome/browser/renderer_host/download_resource_handler.h" |
| 32 #include "chrome/browser/renderer_host/render_view_host.h" | 32 #include "chrome/browser/renderer_host/render_view_host.h" |
| 33 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 33 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 34 #include "chrome/browser/renderer_host/resource_request_details.h" | 34 #include "chrome/browser/renderer_host/resource_request_details.h" |
| 35 #include "chrome/browser/renderer_host/safe_browsing_resource_handler.h" | 35 #include "chrome/browser/renderer_host/safe_browsing_resource_handler.h" |
| 36 #include "chrome/browser/renderer_host/save_file_resource_handler.h" | 36 #include "chrome/browser/renderer_host/save_file_resource_handler.h" |
| 37 #include "chrome/browser/renderer_host/sync_resource_handler.h" | 37 #include "chrome/browser/renderer_host/sync_resource_handler.h" |
| 38 #include "chrome/browser/ssl/ssl_client_auth_handler.h" | 38 #include "chrome/browser/ssl/ssl_client_auth_handler.h" |
| 39 #include "chrome/browser/ssl/ssl_manager.h" | 39 #include "chrome/browser/ssl/ssl_manager.h" |
| 40 #include "chrome/browser/tab_contents/tab_util.h" | |
| 41 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
| 42 #include "chrome/common/notification_service.h" | 41 #include "chrome/common/notification_service.h" |
| 43 #include "chrome/common/render_messages.h" | 42 #include "chrome/common/render_messages.h" |
| 44 #include "net/base/auth.h" | 43 #include "net/base/auth.h" |
| 45 #include "net/base/cert_status_flags.h" | 44 #include "net/base/cert_status_flags.h" |
| 46 #include "net/base/load_flags.h" | 45 #include "net/base/load_flags.h" |
| 47 #include "net/base/mime_util.h" | 46 #include "net/base/mime_util.h" |
| 48 #include "net/base/net_errors.h" | 47 #include "net/base/net_errors.h" |
| 49 #include "net/base/ssl_cert_request_info.h" | 48 #include "net/base/ssl_cert_request_info.h" |
| 50 #include "net/url_request/url_request.h" | 49 #include "net/url_request/url_request.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 78 | 77 |
| 79 // ---------------------------------------------------------------------------- | 78 // ---------------------------------------------------------------------------- |
| 80 | 79 |
| 81 bool ResourceDispatcherHost::g_is_http_prioritization_enabled = true; | 80 bool ResourceDispatcherHost::g_is_http_prioritization_enabled = true; |
| 82 | 81 |
| 83 // A ShutdownTask proxies a shutdown task from the UI thread to the IO thread. | 82 // A ShutdownTask proxies a shutdown task from the UI thread to the IO thread. |
| 84 // It should be constructed on the UI thread and run in the IO thread. | 83 // It should be constructed on the UI thread and run in the IO thread. |
| 85 class ResourceDispatcherHost::ShutdownTask : public Task { | 84 class ResourceDispatcherHost::ShutdownTask : public Task { |
| 86 public: | 85 public: |
| 87 explicit ShutdownTask(ResourceDispatcherHost* resource_dispatcher_host) | 86 explicit ShutdownTask(ResourceDispatcherHost* resource_dispatcher_host) |
| 88 : rdh_(resource_dispatcher_host) { } | 87 : rdh_(resource_dispatcher_host) { |
| 88 } |
| 89 | 89 |
| 90 void Run() { | 90 void Run() { |
| 91 rdh_->OnShutdown(); | 91 rdh_->OnShutdown(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 ResourceDispatcherHost* rdh_; | 95 ResourceDispatcherHost* rdh_; |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 namespace { | 98 namespace { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 is_shutdown_ = true; | 248 is_shutdown_ = true; |
| 249 STLDeleteValues(&pending_requests_); | 249 STLDeleteValues(&pending_requests_); |
| 250 // Make sure we shutdown the timer now, otherwise by the time our destructor | 250 // Make sure we shutdown the timer now, otherwise by the time our destructor |
| 251 // runs if the timer is still running the Task is deleted twice (once by | 251 // runs if the timer is still running the Task is deleted twice (once by |
| 252 // the MessageLoop and the second time by RepeatingTimer). | 252 // the MessageLoop and the second time by RepeatingTimer). |
| 253 update_load_states_timer_.Stop(); | 253 update_load_states_timer_.Stop(); |
| 254 } | 254 } |
| 255 | 255 |
| 256 bool ResourceDispatcherHost::HandleExternalProtocol(int request_id, | 256 bool ResourceDispatcherHost::HandleExternalProtocol(int request_id, |
| 257 int process_id, | 257 int process_id, |
| 258 int tab_contents_id, | 258 int route_id, |
| 259 const GURL& url, | 259 const GURL& url, |
| 260 ResourceType::Type type, | 260 ResourceType::Type type, |
| 261 ResourceHandler* handler) { | 261 ResourceHandler* handler) { |
| 262 if (!ResourceType::IsFrame(type) || URLRequest::IsHandledURL(url)) | 262 if (!ResourceType::IsFrame(type) || URLRequest::IsHandledURL(url)) |
| 263 return false; | 263 return false; |
| 264 | 264 |
| 265 ui_loop_->PostTask(FROM_HERE, NewRunnableFunction( | 265 ui_loop_->PostTask(FROM_HERE, NewRunnableFunction( |
| 266 &ExternalProtocolHandler::LaunchUrl, url, process_id, tab_contents_id)); | 266 &ExternalProtocolHandler::LaunchUrl, url, process_id, route_id)); |
| 267 | 267 |
| 268 handler->OnResponseCompleted(request_id, URLRequestStatus( | 268 handler->OnResponseCompleted(request_id, URLRequestStatus( |
| 269 URLRequestStatus::FAILED, | 269 URLRequestStatus::FAILED, |
| 270 net::ERR_ABORTED), | 270 net::ERR_ABORTED), |
| 271 std::string()); // No security info necessary. | 271 std::string()); // No security info necessary. |
| 272 return true; | 272 return true; |
| 273 } | 273 } |
| 274 | 274 |
| 275 bool ResourceDispatcherHost::OnMessageReceived(const IPC::Message& message, | 275 bool ResourceDispatcherHost::OnMessageReceived(const IPC::Message& message, |
| 276 Receiver* receiver, | 276 Receiver* receiver, |
| (...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 case ViewHostMsg_UploadProgress_ACK::ID: | 1610 case ViewHostMsg_UploadProgress_ACK::ID: |
| 1611 case ViewHostMsg_SyncLoad::ID: | 1611 case ViewHostMsg_SyncLoad::ID: |
| 1612 return true; | 1612 return true; |
| 1613 | 1613 |
| 1614 default: | 1614 default: |
| 1615 break; | 1615 break; |
| 1616 } | 1616 } |
| 1617 | 1617 |
| 1618 return false; | 1618 return false; |
| 1619 } | 1619 } |
| OLD | NEW |