| 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 #ifndef ValueConversions_h | 5 #ifndef ValueConversions_h |
| 6 #define ValueConversions_h | 6 #define ValueConversions_h |
| 7 | 7 |
| 8 #include "platform/inspector_protocol/ErrorSupport.h" | 8 #include "platform/inspector_protocol/ErrorSupport.h" |
| 9 #include "platform/inspector_protocol/Platform.h" | 9 #include "platform/inspector_protocol/Platform.h" |
| 10 #include "platform/inspector_protocol/String16.h" | 10 #include "platform/inspector_protocol/String16.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 errors->addError("string value expected"); | 105 errors->addError("string value expected"); |
| 106 return result; | 106 return result; |
| 107 } | 107 } |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 template<> | 110 template<> |
| 111 struct FromValue<Value> { | 111 struct FromValue<Value> { |
| 112 static std::unique_ptr<Value> parse(protocol::Value* value, ErrorSupport* er
rors) | 112 static std::unique_ptr<Value> parse(protocol::Value* value, ErrorSupport* er
rors) |
| 113 { | 113 { |
| 114 bool success = !!value; | 114 bool success = !!value; |
| 115 if (!success) | 115 if (!success) { |
| 116 errors->addError("value expected"); | 116 errors->addError("value expected"); |
| 117 return nullptr; |
| 118 } |
| 117 return value->clone(); | 119 return value->clone(); |
| 118 } | 120 } |
| 119 }; | 121 }; |
| 120 | 122 |
| 121 template<> | 123 template<> |
| 122 struct FromValue<DictionaryValue> { | 124 struct FromValue<DictionaryValue> { |
| 123 static std::unique_ptr<DictionaryValue> parse(protocol::Value* value, ErrorS
upport* errors) | 125 static std::unique_ptr<DictionaryValue> parse(protocol::Value* value, ErrorS
upport* errors) |
| 124 { | 126 { |
| 125 bool success = value && value->type() == protocol::Value::TypeObject; | 127 bool success = value && value->type() == protocol::Value::TypeObject; |
| 126 if (!success) | 128 if (!success) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 147 static std::unique_ptr<protocol::Array<T>> parse(protocol::Value* value, Err
orSupport* errors) | 149 static std::unique_ptr<protocol::Array<T>> parse(protocol::Value* value, Err
orSupport* errors) |
| 148 { | 150 { |
| 149 return protocol::Array<T>::parse(value, errors); | 151 return protocol::Array<T>::parse(value, errors); |
| 150 } | 152 } |
| 151 }; | 153 }; |
| 152 | 154 |
| 153 } // namespace platform | 155 } // namespace platform |
| 154 } // namespace blink | 156 } // namespace blink |
| 155 | 157 |
| 156 #endif // !defined(ValueConversions_h) | 158 #endif // !defined(ValueConversions_h) |
| OLD | NEW |