| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 [DartPackage="_mojo_for_test_only", JavaPackage="org.chromium.mojo.bindings.test
.mojom.sample"] | 5 [DartPackage="_mojo_for_test_only", |
| 6 JavaPackage="org.chromium.mojo.bindings.test.mojom.sample"] |
| 6 module sample; | 7 module sample; |
| 7 | 8 |
| 8 import "sample_import.mojom"; | 9 import "sample_import.mojom"; |
| 9 | 10 |
| 10 // This sample shows how handles to MessagePipes can be sent as both parameters | 11 // This sample shows how handles to MessagePipes can be sent as both parameters |
| 11 // to methods as well as fields on structs. | 12 // to methods as well as fields on structs. |
| 12 | 13 |
| 13 struct Request { | 14 struct Request { |
| 14 int32 x; | 15 int32 x; |
| 15 handle<message_pipe>? pipe; | 16 handle<message_pipe>? pipe; |
| 16 array<handle<message_pipe>>? more_pipes; | 17 array<handle<message_pipe>>? more_pipes; |
| 17 | 18 |
| 18 // Interfaces can be used as members. | 19 // Interfaces can be used as members. |
| 19 imported.ImportedInterface? obj; | 20 imported.ImportedInterface? obj; |
| 20 }; | 21 }; |
| 21 | 22 |
| 22 struct Response { | 23 struct Response { |
| 23 int32 x; | 24 int32 x; |
| 24 handle<message_pipe>? pipe; | 25 handle<message_pipe>? pipe; |
| 25 }; | 26 }; |
| 26 | 27 |
| 27 [ServiceName="sample::NamedObject"] | 28 [ServiceName="sample::NamedObject"] |
| 28 interface NamedObject { | 29 interface NamedObject { |
| 29 SetName(string name); | 30 SetName(string name); |
| 30 GetName() => (string name); | 31 GetName() => (string name); |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 interface Factory { | 34 interface Factory { |
| 34 DoStuff(Request request, handle<message_pipe>? pipe) => | 35 DoStuff(Request request, handle<message_pipe>? pipe) |
| 35 (Response response, string text); | 36 => (Response response, string text); |
| 36 DoStuff2(handle<data_pipe_consumer> pipe) => (string text); | 37 DoStuff2(handle<data_pipe_consumer> pipe) => (string text); |
| 37 CreateNamedObject(NamedObject& obj); | 38 CreateNamedObject(NamedObject& obj); |
| 38 RequestImportedInterface( | 39 RequestImportedInterface(imported.ImportedInterface& obj) |
| 39 imported.ImportedInterface& obj) => (imported.ImportedInterface& obj); | 40 => (imported.ImportedInterface& obj); |
| 40 TakeImportedInterface( | 41 TakeImportedInterface(imported.ImportedInterface obj) |
| 41 imported.ImportedInterface obj) => (imported.ImportedInterface obj); | 42 => (imported.ImportedInterface obj); |
| 42 }; | 43 }; |
| OLD | NEW |