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

Side by Side Diff: dbus/exported_object.cc

Issue 1997153002: libchrome: Several upstreamable fixes from libchrome Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Addressed feedback Created 4 years, 7 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/exported_object.h" 5 #include "dbus/exported_object.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 if (!success) { 179 if (!success) {
180 LOG(ERROR) << "Failed to register the object: " << object_path_.value() 180 LOG(ERROR) << "Failed to register the object: " << object_path_.value()
181 << ": " << (error.is_set() ? error.message() : ""); 181 << ": " << (error.is_set() ? error.message() : "");
182 return false; 182 return false;
183 } 183 }
184 184
185 object_is_registered_ = true; 185 object_is_registered_ = true;
186 return true; 186 return true;
187 } 187 }
188 188
189 DBusHandlerResult ExportedObject::HandleMessage( 189 DBusHandlerResult ExportedObject::HandleMessage(DBusConnection*,
190 DBusConnection* connection, 190 DBusMessage* raw_message) {
191 DBusMessage* raw_message) {
192 bus_->AssertOnDBusThread(); 191 bus_->AssertOnDBusThread();
193 DCHECK_EQ(DBUS_MESSAGE_TYPE_METHOD_CALL, dbus_message_get_type(raw_message)); 192 DCHECK_EQ(DBUS_MESSAGE_TYPE_METHOD_CALL, dbus_message_get_type(raw_message));
194 193
195 // raw_message will be unrefed on exit of the function. Increment the 194 // raw_message will be unrefed on exit of the function. Increment the
196 // reference so we can use it in MethodCall. 195 // reference so we can use it in MethodCall.
197 dbus_message_ref(raw_message); 196 dbus_message_ref(raw_message);
198 std::unique_ptr<MethodCall> method_call( 197 std::unique_ptr<MethodCall> method_call(
199 MethodCall::FromRawMessage(raw_message)); 198 MethodCall::FromRawMessage(raw_message));
200 const std::string interface = method_call->GetInterface(); 199 const std::string interface = method_call->GetInterface();
201 const std::string member = method_call->GetMember(); 200 const std::string member = method_call->GetMember();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 293 }
295 294
296 // The method call was successful. 295 // The method call was successful.
297 bus_->Send(response->raw_message(), NULL); 296 bus_->Send(response->raw_message(), NULL);
298 297
299 // Record time spent to handle the the method call. Don't include failures. 298 // Record time spent to handle the the method call. Don't include failures.
300 UMA_HISTOGRAM_TIMES("DBus.ExportedMethodHandleTime", 299 UMA_HISTOGRAM_TIMES("DBus.ExportedMethodHandleTime",
301 base::TimeTicks::Now() - start_time); 300 base::TimeTicks::Now() - start_time);
302 } 301 }
303 302
304 void ExportedObject::OnUnregistered(DBusConnection* connection) { 303 void ExportedObject::OnUnregistered(DBusConnection*) {}
305 }
306 304
307 DBusHandlerResult ExportedObject::HandleMessageThunk( 305 DBusHandlerResult ExportedObject::HandleMessageThunk(
308 DBusConnection* connection, 306 DBusConnection* connection,
309 DBusMessage* raw_message, 307 DBusMessage* raw_message,
310 void* user_data) { 308 void* user_data) {
311 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); 309 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data);
312 return self->HandleMessage(connection, raw_message); 310 return self->HandleMessage(connection, raw_message);
313 } 311 }
314 312
315 void ExportedObject::OnUnregisteredThunk(DBusConnection *connection, 313 void ExportedObject::OnUnregisteredThunk(DBusConnection *connection,
316 void* user_data) { 314 void* user_data) {
317 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data); 315 ExportedObject* self = reinterpret_cast<ExportedObject*>(user_data);
318 return self->OnUnregistered(connection); 316 return self->OnUnregistered(connection);
319 } 317 }
320 318
321 } // namespace dbus 319 } // namespace dbus
OLDNEW
« base/metrics/histogram.cc ('K') | « dbus/bus.cc ('k') | dbus/object_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698