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

Side by Side Diff: tools/android/forwarder2/device_forwarder_main.cc

Issue 2211473003: Remove calls to deprecated MessageLoop methods on Windows and Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR Created 4 years, 4 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
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 <signal.h> 5 #include <signal.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include <iostream> 8 #include <iostream>
9 #include <string> 9 #include <string>
10 10
11 #include "base/at_exit.h" 11 #include "base/at_exit.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/single_thread_task_runner.h"
16 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
17 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
18 #include "base/threading/thread.h" 19 #include "base/threading/thread.h"
19 #include "tools/android/forwarder2/common.h" 20 #include "tools/android/forwarder2/common.h"
20 #include "tools/android/forwarder2/daemon.h" 21 #include "tools/android/forwarder2/daemon.h"
21 #include "tools/android/forwarder2/device_controller.h" 22 #include "tools/android/forwarder2/device_controller.h"
22 #include "tools/android/forwarder2/pipe_notifier.h" 23 #include "tools/android/forwarder2/pipe_notifier.h"
23 24
24 namespace forwarder2 { 25 namespace forwarder2 {
25 namespace { 26 namespace {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 signal(SIGINT, KillHandler); 66 signal(SIGINT, KillHandler);
66 controller_thread_.reset(new base::Thread("controller_thread")); 67 controller_thread_.reset(new base::Thread("controller_thread"));
67 controller_thread_->Start(); 68 controller_thread_->Start();
68 } 69 }
69 70
70 void OnClientConnected(std::unique_ptr<Socket> client_socket) override { 71 void OnClientConnected(std::unique_ptr<Socket> client_socket) override {
71 if (initialized_) { 72 if (initialized_) {
72 client_socket->WriteString("OK"); 73 client_socket->WriteString("OK");
73 return; 74 return;
74 } 75 }
75 controller_thread_->message_loop()->PostTask( 76 controller_thread_->task_runner()->PostTask(
76 FROM_HERE, 77 FROM_HERE,
77 base::Bind(&ServerDelegate::StartController, base::Unretained(this), 78 base::Bind(&ServerDelegate::StartController, base::Unretained(this),
78 GetExitNotifierFD(), base::Passed(&client_socket))); 79 GetExitNotifierFD(), base::Passed(&client_socket)));
79 initialized_ = true; 80 initialized_ = true;
80 } 81 }
81 82
82 private: 83 private:
83 void StartController(int exit_notifier_fd, 84 void StartController(int exit_notifier_fd,
84 std::unique_ptr<Socket> client_socket) { 85 std::unique_ptr<Socket> client_socket) {
85 DCHECK(!controller_.get()); 86 DCHECK(!controller_.get());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return 1; 152 return 1;
152 return client_delegate.has_failed(); 153 return client_delegate.has_failed();
153 } 154 }
154 155
155 } // namespace 156 } // namespace
156 } // namespace forwarder2 157 } // namespace forwarder2
157 158
158 int main(int argc, char** argv) { 159 int main(int argc, char** argv) {
159 return forwarder2::RunDeviceForwarder(argc, argv); 160 return forwarder2::RunDeviceForwarder(argc, argv);
160 } 161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698