OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/apps/app_shim/unix_domain_socket_acceptor.h" | 5 #include "chrome/browser/apps/app_shim/unix_domain_socket_acceptor.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "mojo/edk/embedder/named_platform_handle_utils.h" | 10 #include "mojo/edk/embedder/named_platform_handle_utils.h" |
11 #include "mojo/edk/embedder/platform_channel_utils_posix.h" | 11 #include "mojo/edk/embedder/platform_channel_utils_posix.h" |
12 | 12 |
13 namespace apps { | 13 namespace apps { |
14 | 14 |
15 UnixDomainSocketAcceptor::UnixDomainSocketAcceptor(const base::FilePath& path, | 15 UnixDomainSocketAcceptor::UnixDomainSocketAcceptor(const base::FilePath& path, |
16 Delegate* delegate) | 16 Delegate* delegate) |
17 : named_pipe_(path.value()), | 17 : server_listen_connection_watcher_(FROM_HERE), |
| 18 named_pipe_(path.value()), |
18 delegate_(delegate), | 19 delegate_(delegate), |
19 listen_handle_(mojo::edk::CreateServerHandle(named_pipe_)) { | 20 listen_handle_(mojo::edk::CreateServerHandle(named_pipe_)) { |
20 DCHECK(delegate_); | 21 DCHECK(delegate_); |
21 } | 22 } |
22 | 23 |
23 UnixDomainSocketAcceptor::~UnixDomainSocketAcceptor() { | 24 UnixDomainSocketAcceptor::~UnixDomainSocketAcceptor() { |
24 Close(); | 25 Close(); |
25 } | 26 } |
26 | 27 |
27 bool UnixDomainSocketAcceptor::Listen() { | 28 bool UnixDomainSocketAcceptor::Listen() { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 return; | 66 return; |
66 listen_handle_.reset(); | 67 listen_handle_.reset(); |
67 if (unlink(named_pipe_.name.c_str()) < 0) | 68 if (unlink(named_pipe_.name.c_str()) < 0) |
68 PLOG(ERROR) << "unlink"; | 69 PLOG(ERROR) << "unlink"; |
69 | 70 |
70 // Unregister libevent for the listening socket and close it. | 71 // Unregister libevent for the listening socket and close it. |
71 server_listen_connection_watcher_.StopWatchingFileDescriptor(); | 72 server_listen_connection_watcher_.StopWatchingFileDescriptor(); |
72 } | 73 } |
73 | 74 |
74 } // namespace apps | 75 } // namespace apps |
OLD | NEW |