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

Side by Side Diff: base/message_loop/message_pump_libevent.h

Issue 1255293006: Microoptimisation for OnLibeventNotification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor changes requested by thestig@. Created 5 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
« no previous file with comments | « no previous file | base/message_loop/message_pump_libevent.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 (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_LOOP_MESSAGE_PUMP_LIBEVENT_H_ 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_LIBEVENT_H_
6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_LIBEVENT_H_ 6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_LIBEVENT_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/message_loop/message_pump.h" 10 #include "base/message_loop/message_pump.h"
12 #include "base/observer_list.h" 11 #include "base/observer_list.h"
13 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
14 #include "base/time/time.h" 13 #include "base/time/time.h"
15 14
16 // Declare structs we need from libevent.h rather than including it 15 // Declare structs we need from libevent.h rather than including it
17 struct event_base; 16 struct event_base;
18 struct event; 17 struct event;
19 18
20 namespace base { 19 namespace base {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 MessagePumpLibevent* pump() const { return pump_; } 78 MessagePumpLibevent* pump() const { return pump_; }
80 79
81 void set_watcher(Watcher* watcher) { watcher_ = watcher; } 80 void set_watcher(Watcher* watcher) { watcher_ = watcher; }
82 81
83 void OnFileCanReadWithoutBlocking(int fd, MessagePumpLibevent* pump); 82 void OnFileCanReadWithoutBlocking(int fd, MessagePumpLibevent* pump);
84 void OnFileCanWriteWithoutBlocking(int fd, MessagePumpLibevent* pump); 83 void OnFileCanWriteWithoutBlocking(int fd, MessagePumpLibevent* pump);
85 84
86 event* event_; 85 event* event_;
87 MessagePumpLibevent* pump_; 86 MessagePumpLibevent* pump_;
88 Watcher* watcher_; 87 Watcher* watcher_;
89 WeakPtrFactory<FileDescriptorWatcher> weak_factory_; 88 // If this pointer is non-NULL, the pointee is set to true in the
89 // destructor.
90 bool* was_destroyed_;
90 91
91 DISALLOW_COPY_AND_ASSIGN(FileDescriptorWatcher); 92 DISALLOW_COPY_AND_ASSIGN(FileDescriptorWatcher);
92 }; 93 };
93 94
94 enum Mode { 95 enum Mode {
95 WATCH_READ = 1 << 0, 96 WATCH_READ = 1 << 0,
96 WATCH_WRITE = 1 << 1, 97 WATCH_WRITE = 1 << 1,
97 WATCH_READ_WRITE = WATCH_READ | WATCH_WRITE 98 WATCH_READ_WRITE = WATCH_READ | WATCH_WRITE
98 }; 99 };
99 100
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 event* wakeup_event_; 169 event* wakeup_event_;
169 170
170 ObserverList<IOObserver> io_observers_; 171 ObserverList<IOObserver> io_observers_;
171 ThreadChecker watch_file_descriptor_caller_checker_; 172 ThreadChecker watch_file_descriptor_caller_checker_;
172 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); 173 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent);
173 }; 174 };
174 175
175 } // namespace base 176 } // namespace base
176 177
177 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_LIBEVENT_H_ 178 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_LIBEVENT_H_
OLDNEW
« no previous file with comments | « no previous file | base/message_loop/message_pump_libevent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698