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_MOJO_CONVERTER_H_ | 5 #ifndef TONIC_MOJO_CONVERTER_H_ |
6 #define SKY_ENGINE_TONIC_MOJO_CONVERTER_H_ | 6 #define TONIC_MOJO_CONVERTER_H_ |
7 | 7 |
8 #include "mojo/public/cpp/system/handle.h" | 8 #include "mojo/public/cpp/system/handle.h" |
9 #include "tonic/dart_converter.h" | 9 #include "tonic/dart_converter.h" |
10 | 10 |
11 namespace tonic { | 11 namespace tonic { |
12 | 12 |
13 template <typename HandleType> | 13 template <typename HandleType> |
14 struct DartConverter<mojo::ScopedHandleBase<HandleType>> { | 14 struct DartConverter<mojo::ScopedHandleBase<HandleType>> { |
15 static mojo::ScopedHandleBase<HandleType> FromDart(Dart_Handle handle) { | 15 static mojo::ScopedHandleBase<HandleType> FromDart(Dart_Handle handle) { |
16 uint64_t mojo_handle64 = 0; | 16 uint64_t mojo_handle64 = 0; |
(...skipping 19 matching lines...) Expand all Loading... |
36 if (Dart_IsError(result) || !mojo_handle64) | 36 if (Dart_IsError(result) || !mojo_handle64) |
37 return mojo::ScopedHandleBase<HandleType>(); | 37 return mojo::ScopedHandleBase<HandleType>(); |
38 | 38 |
39 HandleType mojo_handle(static_cast<MojoHandle>(mojo_handle64)); | 39 HandleType mojo_handle(static_cast<MojoHandle>(mojo_handle64)); |
40 return mojo::MakeScopedHandle(mojo_handle); | 40 return mojo::MakeScopedHandle(mojo_handle); |
41 } | 41 } |
42 }; | 42 }; |
43 | 43 |
44 } // namespace tonic | 44 } // namespace tonic |
45 | 45 |
46 #endif // SKY_ENGINE_TONIC_MOJO_CONVERTER_H_ | 46 #endif // TONIC_MOJO_CONVERTER_H_ |
OLD | NEW |