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

Side by Side Diff: remoting/host/setup/start_host_main.cc

Issue 2757063002: [Chromoting.com] start-host-main crashes (Closed)
Patch Set: Resolve review comments Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/host/setup/start_host_main.h" 5 #include "remoting/host/setup/start_host_main.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/task_scheduler/task_scheduler.h"
15 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
16 #include "build/build_config.h" 17 #include "build/build_config.h"
17 #include "net/url_request/url_fetcher.h" 18 #include "net/url_request/url_fetcher.h"
18 #include "net/url_request/url_request_context_getter.h" 19 #include "net/url_request/url_request_context_getter.h"
19 #include "remoting/base/logging.h" 20 #include "remoting/base/logging.h"
20 #include "remoting/base/oauth_helper.h" 21 #include "remoting/base/oauth_helper.h"
21 #include "remoting/base/url_request_context_getter.h" 22 #include "remoting/base/url_request_context_getter.h"
22 #include "remoting/host/service_urls.h" 23 #include "remoting/host/service_urls.h"
23 #include "remoting/host/setup/host_starter.h" 24 #include "remoting/host/setup/host_starter.h"
24 #include "remoting/host/setup/pin_validator.h" 25 #include "remoting/host/setup/pin_validator.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 base::CommandLine::ForCurrentProcess(); 124 base::CommandLine::ForCurrentProcess();
124 125
125 // This object instance is required by Chrome code (for example, 126 // This object instance is required by Chrome code (for example,
126 // FilePath, LazyInstance, MessageLoop). 127 // FilePath, LazyInstance, MessageLoop).
127 base::AtExitManager exit_manager; 128 base::AtExitManager exit_manager;
128 129
129 logging::LoggingSettings settings; 130 logging::LoggingSettings settings;
130 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 131 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
131 logging::InitLogging(settings); 132 logging::InitLogging(settings);
132 133
134 const int kMaxBackgroundThreads = 5;
135 base::TaskScheduler::CreateAndSetSimpleTaskScheduler(kMaxBackgroundThreads);
136
133 std::string host_name = command_line->GetSwitchValueASCII("name"); 137 std::string host_name = command_line->GetSwitchValueASCII("name");
134 std::string host_pin = command_line->GetSwitchValueASCII("pin"); 138 std::string host_pin = command_line->GetSwitchValueASCII("pin");
135 std::string auth_code = command_line->GetSwitchValueASCII("code"); 139 std::string auth_code = command_line->GetSwitchValueASCII("code");
136 std::string redirect_url = command_line->GetSwitchValueASCII("redirect-url"); 140 std::string redirect_url = command_line->GetSwitchValueASCII("redirect-url");
137 141
138 #if defined(OS_POSIX) 142 #if defined(OS_POSIX)
139 // Check if current user is root. If it is root, then throw an error message. 143 // Check if current user is root. If it is root, then throw an error message.
140 // This is because start_host should be run in user mode. 144 // This is because start_host should be run in user mode.
141 if (geteuid() == 0) { 145 if (geteuid() == 0) {
142 fprintf(stderr, "Refusing to run %s as root.", argv[0]); 146 fprintf(stderr, "Refusing to run %s as root.", argv[0]);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // IO thread. 238 // IO thread.
235 host_starter.reset(); 239 host_starter.reset();
236 url_request_context_getter = nullptr; 240 url_request_context_getter = nullptr;
237 241
238 io_thread.Stop(); 242 io_thread.Stop();
239 243
240 return g_started ? 0 : 1; 244 return g_started ? 0 : 1;
241 } 245 }
242 246
243 } // namespace remoting 247 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698