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 // 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 CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 12 #ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
13 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 13 #define CONTENT_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/memory/scoped_ptr.h" | 22 #include "base/memory/scoped_ptr.h" |
| 23 #include "base/memory/weak_ptr.h" |
23 #include "base/time.h" | 24 #include "base/time.h" |
24 #include "base/timer.h" | 25 #include "base/timer.h" |
25 #include "content/browser/download/download_resource_handler.h" | 26 #include "content/browser/download/download_resource_handler.h" |
26 #include "content/browser/renderer_host/resource_queue.h" | 27 #include "content/browser/renderer_host/resource_queue.h" |
27 #include "content/common/child_process_info.h" | 28 #include "content/common/child_process_info.h" |
28 #include "content/common/content_export.h" | 29 #include "content/common/content_export.h" |
29 #include "content/public/browser/notification_types.h" | 30 #include "content/public/browser/notification_types.h" |
30 #include "ipc/ipc_message.h" | 31 #include "ipc/ipc_message.h" |
31 #include "net/url_request/url_request.h" | 32 #include "net/url_request/url_request.h" |
32 #include "webkit/glue/resource_type.h" | 33 #include "webkit/glue/resource_type.h" |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 // Request ID for browser initiated requests. request_ids generated by | 463 // Request ID for browser initiated requests. request_ids generated by |
463 // child processes are counted up from 0, while browser created requests | 464 // child processes are counted up from 0, while browser created requests |
464 // start at -2 and go down from there. (We need to start at -2 because -1 is | 465 // start at -2 and go down from there. (We need to start at -2 because -1 is |
465 // used as a special value all over the resource_dispatcher_host for | 466 // used as a special value all over the resource_dispatcher_host for |
466 // uninitialized variables.) This way, we no longer have the unlikely (but | 467 // uninitialized variables.) This way, we no longer have the unlikely (but |
467 // observed in the real world!) event where we have two requests with the same | 468 // observed in the real world!) event where we have two requests with the same |
468 // request_id_. | 469 // request_id_. |
469 int request_id_; | 470 int request_id_; |
470 | 471 |
471 // For running tasks. | 472 // For running tasks. |
472 ScopedRunnableMethodFactory<ResourceDispatcherHost> method_runner_; | 473 base::WeakPtrFactory<ResourceDispatcherHost> weak_factory_; |
473 | 474 |
474 // True if the resource dispatcher host has been shut down. | 475 // True if the resource dispatcher host has been shut down. |
475 bool is_shutdown_; | 476 bool is_shutdown_; |
476 | 477 |
477 typedef std::vector<net::URLRequest*> BlockedRequestsList; | 478 typedef std::vector<net::URLRequest*> BlockedRequestsList; |
478 typedef std::pair<int, int> ProcessRouteIDs; | 479 typedef std::pair<int, int> ProcessRouteIDs; |
479 typedef std::map<ProcessRouteIDs, BlockedRequestsList*> BlockedRequestMap; | 480 typedef std::map<ProcessRouteIDs, BlockedRequestsList*> BlockedRequestMap; |
480 BlockedRequestMap blocked_requests_map_; | 481 BlockedRequestMap blocked_requests_map_; |
481 | 482 |
482 // Maps the process_unique_ids to the approximate number of bytes | 483 // Maps the process_unique_ids to the approximate number of bytes |
(...skipping 21 matching lines...) Expand all Loading... |
504 | 505 |
505 content::ResourceDispatcherHostDelegate* delegate_; | 506 content::ResourceDispatcherHostDelegate* delegate_; |
506 | 507 |
507 static bool is_prefetch_enabled_; | 508 static bool is_prefetch_enabled_; |
508 bool allow_cross_origin_auth_prompt_; | 509 bool allow_cross_origin_auth_prompt_; |
509 | 510 |
510 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); | 511 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); |
511 }; | 512 }; |
512 | 513 |
513 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 514 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
OLD | NEW |