| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 PLATFORM_EXPORT std::unique_ptr<protocol::Value> toValue(protocol::ListValue* pa
ram); | 30 PLATFORM_EXPORT std::unique_ptr<protocol::Value> toValue(protocol::ListValue* pa
ram); |
| 31 | 31 |
| 32 template<typename T> std::unique_ptr<protocol::Value> toValue(T* param) | 32 template<typename T> std::unique_ptr<protocol::Value> toValue(T* param) |
| 33 { | 33 { |
| 34 return param->serialize(); | 34 return param->serialize(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 template<typename T> std::unique_ptr<protocol::Value> toValue(const std::unique_
ptr<T>& param) | 37 template<typename T> std::unique_ptr<protocol::Value> toValue(const std::unique_
ptr<T>& param) |
| 38 { | 38 { |
| 39 static_assert(sizeof(T) == 0, "use raw pointer version."); | 39 return toValue(param.get()); |
| 40 return nullptr; | |
| 41 } | |
| 42 | |
| 43 template<typename T> std::unique_ptr<protocol::Value> toValue(std::unique_ptr<T>
param) | |
| 44 { | |
| 45 static_assert(sizeof(T) == 0, "use raw pointer version."); | |
| 46 return nullptr; | |
| 47 } | 40 } |
| 48 | 41 |
| 49 template<typename T> | 42 template<typename T> |
| 50 struct FromValue { | 43 struct FromValue { |
| 51 static std::unique_ptr<T> parse(protocol::Value* value, ErrorSupport* errors
) | 44 static std::unique_ptr<T> parse(protocol::Value* value, ErrorSupport* errors
) |
| 52 { | 45 { |
| 53 return T::parse(value, errors); | 46 return T::parse(value, errors); |
| 54 } | 47 } |
| 55 }; | 48 }; |
| 56 | 49 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 static std::unique_ptr<protocol::Array<T>> parse(protocol::Value* value, Err
orSupport* errors) | 147 static std::unique_ptr<protocol::Array<T>> parse(protocol::Value* value, Err
orSupport* errors) |
| 155 { | 148 { |
| 156 return protocol::Array<T>::parse(value, errors); | 149 return protocol::Array<T>::parse(value, errors); |
| 157 } | 150 } |
| 158 }; | 151 }; |
| 159 | 152 |
| 160 } // namespace platform | 153 } // namespace platform |
| 161 } // namespace blink | 154 } // namespace blink |
| 162 | 155 |
| 163 #endif // !defined(ValueConversions_h) | 156 #endif // !defined(ValueConversions_h) |
| OLD | NEW |