blob: 1c7b47fc836abe1304885252c2d89332b8284129 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:fidl/fidl.dart';
import 'package:fidl_fuchsia_ui_viewsv1/fidl_async.dart';
import 'package:zircon/zircon.dart';
import 'internal/_mozart.dart';
import 'view_container_listener_impl.dart';
int _nextViewKey = 1;
ViewContainerProxy _initViewContainer() {
// Analyzer doesn't know Handle must be dart:zircon's Handle
final Handle handle = ScenicStartupInfo.takeViewContainer();
if (handle == null) {
return null;
final ViewContainerProxy proxy = ViewContainerProxy()
assert(() {
proxy.ctrl.whenClosed.then((_) async {
print('ViewContainerProxy: closed');
return true;
return proxy;
/// The global |ViewContainer| for this flutter isolate.
final ViewContainerProxy globalViewContainer = _initViewContainer();
/// Obtain a new view key from the global counter for this flutter isolate.
int nextGlobalViewKey() {
return _nextViewKey++;