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

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

Issue 11148018: Upstream the android python scripts changes that enable the new Forwarder2 to be used in our test f… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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 | « content/content_tests.gypi ('k') | tools/android/forwarder2/host_controller.cc » ('j') | 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 <signal.h> 5 #include <signal.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "tools/android/common/daemon.h" 14 #include "tools/android/common/daemon.h"
15 #include "tools/android/forwarder2/device_controller.h" 15 #include "tools/android/forwarder2/device_controller.h"
16 #include "tools/android/forwarder2/pipe_notifier.h" 16 #include "tools/android/forwarder2/pipe_notifier.h"
17 17
18 namespace { 18 namespace {
19 19
20 // Leaky global instance, accessed from the signal handler. 20 // Leaky global instance, accessed from the signal handler.
21 forwarder2::PipeNotifier* g_notifier = NULL; 21 forwarder2::PipeNotifier* g_notifier = NULL;
22 22
23 // Unix domain socket name for Device Controller. 23 // Unix domain socket name for Device Controller.
24 const char kDefaultAdbSocket[] = "chrome_device_forwarder"; 24 const char kDefaultAdbSocket[] = "chrome_device_forwarder";
25 25
26 void KillHandler(int /* unused */) { 26 void KillHandler(int /* unused */) {
27 CHECK(g_notifier); 27 CHECK(g_notifier);
28 if (!g_notifier->Notify()) 28 if (!g_notifier->Notify())
29 exit(-1); 29 exit(1);
30 } 30 }
31 31
32 } // namespace 32 } // namespace
33 33
34 int main(int argc, char** argv) { 34 int main(int argc, char** argv) {
35 printf("Device forwarder to forward connections to the Host machine.\n"); 35 printf("Device forwarder to forward connections to the Host machine.\n");
36 printf("Like 'adb forward' but in the reverse direction\n"); 36 printf("Like 'adb forward' but in the reverse direction\n");
37 37
38 CommandLine command_line(argc, argv); 38 CommandLine command_line(argc, argv);
39 std::string adb_socket_path = command_line.GetSwitchValueASCII("adb_sock"); 39 std::string adb_socket_path = command_line.GetSwitchValueASCII("adb_sock");
(...skipping 17 matching lines...) Expand all
57 signal(SIGTERM, KillHandler); 57 signal(SIGTERM, KillHandler);
58 signal(SIGINT, KillHandler); 58 signal(SIGINT, KillHandler);
59 CHECK(g_notifier); 59 CHECK(g_notifier);
60 forwarder2::DeviceController controller(g_notifier->receiver_fd()); 60 forwarder2::DeviceController controller(g_notifier->receiver_fd());
61 if (!controller.Init(adb_socket_path)) 61 if (!controller.Init(adb_socket_path))
62 return 1; 62 return 1;
63 printf("Starting Device Forwarder.\n"); 63 printf("Starting Device Forwarder.\n");
64 controller.Start(); 64 controller.Start();
65 return 0; 65 return 0;
66 } 66 }
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | tools/android/forwarder2/host_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698