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

Side by Side Diff: base/message_pump_libevent.h

Issue 10332269: RefCounted types should not have public destructors, base/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 8 years, 6 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 | « base/memory/weak_ptr.h ('k') | base/supports_user_data.h » ('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 #ifndef BASE_MESSAGE_PUMP_LIBEVENT_H_ 5 #ifndef BASE_MESSAGE_PUMP_LIBEVENT_H_
6 #define BASE_MESSAGE_PUMP_LIBEVENT_H_ 6 #define BASE_MESSAGE_PUMP_LIBEVENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 27 matching lines...) Expand all
38 protected: 38 protected:
39 virtual ~IOObserver() {} 39 virtual ~IOObserver() {}
40 }; 40 };
41 41
42 class FileDescriptorWatcher; 42 class FileDescriptorWatcher;
43 43
44 // Used with WatchFileDescriptor to asynchronously monitor the I/O readiness 44 // Used with WatchFileDescriptor to asynchronously monitor the I/O readiness
45 // of a file descriptor. 45 // of a file descriptor.
46 class Watcher { 46 class Watcher {
47 public: 47 public:
48 virtual ~Watcher() {}
49 // Called from MessageLoop::Run when an FD can be read from/written to 48 // Called from MessageLoop::Run when an FD can be read from/written to
50 // without blocking 49 // without blocking
51 virtual void OnFileCanReadWithoutBlocking(int fd) = 0; 50 virtual void OnFileCanReadWithoutBlocking(int fd) = 0;
52 virtual void OnFileCanWriteWithoutBlocking(int fd) = 0; 51 virtual void OnFileCanWriteWithoutBlocking(int fd) = 0;
52
53 protected:
54 virtual ~Watcher() {}
53 }; 55 };
54 56
55 // Object returned by WatchFileDescriptor to manage further watching. 57 // Object returned by WatchFileDescriptor to manage further watching.
56 class FileDescriptorWatcher { 58 class FileDescriptorWatcher {
57 public: 59 public:
58 FileDescriptorWatcher(); 60 FileDescriptorWatcher();
59 ~FileDescriptorWatcher(); // Implicitly calls StopWatchingFileDescriptor. 61 ~FileDescriptorWatcher(); // Implicitly calls StopWatchingFileDescriptor.
60 62
61 // NOTE: These methods aren't called StartWatching()/StopWatching() to 63 // NOTE: These methods aren't called StartWatching()/StopWatching() to
62 // avoid confusion with the win32 ObjectWatcher class. 64 // avoid confusion with the win32 ObjectWatcher class.
63 65
64 // Stop watching the FD, always safe to call. No-op if there's nothing 66 // Stop watching the FD, always safe to call. No-op if there's nothing
65 // to do. 67 // to do.
66 bool StopWatchingFileDescriptor(); 68 bool StopWatchingFileDescriptor();
67 69
68 private: 70 private:
69 friend class MessagePumpLibevent; 71 friend class MessagePumpLibevent;
70 friend class MessagePumpLibeventTest; 72 friend class MessagePumpLibeventTest;
71 73
72 // Called by MessagePumpLibevent, ownership of |e| is transferred to this 74 // Called by MessagePumpLibevent, ownership of |e| is transferred to this
73 // object. 75 // object.
74 void Init(event* e); 76 void Init(event* e);
75 77
76 // Used by MessagePumpLibevent to take ownership of event_. 78 // Used by MessagePumpLibevent to take ownership of event_.
77 event *ReleaseEvent(); 79 event* ReleaseEvent();
78 80
79 void set_pump(MessagePumpLibevent* pump) { pump_ = pump; } 81 void set_pump(MessagePumpLibevent* pump) { pump_ = pump; }
80 MessagePumpLibevent* pump() { return pump_; } 82 MessagePumpLibevent* pump() { return pump_; }
81 83
82 void set_watcher(Watcher* watcher) { watcher_ = watcher; } 84 void set_watcher(Watcher* watcher) { watcher_ = watcher; }
83 85
84 void OnFileCanReadWithoutBlocking(int fd, MessagePumpLibevent* pump); 86 void OnFileCanReadWithoutBlocking(int fd, MessagePumpLibevent* pump);
85 void OnFileCanWriteWithoutBlocking(int fd, MessagePumpLibevent* pump); 87 void OnFileCanWriteWithoutBlocking(int fd, MessagePumpLibevent* pump);
86 88
87 event* event_; 89 event* event_;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 event* wakeup_event_; 173 event* wakeup_event_;
172 174
173 ObserverList<IOObserver> io_observers_; 175 ObserverList<IOObserver> io_observers_;
174 ThreadChecker watch_file_descriptor_caller_checker_; 176 ThreadChecker watch_file_descriptor_caller_checker_;
175 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); 177 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent);
176 }; 178 };
177 179
178 } // namespace base 180 } // namespace base
179 181
180 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ 182 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_
OLDNEW
« no previous file with comments | « base/memory/weak_ptr.h ('k') | base/supports_user_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698