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

Unified Diff: remoting/host/chromoting_host_context.cc

Issue 891663005: Add blocking IO restriction on the network thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@it2me_host_dcheck
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/host/host_signaling_manager.h » ('j') | remoting/host/remoting_me2me_host.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromoting_host_context.cc
diff --git a/remoting/host/chromoting_host_context.cc b/remoting/host/chromoting_host_context.cc
index 60e3a732c68b8e58b7c8a69a50e84171456db7b0..319cc77f1784f17a2b392d90eda5a372d646df76 100644
--- a/remoting/host/chromoting_host_context.cc
+++ b/remoting/host/chromoting_host_context.cc
@@ -4,12 +4,22 @@
#include "remoting/host/chromoting_host_context.h"
+#include "base/threading/thread_restrictions.h"
#include "content/public/browser/browser_thread.h"
#include "remoting/base/auto_thread.h"
#include "remoting/base/url_request_context_getter.h"
namespace remoting {
+namespace {
+
+void DisallowBlockingOperations() {
+ base::ThreadRestrictions::SetIOAllowed(false);
+ base::ThreadRestrictions::DisallowWaiting();
+}
+
+} // namespace
+
ChromotingHostContext::ChromotingHostContext(
scoped_refptr<AutoThreadTaskRunner> ui_task_runner,
scoped_refptr<AutoThreadTaskRunner> audio_task_runner,
@@ -96,9 +106,12 @@ scoped_ptr<ChromotingHostContext> ChromotingHostContext::Create(
scoped_refptr<AutoThreadTaskRunner> file_task_runner =
AutoThread::CreateWithType("ChromotingFileThread", ui_task_runner,
base::MessageLoop::TYPE_IO);
+
scoped_refptr<AutoThreadTaskRunner> network_task_runner =
AutoThread::CreateWithType("ChromotingNetworkThread", ui_task_runner,
base::MessageLoop::TYPE_IO);
+ network_task_runner->PostTask(FROM_HERE,
+ base::Bind(&DisallowBlockingOperations));
return make_scoped_ptr(new ChromotingHostContext(
ui_task_runner,
« no previous file with comments | « no previous file | remoting/host/host_signaling_manager.h » ('j') | remoting/host/remoting_me2me_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698