Delete BridgeTaskRunner when main message loop is ready

This commit is contained in:
Cheng Zhao 2015-11-30 22:29:01 +08:00
parent a7dd6596f1
commit 44e24ebf7a
3 changed files with 5 additions and 9 deletions

View file

@ -114,7 +114,8 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() {
1000)); 1000));
brightray::BrowserMainParts::PreMainMessageLoopRun(); brightray::BrowserMainParts::PreMainMessageLoopRun();
BridgeTaskRunner::MessageLoopIsReady(); bridge_task_runner_->MessageLoopIsReady();
bridge_task_runner_ = nullptr;
#if defined(USE_X11) #if defined(USE_X11)
libgtk2ui::GtkInitFromCommandLine(*base::CommandLine::ForCurrentProcess()); libgtk2ui::GtkInitFromCommandLine(*base::CommandLine::ForCurrentProcess());

View file

@ -8,11 +8,6 @@
namespace atom { namespace atom {
// static
std::vector<BridgeTaskRunner::TaskPair> BridgeTaskRunner::tasks_;
std::vector<BridgeTaskRunner::TaskPair> BridgeTaskRunner::non_nestable_tasks_;
// static
void BridgeTaskRunner::MessageLoopIsReady() { void BridgeTaskRunner::MessageLoopIsReady() {
auto message_loop = base::MessageLoop::current(); auto message_loop = base::MessageLoop::current();
CHECK(message_loop); CHECK(message_loop);

View file

@ -20,7 +20,7 @@ class BridgeTaskRunner : public base::SingleThreadTaskRunner {
~BridgeTaskRunner() override {} ~BridgeTaskRunner() override {}
// Called when message loop is ready. // Called when message loop is ready.
static void MessageLoopIsReady(); void MessageLoopIsReady();
// base::SingleThreadTaskRunner: // base::SingleThreadTaskRunner:
bool PostDelayedTask(const tracked_objects::Location& from_here, bool PostDelayedTask(const tracked_objects::Location& from_here,
@ -35,8 +35,8 @@ class BridgeTaskRunner : public base::SingleThreadTaskRunner {
private: private:
using TaskPair = base::Tuple< using TaskPair = base::Tuple<
tracked_objects::Location, base::Closure, base::TimeDelta>; tracked_objects::Location, base::Closure, base::TimeDelta>;
static std::vector<TaskPair> tasks_; std::vector<TaskPair> tasks_;
static std::vector<TaskPair> non_nestable_tasks_; std::vector<TaskPair> non_nestable_tasks_;
DISALLOW_COPY_AND_ASSIGN(BridgeTaskRunner); DISALLOW_COPY_AND_ASSIGN(BridgeTaskRunner);
}; };