| Index: third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp
|
| diff --git a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp
|
| index 619f3c801317714b8dd2909811cfdfc35c28e272..e894cd223150ae6ce9aee243bc9a5edf967f06a2 100644
|
| --- a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp
|
| +++ b/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp
|
| @@ -31,6 +31,7 @@
|
| #include "modules/filesystem/DOMFileSystem.h"
|
|
|
| #include "core/fileapi/BlobCallback.h"
|
| +#include "core/inspector/InspectorInstrumentation.h"
|
| #include "modules/filesystem/DOMFilePath.h"
|
| #include "modules/filesystem/DirectoryEntry.h"
|
| #include "modules/filesystem/FileEntry.h"
|
| @@ -40,6 +41,7 @@
|
| #include "modules/filesystem/FileWriterCallback.h"
|
| #include "modules/filesystem/MetadataCallback.h"
|
| #include "platform/FileMetadata.h"
|
| +#include "platform/WebTaskRunner.h"
|
| #include "platform/weborigin/SecurityOrigin.h"
|
| #include "public/platform/Platform.h"
|
| #include "public/platform/WebFileSystem.h"
|
| @@ -51,6 +53,20 @@
|
|
|
| namespace blink {
|
|
|
| +namespace {
|
| +
|
| +void runCallback(ExecutionContext* executionContext,
|
| + std::unique_ptr<WTF::Closure> task) {
|
| + if (!executionContext)
|
| + return;
|
| + DCHECK(executionContext->isContextThread());
|
| + InspectorInstrumentation::AsyncTask asyncTask(executionContext, task.get(),
|
| + true /* isInstrumented */);
|
| + (*task)();
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| // static
|
| DOMFileSystem* DOMFileSystem::create(ExecutionContext* context,
|
| const String& name,
|
| @@ -122,10 +138,10 @@ void DOMFileSystem::reportError(ErrorCallbackBase* errorCallback,
|
| void DOMFileSystem::reportError(ExecutionContext* executionContext,
|
| ErrorCallbackBase* errorCallback,
|
| FileError::ErrorCode fileError) {
|
| - if (errorCallback)
|
| - scheduleCallback(
|
| - executionContext,
|
| - createSameThreadTask(&ErrorCallbackBase::invoke,
|
| + if (!errorCallback)
|
| + return;
|
| + scheduleCallback(executionContext,
|
| + WTF::bind(&ErrorCallbackBase::invoke,
|
| wrapPersistent(errorCallback), fileError));
|
| }
|
|
|
| @@ -189,6 +205,17 @@ void DOMFileSystem::createFile(const FileEntry* fileEntry,
|
| successCallback, errorCallback, m_context));
|
| }
|
|
|
| +void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext,
|
| + std::unique_ptr<WTF::Closure> task) {
|
| + DCHECK(executionContext->isContextThread());
|
| + InspectorInstrumentation::asyncTaskScheduled(
|
| + executionContext, taskNameForInstrumentation(), task.get());
|
| + TaskRunnerHelper::get(TaskType::FileReading, executionContext)
|
| + ->postTask(BLINK_FROM_HERE,
|
| + WTF::bind(&runCallback, wrapWeakPersistent(executionContext),
|
| + WTF::passed(std::move(task))));
|
| +}
|
| +
|
| DEFINE_TRACE(DOMFileSystem) {
|
| DOMFileSystemBase::trace(visitor);
|
| ContextLifecycleObserver::trace(visitor);
|
|
|