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

Side by Side Diff: base/async_socket_io_handler.h

Issue 23058010: Fix namespace for AsyncSocketIoHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/async_socket_io_handler_posix.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 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 #ifndef BASE_ASYNC_SOCKET_IO_HANDLER_H_ 5 #ifndef BASE_ASYNC_SOCKET_IO_HANDLER_H_
6 #define BASE_ASYNC_SOCKET_IO_HANDLER_H_ 6 #define BASE_ASYNC_SOCKET_IO_HANDLER_H_
7 7
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/sync_socket.h" 9 #include "base/sync_socket.h"
10 #include "base/threading/non_thread_safe.h" 10 #include "base/threading/non_thread_safe.h"
11 11
12 namespace media { 12 namespace base {
13 13
14 // The message loop callback interface is different based on platforms. 14 // The message loop callback interface is different based on platforms.
15 #if defined(OS_WIN) 15 #if defined(OS_WIN)
16 typedef base::MessageLoopForIO::IOHandler MessageLoopIOHandler; 16 typedef base::MessageLoopForIO::IOHandler MessageLoopIOHandler;
darin (slow to review) 2013/08/23 16:20:41 nit: This appears to be defined in the wrong place
qsr 2013/08/26 08:36:02 I'm not sure we want this to be available outside
tommi (sloooow) - chröme 2013/08/26 08:46:25 The IOHandler and Watcher interfaces actually are
17 #elif defined(OS_POSIX) 17 #elif defined(OS_POSIX)
18 typedef base::MessageLoopForIO::Watcher MessageLoopIOHandler; 18 typedef base::MessageLoopForIO::Watcher MessageLoopIOHandler;
19 #endif 19 #endif
20 20
21 // Extends the CancelableSyncSocket class to allow reading from a socket 21 // Extends the CancelableSyncSocket class to allow reading from a socket
22 // asynchronously on a TYPE_IO message loop thread. This makes it easy to share 22 // asynchronously on a TYPE_IO message loop thread. This makes it easy to share
23 // a thread that uses a message loop (e.g. for IPC and other things) and not 23 // a thread that uses a message loop (e.g. for IPC and other things) and not
24 // require a separate thread to read from the socket. 24 // require a separate thread to read from the socket.
25 // 25 //
26 // Example usage (also see the unit tests): 26 // Example usage (also see the unit tests):
(...skipping 12 matching lines...) Expand all
39 // } 39 // }
40 // 40 //
41 // private: 41 // private:
42 // void OnDataAvailable(int bytes_read) { 42 // void OnDataAvailable(int bytes_read) {
43 // if (ProcessData(&buffer_[0], bytes_read)) { 43 // if (ProcessData(&buffer_[0], bytes_read)) {
44 // // Issue another read. 44 // // Issue another read.
45 // CHECK(io_handler.Read(&buffer_[0], sizeof(buffer_))); 45 // CHECK(io_handler.Read(&buffer_[0], sizeof(buffer_)));
46 // } 46 // }
47 // } 47 // }
48 // 48 //
49 // media::AsyncSocketIoHandler io_handler; 49 // base::AsyncSocketIoHandler io_handler;
50 // base::CancelableSyncSocket* socket_; 50 // base::CancelableSyncSocket* socket_;
51 // char buffer_[kBufferSize]; 51 // char buffer_[kBufferSize];
52 // }; 52 // };
53 // 53 //
54 class BASE_EXPORT AsyncSocketIoHandler 54 class BASE_EXPORT AsyncSocketIoHandler
55 : public NON_EXPORTED_BASE(base::NonThreadSafe), 55 : public NON_EXPORTED_BASE(base::NonThreadSafe),
56 public NON_EXPORTED_BASE(MessageLoopIOHandler) { 56 public NON_EXPORTED_BASE(MessageLoopIOHandler) {
57 public: 57 public:
58 AsyncSocketIoHandler(); 58 AsyncSocketIoHandler();
59 virtual ~AsyncSocketIoHandler(); 59 virtual ~AsyncSocketIoHandler();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 char* pending_buffer_; 100 char* pending_buffer_;
101 int pending_buffer_len_; 101 int pending_buffer_len_;
102 // |true| iff the message loop is watching the socket for IO events. 102 // |true| iff the message loop is watching the socket for IO events.
103 bool is_watching_; 103 bool is_watching_;
104 #endif 104 #endif
105 ReadCompleteCallback read_complete_; 105 ReadCompleteCallback read_complete_;
106 106
107 DISALLOW_COPY_AND_ASSIGN(AsyncSocketIoHandler); 107 DISALLOW_COPY_AND_ASSIGN(AsyncSocketIoHandler);
108 }; 108 };
109 109
110 } // namespace media. 110 } // namespace base.
111 111
112 #endif // BASE_ASYNC_SOCKET_IO_HANDLER_H_ 112 #endif // BASE_ASYNC_SOCKET_IO_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | base/async_socket_io_handler_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698