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

Unified Diff: Source/platform/network/FormData.cpp

Issue 232053005: Implement navigator.sendBeacon() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Revert CSP checking on redirects Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/network/FormData.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/network/FormData.cpp
diff --git a/Source/platform/network/FormData.cpp b/Source/platform/network/FormData.cpp
index 5898e7c379313d3b20c3867e9cfa21eb0eae68f5..bdf4e3151d50b25642fed83142dfe6199fa5bd92 100644
--- a/Source/platform/network/FormData.cpp
+++ b/Source/platform/network/FormData.cpp
@@ -162,4 +162,29 @@ String FormData::flattenToString() const
return Latin1Encoding().decode(reinterpret_cast<const char*>(bytes.data()), bytes.size());
}
+unsigned long long FormData::sizeInBytes() const
+{
+ unsigned size = 0;
+ size_t n = m_elements.size();
+ for (size_t i = 0; i < n; ++i) {
+ const FormDataElement& e = m_elements[i];
+ switch (e.m_type) {
+ case FormDataElement::data:
+ size += e.m_data.size();
+ break;
+ case FormDataElement::encodedFile:
+ size += e.m_fileLength - e.m_fileStart;
+ break;
+ case FormDataElement::encodedBlob:
+ if (e.m_optionalBlobDataHandle)
+ size += e.m_optionalBlobDataHandle->size();
+ break;
+ case FormDataElement::encodedFileSystemURL:
+ size += e.m_fileLength - e.m_fileStart;
+ break;
+ }
+ }
+ return size;
+}
+
} // namespace WebCore
« 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