OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 7 #ifndef CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
8 #define CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 8 #define CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
| 11 #include <set> |
11 #include <string> | 12 #include <string> |
12 | 13 |
13 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
14 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
15 #include "base/memory/shared_memory.h" | 16 #include "base/memory/shared_memory.h" |
16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/synchronization/lock.h" |
17 #include "base/time/time.h" | 19 #include "base/time/time.h" |
18 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
19 #include "ipc/ipc_listener.h" | 21 #include "ipc/ipc_listener.h" |
20 #include "ipc/ipc_sender.h" | 22 #include "ipc/ipc_sender.h" |
21 #include "net/base/request_priority.h" | 23 #include "net/base/request_priority.h" |
22 #include "webkit/common/resource_type.h" | 24 #include "webkit/common/resource_type.h" |
23 | 25 |
24 struct ResourceMsg_RequestCompleteData; | 26 struct ResourceMsg_RequestCompleteData; |
25 | 27 |
26 namespace webkit_glue { | 28 namespace webkit_glue { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 const GURL& frame_origin, | 62 const GURL& frame_origin, |
61 const GURL& request_url); | 63 const GURL& request_url); |
62 | 64 |
63 // Removes a request from the pending_requests_ list, returning true if the | 65 // Removes a request from the pending_requests_ list, returning true if the |
64 // request was found and removed. | 66 // request was found and removed. |
65 bool RemovePendingRequest(int request_id); | 67 bool RemovePendingRequest(int request_id); |
66 | 68 |
67 // Cancels a request in the pending_requests_ list. | 69 // Cancels a request in the pending_requests_ list. |
68 void CancelPendingRequest(int request_id); | 70 void CancelPendingRequest(int request_id); |
69 | 71 |
| 72 bool IsPendingRequestFontType(const IPC::Message& message); |
| 73 |
70 IPC::Sender* message_sender() const { | 74 IPC::Sender* message_sender() const { |
71 return message_sender_; | 75 return message_sender_; |
72 } | 76 } |
73 | 77 |
74 // Toggles the is_deferred attribute for the specified request. | 78 // Toggles the is_deferred attribute for the specified request. |
75 void SetDefersLoading(int request_id, bool value); | 79 void SetDefersLoading(int request_id, bool value); |
76 | 80 |
77 // Indicates the priority of the specified request changed. | 81 // Indicates the priority of the specified request changed. |
78 void DidChangePriority(int routing_id, int request_id, | 82 void DidChangePriority(int routing_id, int request_id, |
79 net::RequestPriority new_priority, | 83 net::RequestPriority new_priority, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 202 |
199 // Iterate through a message queue and clean up the messages by calling | 203 // Iterate through a message queue and clean up the messages by calling |
200 // ReleaseResourcesInDataMessage and removing them from the queue. Intended | 204 // ReleaseResourcesInDataMessage and removing them from the queue. Intended |
201 // for use on deferred message queues that are no longer needed. | 205 // for use on deferred message queues that are no longer needed. |
202 static void ReleaseResourcesInMessageQueue(MessageQueue* queue); | 206 static void ReleaseResourcesInMessageQueue(MessageQueue* queue); |
203 | 207 |
204 IPC::Sender* message_sender_; | 208 IPC::Sender* message_sender_; |
205 | 209 |
206 // All pending requests issued to the host | 210 // All pending requests issued to the host |
207 PendingRequestList pending_requests_; | 211 PendingRequestList pending_requests_; |
| 212 std::set<int> font_requests_; |
208 | 213 |
209 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; | 214 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; |
210 | 215 |
211 ResourceDispatcherDelegate* delegate_; | 216 ResourceDispatcherDelegate* delegate_; |
212 | 217 |
213 // IO thread timestamp for ongoing IPC message. | 218 // IO thread timestamp for ongoing IPC message. |
214 base::TimeTicks io_timestamp_; | 219 base::TimeTicks io_timestamp_; |
| 220 base::Lock font_lock_; |
215 | 221 |
216 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 222 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
217 }; | 223 }; |
218 | 224 |
219 } // namespace content | 225 } // namespace content |
220 | 226 |
221 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 227 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
OLD | NEW |