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

Side by Side Diff: jingle/glue/thread_wrapper.cc

Issue 9174012: Roll libjingle to r108. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 8 years, 11 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "jingle/glue/thread_wrapper.h" 5 #include "jingle/glue/thread_wrapper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return g_jingle_thread_wrapper.Get().Get(); 42 return g_jingle_thread_wrapper.Get().Get();
43 } 43 }
44 44
45 JingleThreadWrapper::JingleThreadWrapper(MessageLoop* message_loop) 45 JingleThreadWrapper::JingleThreadWrapper(MessageLoop* message_loop)
46 : message_loop_(message_loop), 46 : message_loop_(message_loop),
47 send_allowed_(false), 47 send_allowed_(false),
48 last_task_id_(0), 48 last_task_id_(0),
49 pending_send_event_(true, false) { 49 pending_send_event_(true, false) {
50 DCHECK_EQ(message_loop_, MessageLoop::current()); 50 DCHECK_EQ(message_loop_, MessageLoop::current());
51 51
52 talk_base::ThreadManager::SetCurrent(this); 52 talk_base::Thread* current_thread =
53 talk_base::ThreadManager::Instance()->CurrentThread();
54 if (current_thread) {
55 current_thread->UnwrapCurrent();
Sergey Ulanov 2012/01/19 01:36:22 Add DCHECK(!current_thread->Owned()); here.
56 delete current_thread;
57 }
58 talk_base::ThreadManager::Instance()->SetCurrentThread(this);
53 talk_base::MessageQueueManager::Instance()->Add(this); 59 talk_base::MessageQueueManager::Instance()->Add(this);
54 message_loop_->AddDestructionObserver(this); 60 message_loop_->AddDestructionObserver(this);
55 61
56 WrapCurrent(); 62 WrapCurrent();
57 } 63 }
58 64
59 JingleThreadWrapper::~JingleThreadWrapper() { 65 JingleThreadWrapper::~JingleThreadWrapper() {
60 } 66 }
61 67
62 void JingleThreadWrapper::WillDestroyCurrentMessageLoop() { 68 void JingleThreadWrapper::WillDestroyCurrentMessageLoop() {
63 DCHECK_EQ(talk_base::Thread::Current(), current()); 69 DCHECK_EQ(talk_base::Thread::Current(), current());
64 UnwrapCurrent(); 70 UnwrapCurrent();
65 g_jingle_thread_wrapper.Get().Set(NULL); 71 g_jingle_thread_wrapper.Get().Set(NULL);
66 talk_base::ThreadManager::SetCurrent(NULL); 72 talk_base::ThreadManager::Instance()->SetCurrentThread(NULL);
67 talk_base::MessageQueueManager::Instance()->Remove(this); 73 talk_base::MessageQueueManager::Instance()->Remove(this);
68 message_loop_->RemoveDestructionObserver(this); 74 message_loop_->RemoveDestructionObserver(this);
69 delete this; 75 delete this;
70 } 76 }
71 77
72 void JingleThreadWrapper::Post( 78 void JingleThreadWrapper::Post(
73 talk_base::MessageHandler* handler, uint32 message_id, 79 talk_base::MessageHandler* handler, uint32 message_id,
74 talk_base::MessageData* data, bool time_sensitive) { 80 talk_base::MessageData* data, bool time_sensitive) {
75 PostTaskInternal(0, handler, message_id, data); 81 PostTaskInternal(0, handler, message_id, data);
76 } 82 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 293
288 void JingleThreadWrapper::Stop() { 294 void JingleThreadWrapper::Stop() {
289 NOTREACHED(); 295 NOTREACHED();
290 } 296 }
291 297
292 void JingleThreadWrapper::Run() { 298 void JingleThreadWrapper::Run() {
293 NOTREACHED(); 299 NOTREACHED();
294 } 300 }
295 301
296 } // namespace jingle_glue 302 } // namespace jingle_glue
OLDNEW
« no previous file with comments | « content/renderer/media/peer_connection_handler_unittest.cc ('k') | third_party/libjingle/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698