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

Unified Diff: mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl

Issue 1648803006: Expose Service Describer in Dart mojo package (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Address zra's feedback Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/dart/unittests/embedder_tests/bindings_generation_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl b/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl
index 2367a585e0b31bb0916ddaae618b2a215c95f279..7b085213c6ae75183c843c1a8e7f4aaab2933f0a 100644
--- a/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl
@@ -15,19 +15,22 @@ const int _{{interface|name}}_{{method|name}}Name = {{method.ordinal}};
class _{{interface|name}}ServiceDescription implements {{descpkg}}ServiceDescription {
{%- if should_gen_mojom_types %}
dynamic getTopLevelInterface([Function responseFactory]) =>
- _{{interface|mojom_type_identifier|lower_camel}}();
+ responseFactory(_{{interface|mojom_type_identifier|lower_camel}}());
dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
- getAllMojomTypeDefinitions()[typeKey];
+ responseFactory(getAllMojomTypeDefinitions()[typeKey]);
dynamic getAllTypeDefinitions([Function responseFactory]) =>
- getAllMojomTypeDefinitions();
+ responseFactory(getAllMojomTypeDefinitions());
{%- else %}
- dynamic getTopLevelInterface([Function responseFactory]) => null;
+ dynamic getTopLevelInterface([Function responseFactory]) =>
+ responseFactory(null);
- dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
+ dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
+ responseFactory(null);
- dynamic getAllTypeDefinitions([Function responseFactory]) => null;
+ dynamic getAllTypeDefinitions([Function responseFactory]) =>
+ responseFactory(null);
{%- endif %}
}
@@ -325,6 +328,11 @@ class {{interface|name}}Stub extends bindings.Stub {
int get version => {{interface.version}};
- {{descpkg}}ServiceDescription get serviceDescription =>
- new _{{interface|name}}ServiceDescription();
+ static {{descpkg}}ServiceDescription _cachedServiceDescription;
+ static {{descpkg}}ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _{{interface|name}}ServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
}
« no previous file with comments | « mojo/dart/unittests/embedder_tests/bindings_generation_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698