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

Side by Side Diff: dbus/message.cc

Issue 1867253002: Convert //dbus from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU fixes in //device Created 4 years, 8 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
« no previous file with comments | « dbus/message.h ('k') | dbus/message_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/message.h" 5 #include "dbus/message.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 return signal; 391 return signal;
392 } 392 }
393 393
394 // 394 //
395 // Response implementation. 395 // Response implementation.
396 // 396 //
397 397
398 Response::Response() : Message() { 398 Response::Response() : Message() {
399 } 399 }
400 400
401 scoped_ptr<Response> Response::FromRawMessage(DBusMessage* raw_message) { 401 std::unique_ptr<Response> Response::FromRawMessage(DBusMessage* raw_message) {
402 DCHECK_EQ(DBUS_MESSAGE_TYPE_METHOD_RETURN, 402 DCHECK_EQ(DBUS_MESSAGE_TYPE_METHOD_RETURN,
403 dbus_message_get_type(raw_message)); 403 dbus_message_get_type(raw_message));
404 404
405 scoped_ptr<Response> response(new Response); 405 std::unique_ptr<Response> response(new Response);
406 response->Init(raw_message); 406 response->Init(raw_message);
407 return response; 407 return response;
408 } 408 }
409 409
410 scoped_ptr<Response> Response::FromMethodCall(MethodCall* method_call) { 410 std::unique_ptr<Response> Response::FromMethodCall(MethodCall* method_call) {
411 scoped_ptr<Response> response(new Response); 411 std::unique_ptr<Response> response(new Response);
412 response->Init(dbus_message_new_method_return(method_call->raw_message())); 412 response->Init(dbus_message_new_method_return(method_call->raw_message()));
413 return response; 413 return response;
414 } 414 }
415 415
416 scoped_ptr<Response> Response::CreateEmpty() { 416 std::unique_ptr<Response> Response::CreateEmpty() {
417 scoped_ptr<Response> response(new Response); 417 std::unique_ptr<Response> response(new Response);
418 response->Init(dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN)); 418 response->Init(dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN));
419 return response; 419 return response;
420 } 420 }
421 421
422 // 422 //
423 // ErrorResponse implementation. 423 // ErrorResponse implementation.
424 // 424 //
425 425
426 ErrorResponse::ErrorResponse() : Response() { 426 ErrorResponse::ErrorResponse() : Response() {
427 } 427 }
428 428
429 scoped_ptr<ErrorResponse> ErrorResponse::FromRawMessage( 429 std::unique_ptr<ErrorResponse> ErrorResponse::FromRawMessage(
430 DBusMessage* raw_message) { 430 DBusMessage* raw_message) {
431 DCHECK_EQ(DBUS_MESSAGE_TYPE_ERROR, dbus_message_get_type(raw_message)); 431 DCHECK_EQ(DBUS_MESSAGE_TYPE_ERROR, dbus_message_get_type(raw_message));
432 432
433 scoped_ptr<ErrorResponse> response(new ErrorResponse); 433 std::unique_ptr<ErrorResponse> response(new ErrorResponse);
434 response->Init(raw_message); 434 response->Init(raw_message);
435 return response; 435 return response;
436 } 436 }
437 437
438 scoped_ptr<ErrorResponse> ErrorResponse::FromMethodCall( 438 std::unique_ptr<ErrorResponse> ErrorResponse::FromMethodCall(
439 MethodCall* method_call, 439 MethodCall* method_call,
440 const std::string& error_name, 440 const std::string& error_name,
441 const std::string& error_message) { 441 const std::string& error_message) {
442 scoped_ptr<ErrorResponse> response(new ErrorResponse); 442 std::unique_ptr<ErrorResponse> response(new ErrorResponse);
443 response->Init(dbus_message_new_error(method_call->raw_message(), 443 response->Init(dbus_message_new_error(method_call->raw_message(),
444 error_name.c_str(), 444 error_name.c_str(),
445 error_message.c_str())); 445 error_message.c_str()));
446 return response; 446 return response;
447 } 447 }
448 448
449 // 449 //
450 // MessageWriter implementation. 450 // MessageWriter implementation.
451 // 451 //
452 452
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 const bool success = PopBasic(DBUS_TYPE_UNIX_FD, &fd); 1023 const bool success = PopBasic(DBUS_TYPE_UNIX_FD, &fd);
1024 if (!success) 1024 if (!success)
1025 return false; 1025 return false;
1026 1026
1027 value->PutValue(fd); 1027 value->PutValue(fd);
1028 // NB: the caller must check validity before using the value 1028 // NB: the caller must check validity before using the value
1029 return true; 1029 return true;
1030 } 1030 }
1031 1031
1032 } // namespace dbus 1032 } // namespace dbus
OLDNEW
« no previous file with comments | « dbus/message.h ('k') | dbus/message_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698