summaryrefslogtreecommitdiffstats
path: root/jingle/glue/thread_wrapper.h
diff options
context:
space:
mode:
authorsergeyu <sergeyu@chromium.org>2015-01-26 18:53:53 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-27 02:55:09 +0000
commit8eb15cc4766a09c82d0e4f60739b7675f23d4e60 (patch)
tree1d622047555da4ba9eb96009ecb10dd5df79d387 /jingle/glue/thread_wrapper.h
parentc247da12fcca15fdcc948024287b94d6e63e9784 (diff)
downloadchromium_src-8eb15cc4766a09c82d0e4f60739b7675f23d4e60.zip
chromium_src-8eb15cc4766a09c82d0e4f60739b7675f23d4e60.tar.gz
chromium_src-8eb15cc4766a09c82d0e4f60739b7675f23d4e60.tar.bz2
Fix JingleThreadWrapper initialization in PNaCl plugin.
Previously JingleThreadWrapper was initialized in the remoting PNaCl plugin such that JingleThreadWrapper::current() was always returning NULL. JingleThreadWrapper::current() is used only to implement rtc::Thread::Send() and until recently Send() wasn't used in the parts of webrtc used in remoting. Now rtc::StunRequest uses Send(), which crashes the plugin. Added JingleThreadWrapper::WrapTaskRunner() that properly initializes current() and is used in the remoting plugin now. Also JingleThreadWrapper is no longer passes SocketServer to the parent as it is no longer necessary. BUG=451643 Review URL: https://codereview.chromium.org/876433003 Cr-Commit-Position: refs/heads/master@{#313213}
Diffstat (limited to 'jingle/glue/thread_wrapper.h')
-rw-r--r--jingle/glue/thread_wrapper.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/jingle/glue/thread_wrapper.h b/jingle/glue/thread_wrapper.h
index 6a045bf..7969d2b 100644
--- a/jingle/glue/thread_wrapper.h
+++ b/jingle/glue/thread_wrapper.h
@@ -35,13 +35,15 @@ class JingleThreadWrapper : public base::MessageLoop::DestructionObserver,
// MessageLoop is destroyed.
static void EnsureForCurrentMessageLoop();
- // Returns thread wrapper for the current thread. NULL is returned
- // if EnsureForCurrentMessageLoop() has never been called for this
- // thread.
+ // Creates JingleThreadWrapper for |task_runner| that runs tasks on the
+ // current thread.
+ static scoped_ptr<JingleThreadWrapper> WrapTaskRunner(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+
+ // Returns thread wrapper for the current thread or nullptr if it doesn't
+ // exist.
static JingleThreadWrapper* current();
- explicit JingleThreadWrapper(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner);
~JingleThreadWrapper() override;
// Sets whether the thread can be used to send messages
@@ -95,6 +97,9 @@ class JingleThreadWrapper : public base::MessageLoop::DestructionObserver,
typedef std::map<int, rtc::Message> MessagesQueue;
struct PendingSend;
+ explicit JingleThreadWrapper(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+
void PostTaskInternal(
int delay_ms, rtc::MessageHandler* handler,
uint32 message_id, rtc::MessageData* data);