Index: remoting/client/client_context.cc |
diff --git a/remoting/client/client_context.cc b/remoting/client/client_context.cc |
index 5f6d1399ae755264331167542b55c85108dda31b..742a4922ce20ceb2d4e5bc37c48cebeac7b148ca 100644 |
--- a/remoting/client/client_context.cc |
+++ b/remoting/client/client_context.cc |
@@ -7,13 +7,15 @@ |
#include <string> |
#include "base/threading/thread.h" |
+#include "remoting/client/plugin/pepper_util.h" |
#include "remoting/jingle_glue/jingle_thread.h" |
namespace remoting { |
ClientContext::ClientContext() |
: main_thread_("ChromotingClientMainThread"), |
- decode_thread_("ChromotingClientDecodeThread") { |
+ decode_thread_("ChromotingClientDecodeThread"), |
+ started_(false) { |
} |
ClientContext::~ClientContext() { |
@@ -21,16 +23,22 @@ ClientContext::~ClientContext() { |
void ClientContext::Start() { |
// Start all the threads. |
+ DCHECK(CurrentlyOnPluginThread()); |
main_thread_.Start(); |
decode_thread_.Start(); |
jingle_thread_.Start(); |
+ started_ = true; |
} |
void ClientContext::Stop() { |
- // Stop all the threads. |
- jingle_thread_.Stop(); |
- decode_thread_.Stop(); |
- main_thread_.Stop(); |
+ DCHECK(CurrentlyOnPluginThread()); |
+ if (started_) { |
+ // Stop all the threads. |
+ jingle_thread_.Stop(); |
+ decode_thread_.Stop(); |
+ main_thread_.Stop(); |
+ started_ = false; |
+ } |
} |
JingleThread* ClientContext::jingle_thread() { |