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

Side by Side Diff: Source/platform/network/FormData.cpp

Issue 594473002: [Thread-safe] Take deep copy of String/KURL in FormData::deepCopy() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove gmock.h include Created 6 years, 2 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
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/network/FormDataTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 size_t n = m_elements.size(); 89 size_t n = m_elements.size();
90 formData->m_elements.reserveInitialCapacity(n); 90 formData->m_elements.reserveInitialCapacity(n);
91 for (size_t i = 0; i < n; ++i) { 91 for (size_t i = 0; i < n; ++i) {
92 const FormDataElement& e = m_elements[i]; 92 const FormDataElement& e = m_elements[i];
93 switch (e.m_type) { 93 switch (e.m_type) {
94 case FormDataElement::data: 94 case FormDataElement::data:
95 formData->m_elements.uncheckedAppend(FormDataElement(e.m_data)); 95 formData->m_elements.uncheckedAppend(FormDataElement(e.m_data));
96 break; 96 break;
97 case FormDataElement::encodedFile: 97 case FormDataElement::encodedFile:
98 formData->m_elements.uncheckedAppend(FormDataElement(e.m_filename, e .m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime)); 98 formData->m_elements.uncheckedAppend(FormDataElement(e.m_filename.is olatedCopy(), e.m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime));
99 break; 99 break;
100 case FormDataElement::encodedBlob: 100 case FormDataElement::encodedBlob:
101 formData->m_elements.uncheckedAppend(FormDataElement(e.m_blobUUID, e .m_optionalBlobDataHandle)); 101 formData->m_elements.uncheckedAppend(FormDataElement(e.m_blobUUID.is olatedCopy(), e.m_optionalBlobDataHandle));
102 break; 102 break;
103 case FormDataElement::encodedFileSystemURL: 103 case FormDataElement::encodedFileSystemURL:
104 formData->m_elements.uncheckedAppend(FormDataElement(e.m_fileSystemU RL, e.m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime)); 104 formData->m_elements.uncheckedAppend(FormDataElement(e.m_fileSystemU RL.copy(), e.m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime));
105 break; 105 break;
106 } 106 }
107 } 107 }
108 return formData.release(); 108 return formData.release();
109 } 109 }
110 110
111 void FormData::appendData(const void* data, size_t size) 111 void FormData::appendData(const void* data, size_t size)
112 { 112 {
113 if (m_elements.isEmpty() || m_elements.last().m_type != FormDataElement::dat a) 113 if (m_elements.isEmpty() || m_elements.last().m_type != FormDataElement::dat a)
114 m_elements.append(FormDataElement()); 114 m_elements.append(FormDataElement());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 break; 181 break;
182 case FormDataElement::encodedFileSystemURL: 182 case FormDataElement::encodedFileSystemURL:
183 size += e.m_fileLength - e.m_fileStart; 183 size += e.m_fileLength - e.m_fileStart;
184 break; 184 break;
185 } 185 }
186 } 186 }
187 return size; 187 return size;
188 } 188 }
189 189
190 } // namespace blink 190 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/network/FormDataTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698