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

Side by Side Diff: remoting/client/ios/app_runtime.cc

Issue 2669893002: Initialize TaskScheduler in remoting processes. (Closed)
Patch Set: . Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | remoting/client/jni/chromoting_jni_runtime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/client/ios/app_runtime.h" 5 #include "remoting/client/ios/app_runtime.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "base/task_scheduler/task_scheduler.h"
12 #include "jingle/glue/thread_wrapper.h" 13 #include "jingle/glue/thread_wrapper.h"
13 #include "net/socket/client_socket_factory.h" 14 #include "net/socket/client_socket_factory.h"
14 #include "remoting/base/chromium_url_request.h" 15 #include "remoting/base/chromium_url_request.h"
15 #include "remoting/base/url_request_context_getter.h" 16 #include "remoting/base/url_request_context_getter.h"
16 #include "remoting/client/audio_player.h" 17 #include "remoting/client/audio_player.h"
17 #include "remoting/client/client_status_logger.h" 18 #include "remoting/client/client_status_logger.h"
18 #include "remoting/client/ios/bridge/client_proxy.h" 19 #include "remoting/client/ios/bridge/client_proxy.h"
19 #include "remoting/proto/event.pb.h" 20 #include "remoting/proto/event.pb.h"
20 #include "remoting/protocol/chromium_port_allocator_factory.h" 21 #include "remoting/protocol/chromium_port_allocator_factory.h"
21 #include "remoting/protocol/client_authentication_config.h" 22 #include "remoting/protocol/client_authentication_config.h"
22 #include "remoting/protocol/host_stub.h" 23 #include "remoting/protocol/host_stub.h"
23 #include "remoting/protocol/negotiating_client_authenticator.h" 24 #include "remoting/protocol/negotiating_client_authenticator.h"
24 #include "remoting/protocol/transport_context.h" 25 #include "remoting/protocol/transport_context.h"
25 #include "remoting/signaling/delegating_signal_strategy.h" 26 #include "remoting/signaling/delegating_signal_strategy.h"
26 27
27 namespace remoting { 28 namespace remoting {
28 namespace ios { 29 namespace ios {
29 30
30 AppRuntime::AppRuntime() { 31 AppRuntime::AppRuntime() {
32 // TODO(sergeyu): Consider adding separate pools for different task classes.
33 const int kMaxBackgroundThreads = 5;
34 if (TaskScheduler::GetInstance()) {
35 // Make sure TaskScheduler is initialized.
36 base::TaskScheduler::CreateAndSetSimpleTaskScheduler(kMaxBackgroundThreads);
37 }
38
39 // TODO(sergeyu): AppRuntime is not singleton, but it owns MessageLoop for the
40 // current thread. This means that it's not safe to create multiple AppRuntime
41 // instances on the same thread. AppRuntime should be a singleton, or this
42 // code needs to be moved somewhere else.
31 if (!base::MessageLoop::current()) { 43 if (!base::MessageLoop::current()) {
32 ui_loop_.reset(new base::MessageLoopForUI()); 44 ui_loop_.reset(new base::MessageLoopForUI());
33 base::MessageLoopForUI::current()->Attach(); 45 base::MessageLoopForUI::current()->Attach();
34 } else { 46 } else {
35 ui_loop_.reset(base::MessageLoopForUI::current()); 47 ui_loop_.reset(base::MessageLoopForUI::current());
36 } 48 }
37 runtime_ = ChromotingClientRuntime::Create(ui_loop_.get()); 49 runtime_ = ChromotingClientRuntime::Create(ui_loop_.get());
38 } 50 }
39 51
40 AppRuntime::~AppRuntime() { 52 AppRuntime::~AppRuntime() {
41 // TODO(nicholss): Shutdown the app. 53 // TODO(nicholss): Shutdown the app.
42 } 54 }
43 55
44 } // namespace ios 56 } // namespace ios
45 } // namespace remoting 57 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/client/jni/chromoting_jni_runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698