From c590d9adb8051f13c2e457c08726b7def0ae4f6d Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Wed, 7 Jun 2017 16:20:24 -0700 Subject: [PATCH] Bug 1383322 - Allow changing the current MessageLoop (r=dvander) MozReview-Commit-ID: 1kyHqrhOzjF --- ipc/chromium/src/base/message_loop.cc | 5 +++++ ipc/chromium/src/base/message_loop.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/ipc/chromium/src/base/message_loop.cc b/ipc/chromium/src/base/message_loop.cc index 21043da4c094..9524d97fb9b0 100644 --- a/ipc/chromium/src/base/message_loop.cc +++ b/ipc/chromium/src/base/message_loop.cc @@ -168,6 +168,11 @@ MessageLoop* MessageLoop::current() { return get_tls_ptr().Get(); } +// static +void MessageLoop::set_current(MessageLoop* loop) { + get_tls_ptr().Set(loop); +} + static mozilla::Atomic message_loop_id_seq(0); MessageLoop::MessageLoop(Type type, nsIThread* aThread) diff --git a/ipc/chromium/src/base/message_loop.h b/ipc/chromium/src/base/message_loop.h index 2a7b390437b3..6f6d04840556 100644 --- a/ipc/chromium/src/base/message_loop.h +++ b/ipc/chromium/src/base/message_loop.h @@ -219,6 +219,8 @@ public: // Returns the MessageLoop object for the current thread, or null if none. static MessageLoop* current(); + static void set_current(MessageLoop* loop); + // Enables or disables the recursive task processing. This happens in the case // of recursive message loops. Some unwanted message loop may occurs when // using common controls or printer functions. By default, recursive task