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

Side by Side Diff: base/message_loop/message_pump_io_ios.cc

Issue 2695593009: Use the location where FileDescriptorWatcher is created to track the libevent handlers (Closed)
Patch Set: fix mac. Created 3 years, 10 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "base/message_loop/message_pump_io_ios.h" 5 #include "base/message_loop/message_pump_io_ios.h"
6 6
7 namespace base { 7 namespace base {
8 8
9 MessagePumpIOSForIO::FileDescriptorWatcher::FileDescriptorWatcher() 9 MessagePumpIOSForIO::FileDescriptorWatcher::FileDescriptorWatcher(
10 const tracked_objects::Location& from_here)
10 : is_persistent_(false), 11 : is_persistent_(false),
11 fdref_(NULL), 12 fdref_(NULL),
12 callback_types_(0), 13 callback_types_(0),
13 fd_source_(NULL), 14 fd_source_(NULL),
14 watcher_(NULL) { 15 watcher_(NULL),
15 } 16 created_from_location_(from_here) {}
16 17
17 MessagePumpIOSForIO::FileDescriptorWatcher::~FileDescriptorWatcher() { 18 MessagePumpIOSForIO::FileDescriptorWatcher::~FileDescriptorWatcher() {
18 StopWatchingFileDescriptor(); 19 StopWatchingFileDescriptor();
19 } 20 }
20 21
21 bool MessagePumpIOSForIO::FileDescriptorWatcher::StopWatchingFileDescriptor() { 22 bool MessagePumpIOSForIO::FileDescriptorWatcher::StopWatchingFileDescriptor() {
22 if (fdref_ == NULL) 23 if (fdref_ == NULL)
23 return true; 24 return true;
24 25
25 CFFileDescriptorDisableCallBacks(fdref_.get(), callback_types_); 26 CFFileDescriptorDisableCallBacks(fdref_.get(), callback_types_);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 181
181 // Re-enable callbacks after the read/write if the file descriptor is still 182 // Re-enable callbacks after the read/write if the file descriptor is still
182 // valid and the controller is persistent. 183 // valid and the controller is persistent.
183 if (CFFileDescriptorIsValid(fdref) && controller->is_persistent_) { 184 if (CFFileDescriptorIsValid(fdref) && controller->is_persistent_) {
184 DCHECK_EQ(fdref, controller->fdref_.get()); 185 DCHECK_EQ(fdref, controller->fdref_.get());
185 CFFileDescriptorEnableCallBacks(fdref, callback_types); 186 CFFileDescriptorEnableCallBacks(fdref, callback_types);
186 } 187 }
187 } 188 }
188 189
189 } // namespace base 190 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/message_pump_io_ios.h ('k') | base/message_loop/message_pump_io_ios_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698