Index: dbus/message.cc |
diff --git a/dbus/message.cc b/dbus/message.cc |
index afcd9320a1db9ee9823d5fdcfe4837e8487def80..ce53a485375fdcbe07400c3841e35e0cdf5c66b2 100644 |
--- a/dbus/message.cc |
+++ b/dbus/message.cc |
@@ -400,26 +400,27 @@ Signal* Signal::FromRawMessage(DBusMessage* raw_message) { |
Response::Response() : Message() { |
} |
-Response* Response::FromRawMessage(DBusMessage* raw_message) { |
+scoped_ptr<Response> Response::FromRawMessage(DBusMessage* raw_message) { |
DCHECK_EQ(DBUS_MESSAGE_TYPE_METHOD_RETURN, |
dbus_message_get_type(raw_message)); |
- Response* response = new Response; |
+ scoped_ptr<Response> response(new Response); |
response->Init(raw_message); |
- return response; |
+ return response.Pass(); |
} |
-Response* Response::FromMethodCall(MethodCall* method_call) { |
- Response* response = new Response; |
+scoped_ptr<Response> Response::FromMethodCall(MethodCall* method_call) { |
+ scoped_ptr<Response> response(new Response); |
response->Init(dbus_message_new_method_return(method_call->raw_message())); |
- return response; |
+ return response.Pass(); |
} |
-Response* Response::CreateEmpty() { |
- Response* response = new Response; |
+scoped_ptr<Response> Response::CreateEmpty() { |
+ scoped_ptr<Response> response(new Response); |
response->Init(dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN)); |
- return response; |
+ return response.Pass(); |
} |
+ |
// |
// ErrorResponse implementation. |
// |
@@ -427,23 +428,24 @@ Response* Response::CreateEmpty() { |
ErrorResponse::ErrorResponse() : Response() { |
} |
-ErrorResponse* ErrorResponse::FromRawMessage(DBusMessage* raw_message) { |
+scoped_ptr<ErrorResponse> ErrorResponse::FromRawMessage( |
+ DBusMessage* raw_message) { |
DCHECK_EQ(DBUS_MESSAGE_TYPE_ERROR, dbus_message_get_type(raw_message)); |
- ErrorResponse* response = new ErrorResponse; |
+ scoped_ptr<ErrorResponse> response(new ErrorResponse); |
response->Init(raw_message); |
- return response; |
+ return response.Pass(); |
} |
-ErrorResponse* ErrorResponse::FromMethodCall( |
+scoped_ptr<ErrorResponse> ErrorResponse::FromMethodCall( |
MethodCall* method_call, |
const std::string& error_name, |
const std::string& error_message) { |
- ErrorResponse* response = new ErrorResponse; |
+ scoped_ptr<ErrorResponse> response(new ErrorResponse); |
response->Init(dbus_message_new_error(method_call->raw_message(), |
error_name.c_str(), |
error_message.c_str())); |
- return response; |
+ return response.Pass(); |
} |
// |