OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/async_socket_io_handler.h" | 5 #include "base/async_socket_io_handler.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 | 8 |
9 #include "base/posix/eintr_wrapper.h" | 9 #include "base/posix/eintr_wrapper.h" |
10 | 10 |
11 namespace media { | 11 namespace base { |
12 | 12 |
13 AsyncSocketIoHandler::AsyncSocketIoHandler() | 13 AsyncSocketIoHandler::AsyncSocketIoHandler() |
14 : socket_(base::SyncSocket::kInvalidHandle), | 14 : socket_(base::SyncSocket::kInvalidHandle), |
15 pending_buffer_(NULL), | 15 pending_buffer_(NULL), |
16 pending_buffer_len_(0), | 16 pending_buffer_len_(0), |
17 is_watching_(false) { | 17 is_watching_(false) { |
18 } | 18 } |
19 | 19 |
20 AsyncSocketIoHandler::~AsyncSocketIoHandler() { | 20 AsyncSocketIoHandler::~AsyncSocketIoHandler() { |
21 DCHECK(CalledOnValidThread()); | 21 DCHECK(CalledOnValidThread()); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 void AsyncSocketIoHandler::EnsureWatchingSocket() { | 89 void AsyncSocketIoHandler::EnsureWatchingSocket() { |
90 DCHECK(CalledOnValidThread()); | 90 DCHECK(CalledOnValidThread()); |
91 if (!is_watching_ && socket_ != base::SyncSocket::kInvalidHandle) { | 91 if (!is_watching_ && socket_ != base::SyncSocket::kInvalidHandle) { |
92 is_watching_ = base::MessageLoopForIO::current()->WatchFileDescriptor( | 92 is_watching_ = base::MessageLoopForIO::current()->WatchFileDescriptor( |
93 socket_, true, base::MessageLoopForIO::WATCH_READ, | 93 socket_, true, base::MessageLoopForIO::WATCH_READ, |
94 &socket_watcher_, this); | 94 &socket_watcher_, this); |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 } // namespace media. | 98 } // namespace base. |
OLD | NEW |