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

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

Issue 2080343003: Remove calls to MessageLoop::current() in remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
15 #include "build/build_config.h" 16 #include "build/build_config.h"
16 #include "net/url_request/url_fetcher.h" 17 #include "net/url_request/url_fetcher.h"
17 #include "net/url_request/url_request_context_getter.h" 18 #include "net/url_request/url_request_context_getter.h"
18 #include "remoting/base/logging.h" 19 #include "remoting/base/logging.h"
19 #include "remoting/base/url_request_context_getter.h" 20 #include "remoting/base/url_request_context_getter.h"
20 #include "remoting/host/service_urls.h" 21 #include "remoting/host/service_urls.h"
21 #include "remoting/host/setup/host_starter.h" 22 #include "remoting/host/setup/host_starter.h"
22 #include "remoting/host/setup/oauth_helper.h" 23 #include "remoting/host/setup/oauth_helper.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return std::string(); 80 return std::string();
80 size_t newline_index = str.find('\n'); 81 size_t newline_index = str.find('\n');
81 if (newline_index != std::string::npos) 82 if (newline_index != std::string::npos)
82 str[newline_index] = '\0'; 83 str[newline_index] = '\0';
83 str.resize(strlen(&str[0])); 84 str.resize(strlen(&str[0]));
84 return str; 85 return str;
85 } 86 }
86 87
87 // Called when the HostStarter has finished. 88 // Called when the HostStarter has finished.
88 void OnDone(HostStarter::Result result) { 89 void OnDone(HostStarter::Result result) {
89 if (base::MessageLoop::current() != g_message_loop) { 90 if (!g_message_loop->task_runner()->BelongsToCurrentThread()) {
90 g_message_loop->PostTask(FROM_HERE, base::Bind(&OnDone, result)); 91 g_message_loop->PostTask(FROM_HERE, base::Bind(&OnDone, result));
91 return; 92 return;
92 } 93 }
93 switch (result) { 94 switch (result) {
94 case HostStarter::START_COMPLETE: 95 case HostStarter::START_COMPLETE:
95 g_started = true; 96 g_started = true;
96 break; 97 break;
97 case HostStarter::NETWORK_ERROR: 98 case HostStarter::NETWORK_ERROR:
98 fprintf(stderr, "Couldn't start host: network error.\n"); 99 fprintf(stderr, "Couldn't start host: network error.\n");
99 break; 100 break;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // Destroy the HostStarter and URLRequestContextGetter before stopping the 232 // Destroy the HostStarter and URLRequestContextGetter before stopping the
232 // IO thread. 233 // IO thread.
233 host_starter.reset(); 234 host_starter.reset();
234 url_request_context_getter = nullptr; 235 url_request_context_getter = nullptr;
235 236
236 io_thread.Stop(); 237 io_thread.Stop();
237 238
238 return g_started ? 0 : 1; 239 return g_started ? 0 : 1;
239 } 240 }
240 241
241 } // namespace remoting 242 } // 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