| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "values.h" | 7 #include "values.h" |
| 8 | 8 |
| 9 #define true true | 9 #define true true |
| 10 | 10 |
| 11 base::ListValue* ReturnsRawPtr() { | 11 base::ListValue* ReturnsRawPtr() { |
| 12 return nullptr; | 12 return nullptr; |
| 13 } | 13 } |
| 14 | 14 |
| 15 std::unique_ptr<base::Value> ReturnsUniquePtr() { | 15 std::unique_ptr<base::Value> ReturnsUniquePtr() { |
| 16 return nullptr; | 16 return nullptr; |
| 17 } | 17 } |
| 18 | 18 |
| 19 // The joy of raw pointers. | 19 // The joy of raw pointers. |
| 20 void DoesItTakeOwnership(base::Value*) {} | 20 void DoesItTakeOwnership(base::Value*) {} |
| 21 | 21 |
| 22 struct Thing { | 22 struct Thing { |
| 23 std::unique_ptr<base::Value> ToValue() { return nullptr; } | 23 std::unique_ptr<base::Value> ToValue() { return nullptr; } |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 void F() { | 26 void F() { |
| 27 base::ListValue list; | 27 base::ListValue list; |
| 28 list.Append(new base::FundamentalValue(1 == 0)); | 28 list.Append(new base::Value(1 == 0)); |
| 29 list.Append(new base::FundamentalValue(true)); | 29 list.Append(new base::Value(true)); |
| 30 list.Append(new base::FundamentalValue(static_cast<unsigned char>(1.0))); | 30 list.Append(new base::Value(static_cast<unsigned char>(1.0))); |
| 31 list.Append(new base::FundamentalValue(double{3})); | 31 list.Append(new base::Value(double{3})); |
| 32 list.Append(new base::StringValue("abc")); | 32 list.Append(new base::StringValue("abc")); |
| 33 | 33 |
| 34 list.Append(ReturnsUniquePtr().release()); | 34 list.Append(ReturnsUniquePtr().release()); |
| 35 Thing thing; | 35 Thing thing; |
| 36 list.Append(thing.ToValue().release()); | 36 list.Append(thing.ToValue().release()); |
| 37 std::unique_ptr<base::Value> unique_ptr_var; | 37 std::unique_ptr<base::Value> unique_ptr_var; |
| 38 list.Append(unique_ptr_var.release()); | 38 list.Append(unique_ptr_var.release()); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void G(base::Value* input) { | 41 void G(base::Value* input) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 // Make sure C++98 style initialization is correctly handled. | 101 // Make sure C++98 style initialization is correctly handled. |
| 102 base::ListValue* cxx98_list(new base::ListValue); | 102 base::ListValue* cxx98_list(new base::ListValue); |
| 103 list.Append(cxx98_list); | 103 list.Append(cxx98_list); |
| 104 | 104 |
| 105 // C++11 style syntax currently causes the tool to bail out: this is banned in | 105 // C++11 style syntax currently causes the tool to bail out: this is banned in |
| 106 // Chromium style anyway. | 106 // Chromium style anyway. |
| 107 base::ListValue* cxx11_list{new base::ListValue}; | 107 base::ListValue* cxx11_list{new base::ListValue}; |
| 108 list.Append(cxx11_list); | 108 list.Append(cxx11_list); |
| 109 } | 109 } |
| OLD | NEW |