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

Unified Diff: remoting/client/ios/app_runtime.cc

Issue 2669893002: Initialize TaskScheduler in remoting processes. (Closed)
Patch Set: Created 3 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
Index: remoting/client/ios/app_runtime.cc
diff --git a/remoting/client/ios/app_runtime.cc b/remoting/client/ios/app_runtime.cc
index f03b90674ca63ecb26997ce19784467eb8cdaae4..8fe3229ad54138c867228ec7c677fbb52a207c0d 100644
--- a/remoting/client/ios/app_runtime.cc
+++ b/remoting/client/ios/app_runtime.cc
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/synchronization/waitable_event.h"
+#include "base/task_scheduler/task_scheduler.h"
#include "jingle/glue/thread_wrapper.h"
#include "net/socket/client_socket_factory.h"
#include "remoting/base/chromium_url_request.h"
@@ -28,6 +29,16 @@ namespace remoting {
namespace ios {
AppRuntime::AppRuntime() {
+ const int kMaxBackgroundThreads = 5;
+ if (TaskScheduler::GetInstance()) {
+ // Make sure TaskScheduler is initialized.
+ base::TaskScheduler::CreateAndSetSimpleTaskScheduler(kMaxBackgroundThreads);
+ }
+
+ // TODO(sergeyu): AppRuntime is not singleton, but it owns MessageLoop for the
+ // current thread. This means that it's not safe to create multiple AppRuntime
+ // instances on the same thread. AppRuntime should be a singleton, or this
+ // code needs to be moved somewhere else.
if (!base::MessageLoop::current()) {
ui_loop_.reset(new base::MessageLoopForUI());
base::MessageLoopForUI::current()->Attach();
« no previous file with comments | « no previous file | remoting/client/jni/chromoting_jni_runtime.cc » ('j') | remoting/client/jni/chromoting_jni_runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698