| OLD | NEW |
| 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 "base/json/json_parser.h" | 5 #include "base/json/json_parser.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // Then erase the contents of the current dictionary and swap in the | 54 // Then erase the contents of the current dictionary and swap in the |
| 55 // new contents, originally from |other|. | 55 // new contents, originally from |other|. |
| 56 Clear(); | 56 Clear(); |
| 57 json_.reset(); | 57 json_.reset(); |
| 58 DictionaryValue::Swap(copy.get()); | 58 DictionaryValue::Swap(copy.get()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Not overriding DictionaryValue::Remove because it just calls through to | 61 // Not overriding DictionaryValue::Remove because it just calls through to |
| 62 // the method below. | 62 // the method below. |
| 63 | 63 |
| 64 bool RemoveWithoutPathExpansion(const std::string& key, | 64 bool RemoveWithoutPathExpansion(StringPiece key, |
| 65 std::unique_ptr<Value>* out) override { | 65 std::unique_ptr<Value>* out) override { |
| 66 // If the caller won't take ownership of the removed value, just call up. | 66 // If the caller won't take ownership of the removed value, just call up. |
| 67 if (!out) | 67 if (!out) |
| 68 return DictionaryValue::RemoveWithoutPathExpansion(key, out); | 68 return DictionaryValue::RemoveWithoutPathExpansion(key, out); |
| 69 | 69 |
| 70 DVLOG(1) << "Remove()ing from a DictionaryValue inefficiently."; | 70 DVLOG(1) << "Remove()ing from a DictionaryValue inefficiently."; |
| 71 | 71 |
| 72 // Otherwise, remove the value while its still "owned" by this and copy it | 72 // Otherwise, remove the value while its still "owned" by this and copy it |
| 73 // to convert any JSONStringValues to std::string. | 73 // to convert any JSONStringValues to std::string. |
| 74 std::unique_ptr<Value> out_owned; | 74 std::unique_ptr<Value> out_owned; |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 const std::string& description) { | 980 const std::string& description) { |
| 981 if (line || column) { | 981 if (line || column) { |
| 982 return StringPrintf("Line: %i, column: %i, %s", | 982 return StringPrintf("Line: %i, column: %i, %s", |
| 983 line, column, description.c_str()); | 983 line, column, description.c_str()); |
| 984 } | 984 } |
| 985 return description; | 985 return description; |
| 986 } | 986 } |
| 987 | 987 |
| 988 } // namespace internal | 988 } // namespace internal |
| 989 } // namespace base | 989 } // namespace base |
| OLD | NEW |