Index: sky/engine/tonic/mojo_converter.h |
diff --git a/sky/engine/tonic/mojo_converter.h b/sky/engine/tonic/mojo_converter.h |
index cfdd4b01628d47dbc24f84a814f598a9501f2551..24705fae44b2b08384f34c4904a5421e8a67a99a 100644 |
--- a/sky/engine/tonic/mojo_converter.h |
+++ b/sky/engine/tonic/mojo_converter.h |
@@ -25,6 +25,20 @@ struct DartConverter<mojo::ScopedHandleBase<HandleType>> { |
static Dart_Handle ToDart(mojo::ScopedHandleBase<HandleType> mojo_handle) { |
return Dart_NewInteger(static_cast<int64_t>(mojo_handle.release().value())); |
} |
+ |
+ static mojo::ScopedHandleBase<HandleType> FromArgumentsWithNullCheck( |
+ Dart_NativeArguments args, |
+ int index, |
+ Dart_Handle& exception, |
+ bool auto_scope = true) { |
+ int64_t mojo_handle64 = 0; |
+ Dart_Handle result = Dart_GetNativeIntegerArgument(args, index, &mojo_handle64); |
+ if (Dart_IsError(result) || !mojo_handle64) |
+ return mojo::ScopedHandleBase<HandleType>(); |
+ |
+ HandleType mojo_handle(static_cast<MojoHandle>(mojo_handle64)); |
+ return mojo::MakeScopedHandle(mojo_handle); |
+ } |
}; |
} // namespace blink |