OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 newInfo->currentStream = NULL; | 197 newInfo->currentStream = NULL; |
198 newInfo->currentData = 0; | 198 newInfo->currentData = 0; |
199 newInfo->formStream = stream; // Don't retain. That would create a reference
cycle. | 199 newInfo->formStream = stream; // Don't retain. That would create a reference
cycle. |
200 newInfo->streamLength = formContext->streamLength; | 200 newInfo->streamLength = formContext->streamLength; |
201 newInfo->bytesSent = 0; | 201 newInfo->bytesSent = 0; |
202 | 202 |
203 FormData* formData = formContext->formData; | 203 FormData* formData = formContext->formData; |
204 | 204 |
205 // Append in reverse order since we remove elements from the end. | 205 // Append in reverse order since we remove elements from the end. |
206 size_t size = formData->elements().size(); | 206 size_t size = formData->elements().size(); |
207 newInfo->remainingElements.reserveCapacity(size); | 207 newInfo->remainingElements.reserveInitialCapacity(size); |
208 for (size_t i = 0; i < size; ++i) | 208 for (size_t i = 0; i < size; ++i) |
209 newInfo->remainingElements.append(formData->elements()[size - i - 1]); | 209 newInfo->remainingElements.append(formData->elements()[size - i - 1]); |
210 | 210 |
211 getStreamFormDataMap().set(stream, adoptRef(formData)); | 211 getStreamFormDataMap().set(stream, adoptRef(formData)); |
212 | 212 |
213 return newInfo; | 213 return newInfo; |
214 } | 214 } |
215 | 215 |
216 static void formFinalize(CFReadStreamRef stream, void* context) | 216 static void formFinalize(CFReadStreamRef stream, void* context) |
217 { | 217 { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 CFRelease(stream); | 383 CFRelease(stream); |
384 } | 384 } |
385 | 385 |
386 FormData* httpBodyFromStream(NSInputStream* stream) | 386 FormData* httpBodyFromStream(NSInputStream* stream) |
387 { | 387 { |
388 return getStreamFormDataMap().get((CFReadStreamRef)stream).get(); | 388 return getStreamFormDataMap().get((CFReadStreamRef)stream).get(); |
389 } | 389 } |
390 | 390 |
391 } // namespace WebCore | 391 } // namespace WebCore |
392 | 392 |
OLD | NEW |