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

Side by Side Diff: remoting/client/chromoting_client_runtime.cc

Issue 1764503002: Adding container class for chromoting client runtimes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing ios version, using runtime in jni runtime. Created 4 years, 9 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
OLDNEW
(Empty)
1 // Copyright 2016 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/chromoting_client_runtime.h"
6
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "base/memory/singleton.h"
10 #include "remoting/base/url_request_context_getter.h"
11
12 namespace remoting {
13
14 ChromotingClientRuntime::ChromotingClientRuntime() {
15 if (!base::MessageLoop::current()) {
16 VLOG(1) << "Starting main message loop";
17 ui_loop_ = new base::MessageLoop(base::MessageLoop::TYPE_UI);
18 base::MessageLoopForUI::current()->Attach();
19 } else {
20 VLOG(1) << "Using existing main message loop";
21 ui_loop_ = base::MessageLoopForUI::current();
22 }
23
24 // |ui_loop_| runs on the main thread, so |ui_task_runner_| will run on the
25 // main thread. We can not kill the main thread when the message loop becomes
26 // idle so the callback function does nothing (as opposed to the typical
27 // base::MessageLoop::QuitClosure())
28 ui_task_runner_ = new AutoThreadTaskRunner(ui_loop_->task_runner(),
29 base::Bind(&base::DoNothing));
30
31 network_task_runner_ = AutoThread::CreateWithType("native_net",
32 ui_task_runner_,
33 base::MessageLoop::TYPE_IO);
34 file_task_runner_ = AutoThread::CreateWithType("native_file",
35 ui_task_runner_,
36 base::MessageLoop::TYPE_IO);
37
38 url_requester_ =
39 new URLRequestContextGetter(network_task_runner_, file_task_runner_);
40 }
41
42 // static
43 ChromotingClientRuntime* ChromotingClientRuntime::GetInstance() {
44 return base::Singleton<ChromotingClientRuntime>::get();
45 }
46
47 ChromotingClientRuntime::~ChromotingClientRuntime() {}
48
49 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698