| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This is the browser side of the resource dispatcher, it receives requests | 5 // This is the browser side of the resource dispatcher, it receives requests |
| 6 // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and | 6 // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and |
| 7 // dispatches them to URLRequests. It then forwards the messages from the | 7 // dispatches them to URLRequests. It then forwards the messages from the |
| 8 // URLRequests back to the correct process for handling. | 8 // URLRequests back to the correct process for handling. |
| 9 // | 9 // |
| 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| 11 | 11 |
| 12 #ifndef CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 12 #ifndef CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
| 13 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 13 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
| 14 #pragma once | 14 #pragma once |
| 15 | 15 |
| 16 #include <map> | 16 #include <map> |
| 17 #include <string> | 17 #include <string> |
| 18 #include <vector> | 18 #include <vector> |
| 19 | 19 |
| 20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
| 21 #include "base/gtest_prod_util.h" | 21 #include "base/gtest_prod_util.h" |
| 22 #include "base/observer_list.h" | 22 #include "base/observer_list.h" |
| 23 #include "base/scoped_ptr.h" | 23 #include "base/scoped_ptr.h" |
| 24 #include "base/timer.h" | 24 #include "base/timer.h" |
| 25 #include "chrome/common/child_process_info.h" | 25 #include "chrome/common/child_process_info.h" |
| 26 #include "chrome/common/notification_type.h" |
| 26 #include "chrome/browser/renderer_host/resource_queue.h" | 27 #include "chrome/browser/renderer_host/resource_queue.h" |
| 27 #include "ipc/ipc_message.h" | 28 #include "ipc/ipc_message.h" |
| 28 #include "net/url_request/url_request.h" | 29 #include "net/url_request/url_request.h" |
| 29 #include "webkit/glue/resource_type.h" | 30 #include "webkit/glue/resource_type.h" |
| 30 | 31 |
| 31 class CrossSiteResourceHandler; | 32 class CrossSiteResourceHandler; |
| 32 class DownloadFileManager; | 33 class DownloadFileManager; |
| 33 class DownloadRequestLimiter; | 34 class DownloadRequestLimiter; |
| 34 class LoginHandler; | 35 class LoginHandler; |
| 36 class NotificationDetails; |
| 35 class PluginService; | 37 class PluginService; |
| 36 class ResourceDispatcherHostRequestInfo; | 38 class ResourceDispatcherHostRequestInfo; |
| 37 class ResourceHandler; | 39 class ResourceHandler; |
| 38 class ResourceMessageFilter; | 40 class ResourceMessageFilter; |
| 39 class SafeBrowsingService; | 41 class SafeBrowsingService; |
| 40 class SaveFileManager; | 42 class SaveFileManager; |
| 41 class SSLClientAuthHandler; | 43 class SSLClientAuthHandler; |
| 42 class UserScriptListener; | 44 class UserScriptListener; |
| 43 class URLRequestContext; | 45 class URLRequestContext; |
| 44 class WebKitThread; | 46 class WebKitThread; |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 // have "chrome-extension://" scheme. | 415 // have "chrome-extension://" scheme. |
| 414 static void ApplyExtensionLocalizationFilter( | 416 static void ApplyExtensionLocalizationFilter( |
| 415 const GURL& url, | 417 const GURL& url, |
| 416 const ResourceType::Type& resource_type, | 418 const ResourceType::Type& resource_type, |
| 417 ResourceDispatcherHostRequestInfo* request_info); | 419 ResourceDispatcherHostRequestInfo* request_info); |
| 418 | 420 |
| 419 // Determine request priority based on how critical this resource typically | 421 // Determine request priority based on how critical this resource typically |
| 420 // is to user-perceived page load performance. | 422 // is to user-perceived page load performance. |
| 421 static net::RequestPriority DetermineRequestPriority(ResourceType::Type type); | 423 static net::RequestPriority DetermineRequestPriority(ResourceType::Type type); |
| 422 | 424 |
| 425 // Sends the given notification on the UI thread. The RenderViewHost's |
| 426 // controller is used as the source. |
| 427 template <class T> |
| 428 static void NotifyOnUI(NotificationType type, |
| 429 int render_process_id, |
| 430 int render_view_id, |
| 431 T* detail); |
| 432 |
| 423 PendingRequestList pending_requests_; | 433 PendingRequestList pending_requests_; |
| 424 | 434 |
| 425 // Collection of temp files downloaded for child processes via | 435 // Collection of temp files downloaded for child processes via |
| 426 // the download_to_file mechanism. We avoid deleting them until | 436 // the download_to_file mechanism. We avoid deleting them until |
| 427 // the client no longer needs them. | 437 // the client no longer needs them. |
| 428 typedef std::map<int, scoped_refptr<webkit_blob::DeletableFileReference> > | 438 typedef std::map<int, scoped_refptr<webkit_blob::DeletableFileReference> > |
| 429 DeletableFilesMap; // key is request id | 439 DeletableFilesMap; // key is request id |
| 430 typedef std::map<int, DeletableFilesMap> | 440 typedef std::map<int, DeletableFilesMap> |
| 431 RegisteredTempFiles; // key is child process id | 441 RegisteredTempFiles; // key is child process id |
| 432 RegisteredTempFiles registered_temp_files_; | 442 RegisteredTempFiles registered_temp_files_; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // Used during IPC message dispatching so that the handlers can get a pointer | 504 // Used during IPC message dispatching so that the handlers can get a pointer |
| 495 // to the source of the message. | 505 // to the source of the message. |
| 496 ResourceMessageFilter* filter_; | 506 ResourceMessageFilter* filter_; |
| 497 | 507 |
| 498 static bool is_prefetch_enabled_; | 508 static bool is_prefetch_enabled_; |
| 499 | 509 |
| 500 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); | 510 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); |
| 501 }; | 511 }; |
| 502 | 512 |
| 503 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 513 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
| OLD | NEW |