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

Side by Side Diff: dbus/bus.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 (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 #include "dbus/bus.h" 5 #include "dbus/bus.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 27 matching lines...) Expand all
38 const char kServiceNameOwnerChangeMatchRule[] = 38 const char kServiceNameOwnerChangeMatchRule[] =
39 "type='signal',interface='org.freedesktop.DBus'," 39 "type='signal',interface='org.freedesktop.DBus',"
40 "member='NameOwnerChanged',path='/org/freedesktop/DBus'," 40 "member='NameOwnerChanged',path='/org/freedesktop/DBus',"
41 "sender='org.freedesktop.DBus',arg0='%s'"; 41 "sender='org.freedesktop.DBus',arg0='%s'";
42 42
43 // The class is used for watching the file descriptor used for D-Bus 43 // The class is used for watching the file descriptor used for D-Bus
44 // communication. 44 // communication.
45 class Watch : public base::MessagePumpLibevent::Watcher { 45 class Watch : public base::MessagePumpLibevent::Watcher {
46 public: 46 public:
47 explicit Watch(DBusWatch* watch) 47 explicit Watch(DBusWatch* watch)
48 : raw_watch_(watch) { 48 : raw_watch_(watch), file_descriptor_watcher_(FROM_HERE) {
49 dbus_watch_set_data(raw_watch_, this, NULL); 49 dbus_watch_set_data(raw_watch_, this, NULL);
50 } 50 }
51 51
52 ~Watch() override { dbus_watch_set_data(raw_watch_, NULL, NULL); } 52 ~Watch() override { dbus_watch_set_data(raw_watch_, NULL, NULL); }
53 53
54 // Returns true if the underlying file descriptor is ready to be watched. 54 // Returns true if the underlying file descriptor is ready to be watched.
55 bool IsReadyToBeWatched() { 55 bool IsReadyToBeWatched() {
56 return dbus_watch_get_enabled(raw_watch_); 56 return dbus_watch_get_enabled(raw_watch_);
57 } 57 }
58 58
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 kNameOwnerChangedSignal)) { 1209 kNameOwnerChangedSignal)) {
1210 Bus* self = static_cast<Bus*>(data); 1210 Bus* self = static_cast<Bus*>(data);
1211 self->OnServiceOwnerChanged(message); 1211 self->OnServiceOwnerChanged(message);
1212 } 1212 }
1213 // Always return unhandled to let others, e.g. ObjectProxies, handle the same 1213 // Always return unhandled to let others, e.g. ObjectProxies, handle the same
1214 // signal. 1214 // signal.
1215 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 1215 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
1216 } 1216 }
1217 1217
1218 } // namespace dbus 1218 } // namespace dbus
OLDNEW
« no previous file with comments | « components/crash/content/browser/crash_handler_host_linux.cc ('k') | mojo/edk/system/channel_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698