Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[sailfishos][gecko] Backport MessageLoop contructor back (sha1 eb2dcea)
Format patch from this.
  • Loading branch information
rainemak committed May 27, 2020
1 parent 9a7bd12 commit 2bc7a02
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
16 changes: 16 additions & 0 deletions ipc/chromium/src/base/message_loop.cc
Expand Up @@ -94,6 +94,22 @@ MessageLoop* MessageLoop::current() {

static mozilla::Atomic<int32_t> message_loop_id_seq(0);

MessageLoop::MessageLoop(base::MessagePump* messagePump)
: type_(TYPE_EMBED),
id_(++message_loop_id_seq),
nestable_tasks_allowed_(true),
exception_restoration_(false),
state_(NULL),
run_depth_base_(1),
transient_hang_timeout_(0),
permanent_hang_timeout_(0),
next_sequence_num_(0)
{
DCHECK(!current()) << "should only have one message loop per thread";
get_tls_ptr().Set(this);
pump_ = messagePump;
}

MessageLoop::MessageLoop(Type type, nsIThread* aThread)
: type_(type),
id_(++message_loop_id_seq),
Expand Down
6 changes: 5 additions & 1 deletion ipc/chromium/src/base/message_loop.h
Expand Up @@ -180,12 +180,14 @@ class MessageLoop : public base::MessagePump::Delegate {
TYPE_MOZILLA_CHILD,
TYPE_MOZILLA_PARENT,
TYPE_MOZILLA_NONMAINTHREAD,
TYPE_MOZILLA_NONMAINUITHREAD
TYPE_MOZILLA_NONMAINUITHREAD,
TYPE_EMBED
};

// Normally, it is not necessary to instantiate a MessageLoop. Instead, it
// is typical to make use of the current thread's MessageLoop instance.
explicit MessageLoop(Type type = TYPE_DEFAULT, nsIThread* aThread = nullptr);
explicit MessageLoop(base::MessagePump* messagePump);
~MessageLoop();

// Returns the type passed to the constructor.
Expand Down Expand Up @@ -449,6 +451,8 @@ class MessageLoopForUI : public MessageLoop {
public:
explicit MessageLoopForUI(Type aType=TYPE_UI) : MessageLoop(aType) {
}
MessageLoopForUI(base::MessagePump* messagePump) : MessageLoop(messagePump) {
}

// Returns the MessageLoopForUI of the current thread.
static MessageLoopForUI* current() {
Expand Down

0 comments on commit 2bc7a02

Please sign in to comment.