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

Unified Diff: dbus/message.cc

Issue 12092061: Code cleaning: Uses scoped_ptr<> to express ownership rather than writing ownership in comments. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added chrome/browser/password_manager/native_backend_kwallet_x_unitte\ Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dbus/message.h ('k') | dbus/mock_object_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
//
« no previous file with comments | « dbus/message.h ('k') | dbus/mock_object_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698