| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SKY_ENGINE_TONIC_DART_CONVERTER_H_ | 5 #ifndef SKY_ENGINE_TONIC_DART_CONVERTER_H_ |
| 6 #define SKY_ENGINE_TONIC_DART_CONVERTER_H_ | 6 #define SKY_ENGINE_TONIC_DART_CONVERTER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include "sky/engine/tonic/dart_state.h" | 9 #include "sky/engine/tonic/dart_state.h" |
| 10 #include "sky/engine/tonic/dart_string.h" | 10 #include "sky/engine/tonic/dart_string.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 return Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(val.data()), | 313 return Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(val.data()), |
| 314 val.length()); | 314 val.length()); |
| 315 } | 315 } |
| 316 | 316 |
| 317 inline std::string StdStringFromDart(Dart_Handle handle) { | 317 inline std::string StdStringFromDart(Dart_Handle handle) { |
| 318 String string = StringFromDart(handle); | 318 String string = StringFromDart(handle); |
| 319 StringUTF8Adaptor utf8(string); | 319 StringUTF8Adaptor utf8(string); |
| 320 return std::string(utf8.data(), utf8.length()); | 320 return std::string(utf8.data(), utf8.length()); |
| 321 } | 321 } |
| 322 | 322 |
| 323 |
| 324 // Alias Dart_NewStringFromCString for less typing. |
| 325 inline Dart_Handle ToDart(const char* val) { |
| 326 return Dart_NewStringFromCString(val); |
| 327 } |
| 328 |
| 323 } // namespace blink | 329 } // namespace blink |
| 324 | 330 |
| 325 #endif // SKY_ENGINE_TONIC_DART_CONVERTER_H_ | 331 #endif // SKY_ENGINE_TONIC_DART_CONVERTER_H_ |
| OLD | NEW |