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

Unified Diff: Source/core/html/DOMFormData.cpp

Issue 1174973003: Measure usage of FormData.append(name, blob, filename) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 years, 6 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/core/html/DOMFormData.h ('k') | Source/core/html/FormData.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/DOMFormData.cpp
diff --git a/Source/core/html/DOMFormData.cpp b/Source/core/html/DOMFormData.cpp
index 5ce324c51164613aab0286ef04439bab70d77b3e..5db962ca33aad8da9a737800b59dbb2f243558af 100644
--- a/Source/core/html/DOMFormData.cpp
+++ b/Source/core/html/DOMFormData.cpp
@@ -33,6 +33,7 @@
#include "core/fileapi/Blob.h"
#include "core/fileapi/File.h"
+#include "core/frame/UseCounter.h"
#include "core/html/HTMLFormElement.h"
#include "wtf/text/TextEncoding.h"
#include "wtf/text/WTFString.h"
@@ -97,8 +98,23 @@ void DOMFormData::append(const String& name, const String& value)
appendData(name, value);
}
-void DOMFormData::append(const String& name, Blob* blob, const String& filename)
+void DOMFormData::append(ExecutionContext* context, const String& name, Blob* blob, const String& filename)
{
+ if (blob) {
+ if (blob->isFile()) {
+ if (filename.isNull())
+ UseCounter::count(context, UseCounter::FormDataAppendFile);
+ else
+ UseCounter::count(context, UseCounter::FormDataAppendFileWithFilename);
+ } else {
+ if (filename.isNull())
+ UseCounter::count(context, UseCounter::FormDataAppendBlob);
+ else
+ UseCounter::count(context, UseCounter::FormDataAppendBlobWithFilename);
+ }
+ } else {
+ UseCounter::count(context, UseCounter::FormDataAppendNull);
+ }
appendBlob(name, blob, filename);
}
« no previous file with comments | « Source/core/html/DOMFormData.h ('k') | Source/core/html/FormData.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698