Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: chrome/common/resource_dispatcher.h

Issue 1703017: When cancelling a pending request, release any outstanding SharedIOBuffer objects (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/resource_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROME_COMMON_RESOURCE_DISPATCHER_H__ 7 #ifndef CHROME_COMMON_RESOURCE_DISPATCHER_H__
8 #define CHROME_COMMON_RESOURCE_DISPATCHER_H__ 8 #define CHROME_COMMON_RESOURCE_DISPATCHER_H__
9 9
10 #include <deque> 10 #include <deque>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 typedef std::deque<IPC::Message*> MessageQueue; 65 typedef std::deque<IPC::Message*> MessageQueue;
66 struct PendingRequestInfo { 66 struct PendingRequestInfo {
67 PendingRequestInfo() { } 67 PendingRequestInfo() { }
68 PendingRequestInfo(webkit_glue::ResourceLoaderBridge::Peer* peer, 68 PendingRequestInfo(webkit_glue::ResourceLoaderBridge::Peer* peer,
69 ResourceType::Type resource_type, 69 ResourceType::Type resource_type,
70 const GURL& request_url) 70 const GURL& request_url)
71 : peer(peer), 71 : peer(peer),
72 resource_type(resource_type), 72 resource_type(resource_type),
73 filter_policy(FilterPolicy::DONT_FILTER), 73 filter_policy(FilterPolicy::DONT_FILTER),
74 is_deferred(false), 74 is_deferred(false),
75 is_cancelled(false),
76 url(request_url) { 75 url(request_url) {
77 } 76 }
78 ~PendingRequestInfo() { } 77 ~PendingRequestInfo() { }
79 webkit_glue::ResourceLoaderBridge::Peer* peer; 78 webkit_glue::ResourceLoaderBridge::Peer* peer;
80 ResourceType::Type resource_type; 79 ResourceType::Type resource_type;
81 FilterPolicy::Type filter_policy; 80 FilterPolicy::Type filter_policy;
82 MessageQueue deferred_message_queue; 81 MessageQueue deferred_message_queue;
83 bool is_deferred; 82 bool is_deferred;
84 bool is_cancelled;
85 GURL url; 83 GURL url;
86 }; 84 };
87 typedef base::hash_map<int, PendingRequestInfo> PendingRequestList; 85 typedef base::hash_map<int, PendingRequestInfo> PendingRequestList;
88 86
89 // Message response handlers, called by the message handler for this process. 87 // Message response handlers, called by the message handler for this process.
90 void OnUploadProgress( 88 void OnUploadProgress(
91 const IPC::Message& message, 89 const IPC::Message& message,
92 int request_id, 90 int request_id,
93 int64 position, 91 int64 position,
94 int64 size); 92 int64 size);
(...skipping 20 matching lines...) Expand all
115 // again in the deferred state. 113 // again in the deferred state.
116 void FlushDeferredMessages(int request_id); 114 void FlushDeferredMessages(int request_id);
117 115
118 // Returns true if the message passed in is a resource related message. 116 // Returns true if the message passed in is a resource related message.
119 static bool IsResourceDispatcherMessage(const IPC::Message& message); 117 static bool IsResourceDispatcherMessage(const IPC::Message& message);
120 118
121 // ViewHostMsg_Resource_DataReceived is not POD, it has a shared memory 119 // ViewHostMsg_Resource_DataReceived is not POD, it has a shared memory
122 // handle in it that we should cleanup it up nicely. This method accepts any 120 // handle in it that we should cleanup it up nicely. This method accepts any
123 // message and determine whether the message is 121 // message and determine whether the message is
124 // ViewHostMsg_Resource_DataReceived and clean up the shared memory handle. 122 // ViewHostMsg_Resource_DataReceived and clean up the shared memory handle.
125 void ReleaseResourcesInDataMessage(const IPC::Message& message); 123 static void ReleaseResourcesInDataMessage(const IPC::Message& message);
124
125 // Iterate through a message queue and clean up the messages by calling
126 // ReleaseResourcesInDataMessage and removing them from the queue. Intended
127 // for use on deferred message queues that are no longer needed.
128 static void ReleaseResourcesInMessageQueue(MessageQueue* queue);
126 129
127 IPC::Message::Sender* message_sender_; 130 IPC::Message::Sender* message_sender_;
128 131
129 // All pending requests issued to the host 132 // All pending requests issued to the host
130 PendingRequestList pending_requests_; 133 PendingRequestList pending_requests_;
131 134
132 ScopedRunnableMethodFactory<ResourceDispatcher> method_factory_; 135 ScopedRunnableMethodFactory<ResourceDispatcher> method_factory_;
133 136
134 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); 137 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher);
135 }; 138 };
136 139
137 #endif // CHROME_COMMON_RESOURCE_DISPATCHER_H__ 140 #endif // CHROME_COMMON_RESOURCE_DISPATCHER_H__
OLDNEW
« no previous file with comments | « no previous file | chrome/common/resource_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698