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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2688473005: Replace Document::postTask with WebTaskRunner::postTask (Closed)
Patch Set: remove extra null-check: context on addConsoleMessage is now persistent 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/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 03a65cf6a6ec13f79de3710a15377b2db0ef2274..debb8e9dfe376364b9e2d597b4662bbf0ca84aa1 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -386,6 +386,10 @@ static bool s_threadedParsingEnabledForTesting = true;
// This doesn't work with non-Document ExecutionContext.
static void runAutofocusTask(ExecutionContext* context) {
+ // Document lifecycle check is done in Element::focus()
+ if (!context)
+ return;
+
Document* document = toDocument(context);
if (Element* element = document->autofocusElement()) {
document->setAutofocusElement(0);
@@ -5722,10 +5726,12 @@ static void runAddConsoleMessageTask(MessageSource source,
void Document::addConsoleMessage(ConsoleMessage* consoleMessage) {
if (!isContextThread()) {
- postTask(TaskType::Unthrottled, BLINK_FROM_HERE,
- createCrossThreadTask(
- &runAddConsoleMessageTask, consoleMessage->source(),
- consoleMessage->level(), consoleMessage->message()));
+ TaskRunnerHelper::get(TaskType::Unthrottled, this)
+ ->postTask(
+ BLINK_FROM_HERE,
+ crossThreadBind(&runAddConsoleMessageTask, consoleMessage->source(),
+ consoleMessage->level(), consoleMessage->message(),
+ wrapCrossThreadPersistent(this)));
return;
}
@@ -6312,8 +6318,9 @@ void Document::setAutofocusElement(Element* element) {
m_hasAutofocused = true;
DCHECK(!m_autofocusElement);
m_autofocusElement = element;
- postTask(TaskType::UserInteraction, BLINK_FROM_HERE,
- createSameThreadTask(&runAutofocusTask));
+ TaskRunnerHelper::get(TaskType::UserInteraction, this)
+ ->postTask(BLINK_FROM_HERE,
+ WTF::bind(&runAutofocusTask, wrapWeakPersistent(this)));
}
Element* Document::activeElement() const {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698