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

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

Issue 585133002: Use SafeWrapCurrent to make sure JingleThreadWrapper ctor does not fail. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 : rtc::Thread(new rtc::NullSocketServer()), 50 : rtc::Thread(new rtc::NullSocketServer()),
51 task_runner_(task_runner), 51 task_runner_(task_runner),
52 send_allowed_(false), 52 send_allowed_(false),
53 last_task_id_(0), 53 last_task_id_(0),
54 pending_send_event_(true, false), 54 pending_send_event_(true, false),
55 weak_ptr_factory_(this) { 55 weak_ptr_factory_(this) {
56 DCHECK(task_runner->BelongsToCurrentThread()); 56 DCHECK(task_runner->BelongsToCurrentThread());
57 DCHECK(!rtc::Thread::Current()); 57 DCHECK(!rtc::Thread::Current());
58 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); 58 weak_ptr_ = weak_ptr_factory_.GetWeakPtr();
59 rtc::MessageQueueManager::Add(this); 59 rtc::MessageQueueManager::Add(this);
60 CHECK(WrapCurrent()); 60 SafeWrapCurrent();
61 } 61 }
62 62
63 JingleThreadWrapper::~JingleThreadWrapper() { 63 JingleThreadWrapper::~JingleThreadWrapper() {
64 Clear(NULL, rtc::MQID_ANY, NULL); 64 Clear(NULL, rtc::MQID_ANY, NULL);
65 } 65 }
66 66
67 void JingleThreadWrapper::WillDestroyCurrentMessageLoop() { 67 void JingleThreadWrapper::WillDestroyCurrentMessageLoop() {
68 DCHECK_EQ(rtc::Thread::Current(), current()); 68 DCHECK_EQ(rtc::Thread::Current(), current());
69 UnwrapCurrent(); 69 UnwrapCurrent();
70 g_jingle_thread_wrapper.Get().Set(NULL); 70 g_jingle_thread_wrapper.Get().Set(NULL);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 293
294 void JingleThreadWrapper::Stop() { 294 void JingleThreadWrapper::Stop() {
295 NOTREACHED(); 295 NOTREACHED();
296 } 296 }
297 297
298 void JingleThreadWrapper::Run() { 298 void JingleThreadWrapper::Run() {
299 NOTREACHED(); 299 NOTREACHED();
300 } 300 }
301 301
302 } // namespace jingle_glue 302 } // namespace jingle_glue
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698