| 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 "content/browser/devtools/protocol_string.h" | 5 #include "content/browser/devtools/protocol_string.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "content/browser/devtools/protocol/protocol.h" | 10 #include "content/browser/devtools/protocol/protocol.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 return std::move(result); | 67 return std::move(result); |
| 68 } | 68 } |
| 69 return nullptr; | 69 return nullptr; |
| 70 } | 70 } |
| 71 | 71 |
| 72 std::unique_ptr<base::Value> toBaseValue( | 72 std::unique_ptr<base::Value> toBaseValue( |
| 73 protocol::Value* value, int depth) { | 73 protocol::Value* value, int depth) { |
| 74 if (!value || !depth) | 74 if (!value || !depth) |
| 75 return nullptr; | 75 return nullptr; |
| 76 if (value->type() == protocol::Value::TypeNull) | 76 if (value->type() == protocol::Value::TypeNull) |
| 77 return base::Value::CreateNullValue(); | 77 return base::MakeUnique<base::Value>(); |
| 78 if (value->type() == protocol::Value::TypeBoolean) { | 78 if (value->type() == protocol::Value::TypeBoolean) { |
| 79 bool inner; | 79 bool inner; |
| 80 value->asBoolean(&inner); | 80 value->asBoolean(&inner); |
| 81 return base::WrapUnique(new base::Value(inner)); | 81 return base::WrapUnique(new base::Value(inner)); |
| 82 } | 82 } |
| 83 if (value->type() == protocol::Value::TypeInteger) { | 83 if (value->type() == protocol::Value::TypeInteger) { |
| 84 int inner; | 84 int inner; |
| 85 value->asInteger(&inner); | 85 value->asInteger(&inner); |
| 86 return base::WrapUnique(new base::Value(inner)); | 86 return base::WrapUnique(new base::Value(inner)); |
| 87 } | 87 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 std::string StringBuilder::toString() { | 147 std::string StringBuilder::toString() { |
| 148 return string_; | 148 return string_; |
| 149 } | 149 } |
| 150 | 150 |
| 151 void StringBuilder::reserveCapacity(size_t capacity) { | 151 void StringBuilder::reserveCapacity(size_t capacity) { |
| 152 string_.reserve(capacity); | 152 string_.reserve(capacity); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace protocol | 155 } // namespace protocol |
| 156 } // namespace content | 156 } // namespace content |
| OLD | NEW |