OLD | NEW |
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 // TODO(jamiewalch): Add unit tests for this. | 5 // TODO(jamiewalch): Add unit tests for this. |
6 | 6 |
7 #include "remoting/host/posix/signal_handler.h" | 7 #include "remoting/host/posix/signal_handler.h" |
8 | 8 |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <signal.h> | 10 #include <signal.h> |
11 | 11 |
12 #include <list> | 12 #include <list> |
13 #include <utility> | 13 #include <utility> |
14 | 14 |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/eintr_wrapper.h" | |
17 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
18 #include "base/message_pump_libevent.h" | 17 #include "base/message_pump_libevent.h" |
| 18 #include "base/posix/eintr_wrapper.h" |
19 #include "base/threading/platform_thread.h" | 19 #include "base/threading/platform_thread.h" |
20 | 20 |
21 namespace remoting { | 21 namespace remoting { |
22 namespace { | 22 namespace { |
23 | 23 |
24 class SignalListener : public base::MessagePumpLibevent::Watcher { | 24 class SignalListener : public base::MessagePumpLibevent::Watcher { |
25 public: | 25 public: |
26 SignalListener(); | 26 SignalListener(); |
27 | 27 |
28 void AddSignalHandler(int signal, const SignalHandler& handler); | 28 void AddSignalHandler(int signal, const SignalHandler& handler); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 if (signal(signal_number, GlobalSignalHandler) == SIG_ERR) { | 106 if (signal(signal_number, GlobalSignalHandler) == SIG_ERR) { |
107 LOG(ERROR) << "signal() failed: " << errno; | 107 LOG(ERROR) << "signal() failed: " << errno; |
108 return false; | 108 return false; |
109 } | 109 } |
110 g_signal_listener->AddSignalHandler(signal_number, handler); | 110 g_signal_listener->AddSignalHandler(signal_number, handler); |
111 return true; | 111 return true; |
112 } | 112 } |
113 | 113 |
114 } // namespace remoting | 114 } // namespace remoting |
OLD | NEW |