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

Unified Diff: third_party/WebKit/Source/modules/filesystem/DirectoryReader.cpp

Issue 2040563002: Remove FileError interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fe-dep
Patch Set: Refactor ErrorCallback Created 4 years, 5 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
Index: third_party/WebKit/Source/modules/filesystem/DirectoryReader.cpp
diff --git a/third_party/WebKit/Source/modules/filesystem/DirectoryReader.cpp b/third_party/WebKit/Source/modules/filesystem/DirectoryReader.cpp
index cda4d5750f4e8315f0f120dc1576ed4baaecfc7e..42e51034278939f0d74ea1e4573a8e5795286009 100644
--- a/third_party/WebKit/Source/modules/filesystem/DirectoryReader.cpp
+++ b/third_party/WebKit/Source/modules/filesystem/DirectoryReader.cpp
@@ -34,6 +34,7 @@
#include "modules/filesystem/EntriesCallback.h"
#include "modules/filesystem/Entry.h"
#include "modules/filesystem/ErrorCallback.h"
+#include "modules/filesystem/FileSystemCallbacks.h"
namespace blink {
@@ -60,14 +61,14 @@ private:
Member<DirectoryReader> m_reader;
};
-class DirectoryReader::ErrorCallbackHelper final : public ErrorCallback {
+class DirectoryReader::ErrorCallbackHelper final : public ErrorCallbackBase {
public:
explicit ErrorCallbackHelper(DirectoryReader* reader)
: m_reader(reader)
{
}
- void handleEvent(FileError* error) override
+ void handleEvent(FileError::ErrorCode error) override
{
m_reader->onError(error);
}
@@ -75,7 +76,7 @@ public:
DEFINE_INLINE_VIRTUAL_TRACE()
{
visitor->trace(m_reader);
- ErrorCallback::trace(visitor);
+ ErrorCallbackBase::trace(visitor);
}
private:
@@ -100,13 +101,13 @@ void DirectoryReader::readEntries(EntriesCallback* entriesCallback, ErrorCallbac
}
if (m_error) {
- filesystem()->reportError(errorCallback, m_error.get());
+ filesystem()->reportError(ScriptErrorCallback::wrap(errorCallback), m_error);
return;
}
if (m_entriesCallback) {
// Non-null m_entriesCallback means multiple readEntries() calls are made concurrently. We don't allow doing it.
- filesystem()->reportError(errorCallback, FileError::create(FileError::INVALID_STATE_ERR));
+ filesystem()->reportError(ScriptErrorCallback::wrap(errorCallback), FileError::INVALID_STATE_ERR);
return;
}
@@ -133,12 +134,13 @@ void DirectoryReader::addEntries(const EntryHeapVector& entries)
}
}
-void DirectoryReader::onError(FileError* error)
+void DirectoryReader::onError(FileError::ErrorCode error)
{
m_error = error;
m_entriesCallback = nullptr;
if (m_errorCallback) {
- ErrorCallback* errorCallback = m_errorCallback.release();
+ // TODO(jsbell): Just call m_errorCallback->handleEvent(FileError::createDOMException(error)) directly?
foolip 2016/07/12 12:42:53 Is that blocked on some additional refactoring?
jsbell 2016/07/12 17:43:51 Ah yes, I meant to ask for opinions. I'm waffling
foolip 2016/07/13 14:39:17 This looks good, an extra wrapper just to avoid th
+ ErrorCallbackBase* errorCallback = ScriptErrorCallback::wrap(m_errorCallback.release());
errorCallback->handleEvent(error);
}
}
@@ -146,7 +148,6 @@ void DirectoryReader::onError(FileError* error)
DEFINE_TRACE(DirectoryReader)
{
visitor->trace(m_entries);
- visitor->trace(m_error);
visitor->trace(m_entriesCallback);
visitor->trace(m_errorCallback);
DirectoryReaderBase::trace(visitor);

Powered by Google App Engine
This is Rietveld 408576698