Suharsh Sivakumar | 628a8ee | 2015-01-14 11:38:56 -0800 | [diff] [blame] | 1 | package profiles |
| 2 | |
| 3 | import ( |
| 4 | "v.io/core/veyron2" |
| 5 | "v.io/core/veyron2/context" |
| 6 | |
| 7 | "v.io/core/veyron/lib/appcycle" |
| 8 | _ "v.io/core/veyron/runtimes/google/ipc/protocols/tcp" |
| 9 | _ "v.io/core/veyron/runtimes/google/ipc/protocols/ws" |
| 10 | _ "v.io/core/veyron/runtimes/google/ipc/protocols/wsh" |
| 11 | grt "v.io/core/veyron/runtimes/google/rt" |
| 12 | ) |
| 13 | |
| 14 | func init() { |
| 15 | veyron2.RegisterProfileInit(Init) |
| 16 | } |
| 17 | |
Matt Rosencrantz | aeed5d5 | 2015-01-14 15:18:34 -0800 | [diff] [blame] | 18 | func Init(ctx *context.T) (veyron2.RuntimeX, *context.T, veyron2.Shutdown, error) { |
Suharsh Sivakumar | 628a8ee | 2015-01-14 11:38:56 -0800 | [diff] [blame] | 19 | runtime := &grt.RuntimeX{} |
Matt Rosencrantz | aeed5d5 | 2015-01-14 15:18:34 -0800 | [diff] [blame] | 20 | ctx, shutdown, err := runtime.Init(ctx, nil) |
Suharsh Sivakumar | 628a8ee | 2015-01-14 11:38:56 -0800 | [diff] [blame] | 21 | if err != nil { |
Matt Rosencrantz | aeed5d5 | 2015-01-14 15:18:34 -0800 | [diff] [blame] | 22 | return nil, nil, nil, err |
Suharsh Sivakumar | 628a8ee | 2015-01-14 11:38:56 -0800 | [diff] [blame] | 23 | } |
Suharsh Sivakumar | 98aa48c | 2015-01-14 16:11:30 -0800 | [diff] [blame] | 24 | veyron2.GetLogger(ctx).VI(1).Infof("Initializing generic profile.") |
Suharsh Sivakumar | 628a8ee | 2015-01-14 11:38:56 -0800 | [diff] [blame] | 25 | |
| 26 | ac := appcycle.New() |
| 27 | ctx = runtime.SetAppCycle(ctx, ac) |
Matt Rosencrantz | aeed5d5 | 2015-01-14 15:18:34 -0800 | [diff] [blame] | 28 | |
| 29 | profileShutdown := func() { |
| 30 | shutdown() |
| 31 | ac.Shutdown() |
Suharsh Sivakumar | 628a8ee | 2015-01-14 11:38:56 -0800 | [diff] [blame] | 32 | } |
Matt Rosencrantz | aeed5d5 | 2015-01-14 15:18:34 -0800 | [diff] [blame] | 33 | return runtime, ctx, profileShutdown, nil |
Suharsh Sivakumar | 628a8ee | 2015-01-14 11:38:56 -0800 | [diff] [blame] | 34 | } |