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 package main | 5 package main |
6 | 6 |
7 import ( | 7 import ( |
8 "log" | 8 "log" |
9 | 9 |
10 "code.google.com/p/go.mobile/app" | 10 "code.google.com/p/go.mobile/app" |
11 | 11 |
12 "mojo/public/go/application" | 12 "mojo/public/go/application" |
13 "mojo/public/go/bindings" | 13 "mojo/public/go/bindings" |
14 "mojo/public/go/system" | 14 "mojo/public/go/system" |
15 | 15 |
16 "examples/echo/echo" | 16 "examples/echo/echo" |
17 ) | 17 ) |
18 | 18 |
19 //#include "mojo/public/c/system/types.h" | 19 //#include "mojo/public/c/system/types.h" |
20 import "C" | 20 import "C" |
21 | 21 |
22 type EchoImpl struct{} | 22 type EchoImpl struct{} |
23 | 23 |
24 func (echo *EchoImpl) EchoString(inValue *string) (outValue *string, err error)
{ | 24 func (echo *EchoImpl) EchoString(inValue *string) (outValue *string, err error)
{ |
25 » log.Println(*inValue) | 25 » log.Printf("server: %s\n", *inValue) |
26 return inValue, nil | 26 return inValue, nil |
27 } | 27 } |
28 | 28 |
29 type EchoServerDelegate struct { | 29 type EchoServerDelegate struct { |
30 stubs []*bindings.Stub | 30 stubs []*bindings.Stub |
31 } | 31 } |
32 | 32 |
33 func (delegate *EchoServerDelegate) Initialize(context application.Context) {} | 33 func (delegate *EchoServerDelegate) Initialize(context application.Context) {} |
34 | 34 |
35 func (delegate *EchoServerDelegate) Create(request echo.EchoRequest) { | 35 func (delegate *EchoServerDelegate) Create(request echo.EchoRequest) { |
(...skipping 22 matching lines...) Expand all Loading... |
58 | 58 |
59 //export MojoMain | 59 //export MojoMain |
60 func MojoMain(handle C.MojoHandle) C.MojoResult { | 60 func MojoMain(handle C.MojoHandle) C.MojoResult { |
61 application.Run(&EchoServerDelegate{}, system.MojoHandle(handle)) | 61 application.Run(&EchoServerDelegate{}, system.MojoHandle(handle)) |
62 return C.MOJO_RESULT_OK | 62 return C.MOJO_RESULT_OK |
63 } | 63 } |
64 | 64 |
65 func main() { | 65 func main() { |
66 app.Run(app.Callbacks{}) | 66 app.Run(app.Callbacks{}) |
67 } | 67 } |
OLD | NEW |