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

Unified Diff: Source/core/fileapi/FileReader.cpp

Issue 909043003: FileReader.result attribute should use IDL union types to avoid using custom binding. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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/fileapi/FileReader.h ('k') | Source/core/fileapi/FileReader.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fileapi/FileReader.cpp
diff --git a/Source/core/fileapi/FileReader.cpp b/Source/core/fileapi/FileReader.cpp
index d55d1b99a2861ac67792fc9f9090a62f60f3c354..e3db51ff240dbf58eb272fed69d4894c92e17ac5 100644
--- a/Source/core/fileapi/FileReader.cpp
+++ b/Source/core/fileapi/FileReader.cpp
@@ -32,6 +32,7 @@
#include "core/fileapi/FileReader.h"
#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/UnionTypesCore.h"
#include "core/dom/CrossThreadTask.h"
#include "core/dom/DOMArrayBuffer.h"
#include "core/dom/Document.h"
@@ -364,6 +365,17 @@ void FileReader::doAbort()
ThrottlingController::finishReader(executionContext(), this, finalStep);
}
+void FileReader::result(StringOrArrayBuffer& resultAttribute) const
+{
+ if (!m_loader || m_error)
+ return;
+
+ if (m_readType == FileReaderLoader::ReadAsArrayBuffer)
+ resultAttribute.setArrayBuffer(m_loader->arrayBufferResult());
+ else
+ resultAttribute.setString(m_loader->stringResult());
+}
+
void FileReader::terminate()
{
if (m_loader) {
@@ -456,20 +468,6 @@ void FileReader::fireEvent(const AtomicString& type)
InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
}
-PassRefPtr<DOMArrayBuffer> FileReader::arrayBufferResult() const
-{
- if (!m_loader || m_error)
- return nullptr;
- return m_loader->arrayBufferResult();
-}
-
-String FileReader::stringResult()
-{
- if (!m_loader || m_error)
- return String();
- return m_loader->stringResult();
-}
-
void FileReader::trace(Visitor* visitor)
{
visitor->trace(m_error);
« no previous file with comments | « Source/core/fileapi/FileReader.h ('k') | Source/core/fileapi/FileReader.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698