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

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

Issue 1276203004: Implement FormData::isSafeToSendToAnotherThread() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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/network/FormData.h ('k') | no next file » | 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 11 matching lines...) Expand all
22 #include "config.h" 22 #include "config.h"
23 #include "platform/network/FormData.h" 23 #include "platform/network/FormData.h"
24 24
25 #include "platform/FileMetadata.h" 25 #include "platform/FileMetadata.h"
26 #include "platform/network/FormDataBuilder.h" 26 #include "platform/network/FormDataBuilder.h"
27 #include "wtf/text/CString.h" 27 #include "wtf/text/CString.h"
28 #include "wtf/text/TextEncoding.h" 28 #include "wtf/text/TextEncoding.h"
29 29
30 namespace blink { 30 namespace blink {
31 31
32 bool FormDataElement::isSafeToSendToAnotherThread() const
33 {
34 return m_filename.isSafeToSendToAnotherThread()
35 && m_blobUUID.isSafeToSendToAnotherThread()
36 && m_fileSystemURL.isSafeToSendToAnotherThread();
37 }
38
32 inline FormData::FormData() 39 inline FormData::FormData()
33 : m_identifier(0) 40 : m_identifier(0)
34 , m_containsPasswordData(false) 41 , m_containsPasswordData(false)
35 { 42 {
36 } 43 }
37 44
38 inline FormData::FormData(const FormData& data) 45 inline FormData::FormData(const FormData& data)
39 : RefCounted<FormData>() 46 : RefCounted<FormData>()
40 , m_elements(data.m_elements) 47 , m_elements(data.m_elements)
41 , m_identifier(data.m_identifier) 48 , m_identifier(data.m_identifier)
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 size += e.m_optionalBlobDataHandle->size(); 187 size += e.m_optionalBlobDataHandle->size();
181 break; 188 break;
182 case FormDataElement::encodedFileSystemURL: 189 case FormDataElement::encodedFileSystemURL:
183 size += e.m_fileLength - e.m_fileStart; 190 size += e.m_fileLength - e.m_fileStart;
184 break; 191 break;
185 } 192 }
186 } 193 }
187 return size; 194 return size;
188 } 195 }
189 196
197 bool FormData::isSafeToSendToAnotherThread() const
198 {
199 if (!hasOneRef())
200 return false;
201 size_t n = m_elements.size();
202 for (size_t i = 0; i < n; ++i) {
haraken 2015/08/11 10:58:45 for (auto element : m_elements) would be better.
hiroshige 2015/08/11 11:20:28 Done. (I used "auto& element" instead of "auto ele
203 if (!m_elements[i].isSafeToSendToAnotherThread())
204 return false;
205 }
206 return true;
207 }
208
190 } // namespace blink 209 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/network/FormData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698