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

Unified Diff: Source/core/workers/WorkerEventQueue.cpp

Issue 1241613004: Rework dispatchEvent so it is consistent for isTrusted support. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Work around MSVC optimization bug Created 5 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: Source/core/workers/WorkerEventQueue.cpp
diff --git a/Source/core/workers/WorkerEventQueue.cpp b/Source/core/workers/WorkerEventQueue.cpp
index a8d52068d62ec21c33eb52c3a305fd15389c5e57..a3e677c3fc5ead4f5e57ab875d676590a61e8509 100644
--- a/Source/core/workers/WorkerEventQueue.cpp
+++ b/Source/core/workers/WorkerEventQueue.cpp
@@ -72,8 +72,13 @@ public:
m_eventQueue->removeEvent(m_event.get());
}
- void dispatchEvent(ExecutionContext*, PassRefPtrWillBeRawPtr<Event> event)
+ void dispatchEvent(ExecutionContext*, PassRefPtrWillBeRawPtr<Event> prpEvent)
{
+ // Stash the event on the stack in a RefPtrWillBeRawPtr; trying to do this
+ // in a single line causes an optimization bug with MSVC. MSVC generates code
+ // that passes the event arg (forcing PassRefPtrWillBeRawPtr to be released)
+ // before the target is queried.
tkent 2015/07/16 00:22:03 Wow, nice detective work.
+ RefPtrWillBeRawPtr<Event> event = prpEvent;
event->target()->dispatchEvent(event);
}

Powered by Google App Engine
This is Rietveld 408576698