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

Unified Diff: third_party/WebKit/Source/core/clipboard/DataTransferItem.cpp

Issue 2680013008: Reduce use of ExecutionContextTask in core/ (Closed)
Patch Set: fix stacktrace Created 3 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 | « no previous file | third_party/WebKit/Source/core/fileapi/FileReader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/clipboard/DataTransferItem.cpp
diff --git a/third_party/WebKit/Source/core/clipboard/DataTransferItem.cpp b/third_party/WebKit/Source/core/clipboard/DataTransferItem.cpp
index 910c50a9ab0ea6416dac200fd2a59ea2b8cb6ba5..f57a13668ee86f91282f465183821c5e844d5934 100644
--- a/third_party/WebKit/Source/core/clipboard/DataTransferItem.cpp
+++ b/third_party/WebKit/Source/core/clipboard/DataTransferItem.cpp
@@ -33,10 +33,9 @@
#include "bindings/core/v8/V8Binding.h"
#include "core/clipboard/DataObjectItem.h"
#include "core/clipboard/DataTransfer.h"
-#include "core/dom/ExecutionContext.h"
-#include "core/dom/ExecutionContextTask.h"
#include "core/dom/StringCallback.h"
#include "core/dom/TaskRunnerHelper.h"
+#include "core/inspector/InspectorInstrumentation.h"
#include "public/platform/WebTraceLocation.h"
#include "wtf/StdLibExtras.h"
#include "wtf/text/WTFString.h"
@@ -69,6 +68,14 @@ String DataTransferItem::type() const {
return m_item->type();
}
+static void runGetAsStringTask(ExecutionContext* context,
+ StringCallback* callback,
+ const String& data) {
+ InspectorInstrumentation::AsyncTask asyncTask(context, callback);
+ if (context)
+ callback->handleEvent(data);
+}
+
void DataTransferItem::getAsString(ScriptState* scriptState,
StringCallback* callback) const {
if (!m_dataTransfer->canReadData())
@@ -76,11 +83,13 @@ void DataTransferItem::getAsString(ScriptState* scriptState,
if (!callback || m_item->kind() != DataObjectItem::StringKind)
return;
- scriptState->getExecutionContext()->postTask(
- TaskType::UserInteraction, BLINK_FROM_HERE,
- createSameThreadTask(&StringCallback::handleEvent,
- wrapPersistent(callback), m_item->getAsString()),
- "DataTransferItem.getAsString");
+ ExecutionContext* context = scriptState->getExecutionContext();
+ InspectorInstrumentation::asyncTaskScheduled(
+ context, "DataTransferItem.getAsString", callback);
haraken 2017/02/10 05:53:14 Not directly related to this CL, on what tasks do
tzik 2017/02/10 06:13:19 Conceptually, JS-initiated asynchronous tasks that
+ TaskRunnerHelper::get(TaskType::UserInteraction, context)
+ ->postTask(BLINK_FROM_HERE,
+ WTF::bind(&runGetAsStringTask, wrapWeakPersistent(context),
+ wrapPersistent(callback), m_item->getAsString()));
}
File* DataTransferItem::getAsFile() const {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fileapi/FileReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698