OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 double ResourceRequest::s_defaultTimeoutInterval = INT_MAX; | 32 double ResourceRequest::s_defaultTimeoutInterval = INT_MAX; |
33 | 33 |
34 PassOwnPtr<ResourceRequest> ResourceRequest::adopt(PassOwnPtr<CrossThreadResourc
eRequestData> data) | 34 PassOwnPtr<ResourceRequest> ResourceRequest::adopt(PassOwnPtr<CrossThreadResourc
eRequestData> data) |
35 { | 35 { |
36 OwnPtr<ResourceRequest> request = adoptPtr(new ResourceRequest()); | 36 OwnPtr<ResourceRequest> request = adoptPtr(new ResourceRequest()); |
37 request->setURL(data->m_url); | 37 request->setURL(data->m_url); |
38 request->setCachePolicy(data->m_cachePolicy); | 38 request->setCachePolicy(data->m_cachePolicy); |
39 request->setTimeoutInterval(data->m_timeoutInterval); | 39 request->setTimeoutInterval(data->m_timeoutInterval); |
40 request->setFirstPartyForCookies(data->m_firstPartyForCookies); | 40 request->setFirstPartyForCookies(data->m_firstPartyForCookies); |
41 request->setHTTPMethod(data->m_httpMethod); | 41 request->setHTTPMethod(AtomicString(data->m_httpMethod)); |
42 request->setPriority(data->m_priority); | 42 request->setPriority(data->m_priority); |
43 | 43 |
44 request->m_httpHeaderFields.adopt(data->m_httpHeaders.release()); | 44 request->m_httpHeaderFields.adopt(data->m_httpHeaders.release()); |
45 | 45 |
46 request->setHTTPBody(data->m_httpBody); | 46 request->setHTTPBody(data->m_httpBody); |
47 request->setAllowCookies(data->m_allowCookies); | 47 request->setAllowCookies(data->m_allowCookies); |
48 request->setReportUploadProgress(data->m_reportUploadProgress); | 48 request->setReportUploadProgress(data->m_reportUploadProgress); |
49 request->setHasUserGesture(data->m_hasUserGesture); | 49 request->setHasUserGesture(data->m_hasUserGesture); |
50 request->setDownloadToFile(data->m_downloadToFile); | 50 request->setDownloadToFile(data->m_downloadToFile); |
51 request->setRequestorID(data->m_requestorID); | 51 request->setRequestorID(data->m_requestorID); |
52 request->setRequestorProcessID(data->m_requestorProcessID); | 52 request->setRequestorProcessID(data->m_requestorProcessID); |
53 request->setAppCacheHostID(data->m_appCacheHostID); | 53 request->setAppCacheHostID(data->m_appCacheHostID); |
54 request->setTargetType(data->m_targetType); | 54 request->setTargetType(data->m_targetType); |
55 return request.release(); | 55 return request.release(); |
56 } | 56 } |
57 | 57 |
58 PassOwnPtr<CrossThreadResourceRequestData> ResourceRequest::copyData() const | 58 PassOwnPtr<CrossThreadResourceRequestData> ResourceRequest::copyData() const |
59 { | 59 { |
60 OwnPtr<CrossThreadResourceRequestData> data = adoptPtr(new CrossThreadResour
ceRequestData()); | 60 OwnPtr<CrossThreadResourceRequestData> data = adoptPtr(new CrossThreadResour
ceRequestData()); |
61 data->m_url = url().copy(); | 61 data->m_url = url().copy(); |
62 data->m_cachePolicy = cachePolicy(); | 62 data->m_cachePolicy = cachePolicy(); |
63 data->m_timeoutInterval = timeoutInterval(); | 63 data->m_timeoutInterval = timeoutInterval(); |
64 data->m_firstPartyForCookies = firstPartyForCookies().copy(); | 64 data->m_firstPartyForCookies = firstPartyForCookies().copy(); |
65 data->m_httpMethod = httpMethod().isolatedCopy(); | 65 data->m_httpMethod = httpMethod().string().isolatedCopy(); |
66 data->m_httpHeaders = httpHeaderFields().copyData(); | 66 data->m_httpHeaders = httpHeaderFields().copyData(); |
67 data->m_priority = priority(); | 67 data->m_priority = priority(); |
68 | 68 |
69 if (m_httpBody) | 69 if (m_httpBody) |
70 data->m_httpBody = m_httpBody->deepCopy(); | 70 data->m_httpBody = m_httpBody->deepCopy(); |
71 data->m_allowCookies = m_allowCookies; | 71 data->m_allowCookies = m_allowCookies; |
72 data->m_reportUploadProgress = m_reportUploadProgress; | 72 data->m_reportUploadProgress = m_reportUploadProgress; |
73 data->m_hasUserGesture = m_hasUserGesture; | 73 data->m_hasUserGesture = m_hasUserGesture; |
74 data->m_downloadToFile = m_downloadToFile; | 74 data->m_downloadToFile = m_downloadToFile; |
75 data->m_requestorID = m_requestorID; | 75 data->m_requestorID = m_requestorID; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 const KURL& ResourceRequest::firstPartyForCookies() const | 131 const KURL& ResourceRequest::firstPartyForCookies() const |
132 { | 132 { |
133 return m_firstPartyForCookies; | 133 return m_firstPartyForCookies; |
134 } | 134 } |
135 | 135 |
136 void ResourceRequest::setFirstPartyForCookies(const KURL& firstPartyForCookies) | 136 void ResourceRequest::setFirstPartyForCookies(const KURL& firstPartyForCookies) |
137 { | 137 { |
138 m_firstPartyForCookies = firstPartyForCookies; | 138 m_firstPartyForCookies = firstPartyForCookies; |
139 } | 139 } |
140 | 140 |
141 const String& ResourceRequest::httpMethod() const | 141 const AtomicString& ResourceRequest::httpMethod() const |
142 { | 142 { |
143 return m_httpMethod; | 143 return m_httpMethod; |
144 } | 144 } |
145 | 145 |
146 void ResourceRequest::setHTTPMethod(const String& httpMethod) | 146 void ResourceRequest::setHTTPMethod(const AtomicString& httpMethod) |
147 { | 147 { |
148 m_httpMethod = httpMethod; | 148 m_httpMethod = httpMethod; |
149 } | 149 } |
150 | 150 |
151 const HTTPHeaderMap& ResourceRequest::httpHeaderFields() const | 151 const HTTPHeaderMap& ResourceRequest::httpHeaderFields() const |
152 { | 152 { |
153 return m_httpHeaderFields; | 153 return m_httpHeaderFields; |
154 } | 154 } |
155 | 155 |
156 String ResourceRequest::httpHeaderField(const AtomicString& name) const | 156 AtomicString ResourceRequest::httpHeaderField(const AtomicString& name) const |
157 { | 157 { |
158 return m_httpHeaderFields.get(name); | 158 return m_httpHeaderFields.get(name); |
159 } | 159 } |
160 | 160 |
161 String ResourceRequest::httpHeaderField(const char* name) const | 161 const AtomicString& ResourceRequest::httpHeaderField(const char* name) const |
162 { | 162 { |
163 return m_httpHeaderFields.get(name); | 163 return m_httpHeaderFields.get(name); |
164 } | 164 } |
165 | 165 |
166 void ResourceRequest::setHTTPHeaderField(const AtomicString& name, const String&
value) | 166 void ResourceRequest::setHTTPHeaderField(const AtomicString& name, const AtomicS
tring& value) |
167 { | 167 { |
168 m_httpHeaderFields.set(name, value); | 168 m_httpHeaderFields.set(name, value); |
169 } | 169 } |
170 | 170 |
171 void ResourceRequest::setHTTPHeaderField(const char* name, const String& value) | 171 void ResourceRequest::setHTTPHeaderField(const char* name, const AtomicString& v
alue) |
172 { | 172 { |
173 setHTTPHeaderField(AtomicString(name), value); | 173 setHTTPHeaderField(AtomicString(name), value); |
174 } | 174 } |
175 | 175 |
176 void ResourceRequest::clearHTTPAuthorization() | 176 void ResourceRequest::clearHTTPAuthorization() |
177 { | 177 { |
178 m_httpHeaderFields.remove("Authorization"); | 178 m_httpHeaderFields.remove("Authorization"); |
179 } | 179 } |
180 | 180 |
181 void ResourceRequest::clearHTTPContentType() | 181 void ResourceRequest::clearHTTPContentType() |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 ResourceLoadPriority ResourceRequest::priority() const | 226 ResourceLoadPriority ResourceRequest::priority() const |
227 { | 227 { |
228 return m_priority; | 228 return m_priority; |
229 } | 229 } |
230 | 230 |
231 void ResourceRequest::setPriority(ResourceLoadPriority priority) | 231 void ResourceRequest::setPriority(ResourceLoadPriority priority) |
232 { | 232 { |
233 m_priority = priority; | 233 m_priority = priority; |
234 } | 234 } |
235 | 235 |
236 void ResourceRequest::addHTTPHeaderField(const AtomicString& name, const String&
value) | 236 void ResourceRequest::addHTTPHeaderField(const AtomicString& name, const AtomicS
tring& value) |
237 { | 237 { |
238 HTTPHeaderMap::AddResult result = m_httpHeaderFields.add(name, value); | 238 HTTPHeaderMap::AddResult result = m_httpHeaderFields.add(name, value); |
239 if (!result.isNewEntry) | 239 if (!result.isNewEntry) |
240 result.iterator->value = result.iterator->value + ',' + value; | 240 result.iterator->value = result.iterator->value + ',' + value; |
241 } | 241 } |
242 | 242 |
243 void ResourceRequest::addHTTPHeaderFields(const HTTPHeaderMap& headerFields) | 243 void ResourceRequest::addHTTPHeaderFields(const HTTPHeaderMap& headerFields) |
244 { | 244 { |
245 HTTPHeaderMap::const_iterator end = headerFields.end(); | 245 HTTPHeaderMap::const_iterator end = headerFields.end(); |
246 for (HTTPHeaderMap::const_iterator it = headerFields.begin(); it != end; ++i
t) | 246 for (HTTPHeaderMap::const_iterator it = headerFields.begin(); it != end; ++i
t) |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 // This is used by the loader to control the number of issued parallel load requ
ests. | 341 // This is used by the loader to control the number of issued parallel load requ
ests. |
342 unsigned initializeMaximumHTTPConnectionCountPerHost() | 342 unsigned initializeMaximumHTTPConnectionCountPerHost() |
343 { | 343 { |
344 // The chromium network stack already handles limiting the number of | 344 // The chromium network stack already handles limiting the number of |
345 // parallel requests per host, so there's no need to do it here. Therefore, | 345 // parallel requests per host, so there's no need to do it here. Therefore, |
346 // this is set to a high value that should never be hit in practice. | 346 // this is set to a high value that should never be hit in practice. |
347 return 10000; | 347 return 10000; |
348 } | 348 } |
349 | 349 |
350 } | 350 } |
OLD | NEW |