OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 bus_->AssertOnDBusThread(); | 334 bus_->AssertOnDBusThread(); |
335 if (dbus_message_get_type(raw_message) != DBUS_MESSAGE_TYPE_SIGNAL) | 335 if (dbus_message_get_type(raw_message) != DBUS_MESSAGE_TYPE_SIGNAL) |
336 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | 336 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
337 | 337 |
338 // raw_message will be unrefed on exit of the function. Increment the | 338 // raw_message will be unrefed on exit of the function. Increment the |
339 // reference so we can use it in Signal. | 339 // reference so we can use it in Signal. |
340 dbus_message_ref(raw_message); | 340 dbus_message_ref(raw_message); |
341 scoped_ptr<Signal> signal( | 341 scoped_ptr<Signal> signal( |
342 Signal::FromRawMessage(raw_message)); | 342 Signal::FromRawMessage(raw_message)); |
343 | 343 |
344 VLOG(1) << "Signal received: " << signal->ToString(); | |
345 | |
346 const std::string interface = signal->GetInterface(); | 344 const std::string interface = signal->GetInterface(); |
347 const std::string member = signal->GetMember(); | 345 const std::string member = signal->GetMember(); |
348 | 346 |
349 // Check if we know about the signal. | 347 // Check if we know about the signal. |
350 const std::string absolute_signal_name = GetAbsoluteSignalName( | 348 const std::string absolute_signal_name = GetAbsoluteSignalName( |
351 interface, member); | 349 interface, member); |
352 MethodTable::const_iterator iter = method_table_.find(absolute_signal_name); | 350 MethodTable::const_iterator iter = method_table_.find(absolute_signal_name); |
353 if (iter == method_table_.end()) { | 351 if (iter == method_table_.end()) { |
354 // Don't know about the signal. | 352 // Don't know about the signal. |
355 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | 353 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
356 } | 354 } |
| 355 VLOG(1) << "Signal received: " << signal->ToString(); |
357 | 356 |
358 const base::TimeTicks start_time = base::TimeTicks::Now(); | 357 const base::TimeTicks start_time = base::TimeTicks::Now(); |
359 if (bus_->HasDBusThread()) { | 358 if (bus_->HasDBusThread()) { |
360 // Post a task to run the method in the origin thread. | 359 // Post a task to run the method in the origin thread. |
361 // Transfer the ownership of |signal| to RunMethod(). | 360 // Transfer the ownership of |signal| to RunMethod(). |
362 // |released_signal| will be deleted in RunMethod(). | 361 // |released_signal| will be deleted in RunMethod(). |
363 Signal* released_signal = signal.release(); | 362 Signal* released_signal = signal.release(); |
364 bus_->PostTaskToOriginThread(FROM_HERE, | 363 bus_->PostTaskToOriginThread(FROM_HERE, |
365 base::Bind(&ObjectProxy::RunMethod, | 364 base::Bind(&ObjectProxy::RunMethod, |
366 this, | 365 this, |
(...skipping 25 matching lines...) Expand all Loading... |
392 | 391 |
393 DBusHandlerResult ObjectProxy::HandleMessageThunk( | 392 DBusHandlerResult ObjectProxy::HandleMessageThunk( |
394 DBusConnection* connection, | 393 DBusConnection* connection, |
395 DBusMessage* raw_message, | 394 DBusMessage* raw_message, |
396 void* user_data) { | 395 void* user_data) { |
397 ObjectProxy* self = reinterpret_cast<ObjectProxy*>(user_data); | 396 ObjectProxy* self = reinterpret_cast<ObjectProxy*>(user_data); |
398 return self->HandleMessage(connection, raw_message); | 397 return self->HandleMessage(connection, raw_message); |
399 } | 398 } |
400 | 399 |
401 } // namespace dbus | 400 } // namespace dbus |
OLD | NEW |