Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: sky/engine/tonic/dart_converter.h

Issue 918333002: Add the c++ code part of bindings2/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Updated per earlier reviews Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/tonic/dart_builtin.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « sky/engine/tonic/dart_builtin.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698