chore: DCHECK that events are only emitted on the UI thread (#15873)

* chore: DCHECK that events are only emitted on the UI thread

* move dcheck to EmitWithEvent
This commit is contained in:
Jeremy Apthorp 2018-11-30 01:48:27 -08:00 committed by Cheng Zhao
parent 8483cb4aa7
commit 83d951db7e
4 changed files with 4 additions and 1 deletions

View file

@ -8,6 +8,7 @@
#include <vector>
#include "atom/common/api/event_emitter_caller.h"
#include "content/public/browser/browser_thread.h"
#include "native_mate/wrappable.h"
namespace content {
@ -97,6 +98,7 @@ class EventEmitter : public Wrappable<T> {
bool EmitWithEvent(const base::StringPiece& name,
v8::Local<v8::Object> event,
const Args&... args) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
EmitEvent(isolate(), GetWrapper(), name, event, args...);