| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "remoting/client/ios/app_runtime.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "base/bind_helpers.h" | |
| 9 #include "base/logging.h" | |
| 10 #include "base/memory/ptr_util.h" | |
| 11 #include "base/synchronization/waitable_event.h" | |
| 12 #include "base/task_scheduler/task_scheduler.h" | |
| 13 #include "jingle/glue/thread_wrapper.h" | |
| 14 #include "net/socket/client_socket_factory.h" | |
| 15 #include "remoting/base/chromium_url_request.h" | |
| 16 #include "remoting/base/url_request_context_getter.h" | |
| 17 #include "remoting/client/audio_player.h" | |
| 18 #include "remoting/client/client_status_logger.h" | |
| 19 #include "remoting/client/ios/bridge/client_proxy.h" | |
| 20 #include "remoting/proto/event.pb.h" | |
| 21 #include "remoting/protocol/chromium_port_allocator_factory.h" | |
| 22 #include "remoting/protocol/client_authentication_config.h" | |
| 23 #include "remoting/protocol/host_stub.h" | |
| 24 #include "remoting/protocol/negotiating_client_authenticator.h" | |
| 25 #include "remoting/protocol/transport_context.h" | |
| 26 #include "remoting/signaling/delegating_signal_strategy.h" | |
| 27 | |
| 28 namespace remoting { | |
| 29 namespace ios { | |
| 30 | |
| 31 AppRuntime::AppRuntime() { | |
| 32 if (!base::TaskScheduler::GetInstance()) { | |
| 33 // Make sure TaskScheduler is initialized. | |
| 34 base::TaskScheduler::CreateAndSetSimpleTaskScheduler("RemotingIos"); | |
| 35 } | |
| 36 | |
| 37 // TODO(sergeyu): AppRuntime is not singleton, but it owns MessageLoop for the | |
| 38 // current thread. This means that it's not safe to create multiple AppRuntime | |
| 39 // instances on the same thread. AppRuntime should be a singleton, or this | |
| 40 // code needs to be moved somewhere else. | |
| 41 if (!base::MessageLoop::current()) { | |
| 42 ui_loop_.reset(new base::MessageLoopForUI()); | |
| 43 base::MessageLoopForUI::current()->Attach(); | |
| 44 } else { | |
| 45 ui_loop_.reset(base::MessageLoopForUI::current()); | |
| 46 } | |
| 47 runtime_ = ChromotingClientRuntime::Create(ui_loop_.get()); | |
| 48 } | |
| 49 | |
| 50 AppRuntime::~AppRuntime() { | |
| 51 // TODO(nicholss): Shutdown the app. | |
| 52 } | |
| 53 | |
| 54 } // namespace ios | |
| 55 } // namespace remoting | |
| OLD | NEW |