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

Unified Diff: remoting/host/setup/me2me_native_messaging_host_main.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
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/setup/me2me_native_messaging_host_main.cc
diff --git a/remoting/host/setup/me2me_native_messaging_host_main.cc b/remoting/host/setup/me2me_native_messaging_host_main.cc
index b7a8140e128a670fadc5f039a2f349f7c4956c11..d91e34820f507cf6dc5f55fafa8baec3b5cc7f0d 100644
--- a/remoting/host/setup/me2me_native_messaging_host_main.cc
+++ b/remoting/host/setup/me2me_native_messaging_host_main.cc
@@ -16,6 +16,7 @@
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
+#include "base/task_scheduler/task_scheduler.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
#include "net/url_request/url_fetcher.h"
@@ -51,7 +52,13 @@ using remoting::protocol::PairingRegistry;
namespace remoting {
-int StartMe2MeNativeMessagingHost() {
+int Me2MeNativeMessagingHostMain(int argc, char** argv) {
+ // This object instance is required by Chrome code (such as MessageLoop).
+ base::AtExitManager exit_manager;
+
+ base::CommandLine::Init(argc, argv);
+ remoting::InitHostLogging();
+
#if defined(OS_MACOSX)
// Needed so we don't leak objects when threads are created.
base::mac::ScopedNSAutoreleasePool pool;
@@ -79,6 +86,10 @@ int StartMe2MeNativeMessagingHost() {
// }
#endif // defined(REMOTING_ENABLE_BREAKPAD)
+ // TODO(sergeyu): Consider adding separate pools for different task classes.
+ const int kMaxBackgroundThreads = 5;
+ base::TaskScheduler::CreateAndSetSimpleTaskScheduler(kMaxBackgroundThreads);
+
// Mac OS X requires that the main thread be a UI message loop in order to
// receive distributed notifications from the System Preferences pane. An
// IO thread is needed for the pairing registry and URL context getter.
@@ -261,14 +272,4 @@ int StartMe2MeNativeMessagingHost() {
return kSuccessExitCode;
}
-int Me2MeNativeMessagingHostMain(int argc, char** argv) {
- // This object instance is required by Chrome code (such as MessageLoop).
- base::AtExitManager exit_manager;
-
- base::CommandLine::Init(argc, argv);
- remoting::InitHostLogging();
-
- return StartMe2MeNativeMessagingHost();
-}
-
} // namespace remoting
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698