Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(545)

Unified Diff: remoting/jingle_glue/jingle_thread.cc

Issue 6003003: Fix crash in JingleThread caused by non-nestable tasks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/sync
Patch Set: - Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/jingle_glue/jingle_thread_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/jingle_glue/jingle_thread.cc
diff --git a/remoting/jingle_glue/jingle_thread.cc b/remoting/jingle_glue/jingle_thread.cc
index 25f646a1510cf9c807475af90f74eccc545085f1..b8bc42874a8515f16d7170b97c451a138da3368d 100644
--- a/remoting/jingle_glue/jingle_thread.cc
+++ b/remoting/jingle_glue/jingle_thread.cc
@@ -42,12 +42,6 @@ class JingleThread::JingleMessagePump : public base::MessagePump,
// TODO(sergeyu): Remove it when JingleThread moved on Chromium's
// base::Thread.
base::MessagePump::Delegate* delegate = thread_->message_loop();
- // Loop until we run out of work.
- while (true) {
- if (!delegate->DoWork())
- break;
- }
-
// Process all pending tasks.
while (true) {
if (delegate->DoWork())
@@ -61,7 +55,6 @@ class JingleThread::JingleMessagePump : public base::MessagePump,
}
private:
-
void ScheduleNextDelayedTask() {
DCHECK_EQ(thread_->message_loop(), MessageLoop::current());
@@ -86,6 +79,16 @@ class JingleThread::JingleMessageLoop : public MessageLoop {
: MessageLoop(MessageLoop::TYPE_IO) {
pump_ = new JingleMessagePump(thread);
}
+
+ void Initialize() {
+ jingle_message_loop_state_.reset(new AutoRunState(this));
+ }
+
+ private:
+ // AutoRunState sets |state_| for this message loop. It needs to be
+ // created here because we never call Run() or RunAllPending() for
+ // the thread.
+ scoped_ptr<AutoRunState> jingle_message_loop_state_;
};
TaskPump::TaskPump() {
@@ -119,6 +122,7 @@ void JingleThread::Start() {
void JingleThread::Run() {
JingleMessageLoop message_loop(this);
+ message_loop.Initialize();
message_loop_ = &message_loop;
TaskPump task_pump;
« no previous file with comments | « no previous file | remoting/jingle_glue/jingle_thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698