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

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: 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 "base/synchronization/waitable_event.h"
Lambros 2016/03/03 19:15:07 not used?
11 #include "net/url_request/url_request_context.h"
Lambros 2016/03/03 19:15:07 not used?
12 #include "net/url_request/url_request_context_builder.h"
13 #include "remoting/base/util.h"
14
15 namespace {
16
17 void DoNothing() {
18 }
19 } // namespace
20
21 namespace remoting {
22
23 ChromotingClientRuntime::ChromotingClientRuntime() {
nicholss 2016/03/03 00:55:16 I am going to be using this in the iOS app and am
Lambros 2016/03/03 19:15:07 We usually prefer aggregation instead of (non-inte
24 if (!base::MessageLoop::current()) {
25 VLOG(1) << "Starting main message loop";
26 ui_loop_ = new base::MessageLoop(base::MessageLoop::TYPE_UI);
Lambros 2016/03/03 19:15:07 Why are you starting a message-loop in this new co
27 base::MessageLoopForUI::current()->Attach();
28 } else {
29 VLOG(1) << "Using existing main message loop";
30 ui_loop_ = base::MessageLoopForUI::current();
31 }
32
33 VLOG(1) << "Spawning additional threads";
Lambros 2016/03/03 19:15:07 Remove this log?
34
35 // |ui_loop_| runs on the main thread, so |ui_task_runner_| will run on the
36 // main thread. We can not kill the main thread when the message loop becomes
37 // idle so the callback function does nothing (as opposed to the typical
38 // base::MessageLoop::QuitClosure())
39 ui_task_runner_ = new AutoThreadTaskRunner(ui_loop_->task_runner(),
40 base::Bind(&::DoNothing));
41
42 network_task_runner_ = AutoThread::CreateWithType(
43 "native_net", ui_task_runner_, base::MessageLoop::TYPE_IO);
44 file_task_runner_ = AutoThread::CreateWithType(
45 "native_file", ui_task_runner_, base::MessageLoop::TYPE_IO);
46
47 url_requester_ =
48 new URLRequestContextGetter(network_task_runner_, file_task_runner_);
Lambros 2016/03/03 19:15:07 Don't you need #include "remoting/base/url_request
49
50 }
51
52 // static
53 ChromotingClientRuntime* ChromotingClientRuntime::GetInstance() {
54 return base::Singleton<ChromotingClientRuntime>::get();
55 }
56
57 ChromotingClientRuntime::~ChromotingClientRuntime() {
58 }
59
60 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698