// We need to pretend that message loop was stopped so chromium unwinds correctly
MessageLoop *loop = MessageLoop::current();
loop->QuitNow();
+
+ // Since we forcibly shutdown our UI message loop, it is possible
+ // that important pending Tasks are simply not executed.
+ // Among these, the destruction of RenderProcessHostImpl class
+ // (scheduled with DeleteSoon) performs various process umplumbing
+ // stuff and also holds strong references of lots of other objects
+ // (e.g. URLRequestContextGetterEfl, RenderWidgetHelper,
+ // ChildProcessLauncher). Not performing the proper destruction
+ // of them might result in crashes or other undefined problems.
+ //
+ // Line below gives the message loop a extra run ('till it gets idle)
+ // to perform such pending tasks.
+ loop->RunUntilIdle();
+
// browser_main_runner must be deleted first as it depends on content_main_runner
delete browser_main_runner_;
delete content_main_runner_;
: pipe_(ecore_pipe_add(&PipeCallback, this))
, schedule_delayed_work_timer_(NULL)
, run_loop_(NULL)
+ , keep_running_(true)
, work_scheduled_(false) {
}
// FIXME: need to be implemented for tests.
void MessagePumpForUIEfl::Run(base::MessagePump::Delegate* delegate) {
- NOTREACHED();
+ DCHECK(keep_running_) << "Quit must have been called outside of Run!";
+
+ bool previous_keep_running = keep_running_;
+ keep_running_ = true;
+
+ for (;;) {
+ bool did_work = delegate->DoWork();
+ if (!keep_running_)
+ break;
+
+ base::TimeTicks next_time;
+ did_work |= delegate->DoDelayedWork(&next_time);
+ if (!keep_running_)
+ break;
+
+ if (did_work)
+ continue;
+
+ did_work = delegate->DoIdleWork();
+ if (!keep_running_)
+ break;
+ }
+
+ keep_running_ = previous_keep_running;
}
// FIXME: need to be implemented for tests.
}
pipe_ = NULL;
schedule_delayed_work_timer_ = NULL;
+ keep_running_ = false;
}
void MessagePumpForUIEfl::ScheduleWork() {