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

Unified Diff: sky/engine/tonic/mojo_converter.h

Issue 1173703002: Move image loading out of C++ into Dart (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rename fetchMojo to fetchUrl Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/loader/ImageLoaderCallback.idl ('k') | sky/examples/stocks/lib/stock_data.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « sky/engine/core/loader/ImageLoaderCallback.idl ('k') | sky/examples/stocks/lib/stock_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698