diff --git a/bin/cache/dart-sdk.version b/bin/cache/dart-sdk.version index e32424f6b15..151d5361786 100644 --- a/bin/cache/dart-sdk.version +++ b/bin/cache/dart-sdk.version @@ -1 +1 @@ -1.15.0-dev.4.0 +1.15.0-dev.5.0 diff --git a/bin/cache/engine.version b/bin/cache/engine.version index 81e7dc7a723..e193a482f50 100644 --- a/bin/cache/engine.version +++ b/bin/cache/engine.version @@ -1 +1 @@ -d474e9d2b60a9cb111c09844c10081b68bde9252 +abd1afd598b659b3c1033cc52eedbc4a4069ac7d diff --git a/packages/flutter/lib/src/rendering/child_view.dart b/packages/flutter/lib/src/rendering/child_view.dart index 4a5520a61de..7e160999722 100644 --- a/packages/flutter/lib/src/rendering/child_view.dart +++ b/packages/flutter/lib/src/rendering/child_view.dart @@ -17,14 +17,14 @@ import 'package:mojo/mojo/service_provider.mojom.dart' as mojom; import 'box.dart'; import 'object.dart'; -mojom.ViewHostProxy _initViewHostProxy() { - int viewHost = ui.takeViewHostHandle(); +mojom.ViewProxy _initViewProxy() { + int viewHandle = ui.takeViewHandle(); assert(() { - if (viewHost == 0) + if (viewHandle == 0) debugPrint('Child view are supported only when running in Mojo shell.'); return true; }); - return new mojom.ViewHostProxy.fromHandle(new core.MojoHandle(viewHost)); + return new mojom.ViewProxy.fromHandle(new core.MojoHandle(viewHandle)); } // TODO(abarth): The view host is a unique resource. We should structure how we @@ -32,17 +32,18 @@ mojom.ViewHostProxy _initViewHostProxy() { // the view host safely. Unfortunately, the view host has a global namespace of // view keys, which means any scheme for sharing the view host also needs to // provide a mechanism for coordinating about view keys. -final mojom.ViewHostProxy _viewHostProxy = _initViewHostProxy(); -final mojom.ViewHost _viewHost = _viewHostProxy?.ptr; +final mojom.ViewProxy _viewProxy = _initViewProxy(); +final mojom.View _view = _viewProxy?.ptr; class ChildViewConnection { ChildViewConnection({ this.url }) { - mojom.ServiceProviderProxy incomingServices = new mojom.ServiceProviderProxy.unbound(); - mojom.ServiceProviderStub outgoingServices = new mojom.ServiceProviderStub.unbound(); - assert(_viewToken == null); mojom.ViewProviderProxy viewProvider = new mojom.ViewProviderProxy.unbound(); shell.connectToService(url, viewProvider); - _unresolvedViewToken = _awaitResponse(viewProvider.ptr.createView(incomingServices, outgoingServices), viewProvider); + mojom.ServiceProviderProxy incomingServices = new mojom.ServiceProviderProxy.unbound(); + mojom.ServiceProviderStub outgoingServices = new mojom.ServiceProviderStub.unbound(); + _viewOwner = new mojom.ViewOwnerProxy.unbound(); + viewProvider.ptr.createView(_viewOwner, incomingServices, outgoingServices); + viewProvider.close(); _connection = new ApplicationConnection(outgoingServices, incomingServices); } @@ -51,39 +52,26 @@ class ChildViewConnection { ApplicationConnection get connection => _connection; ApplicationConnection _connection; - Future _unresolvedViewToken; - mojom.ViewToken _viewToken; - - Future _awaitResponse( - Future response, - mojom.ViewProviderProxy viewProvider - ) async { - mojom.ViewToken viewToken = (await response).viewToken; - viewProvider.close(); - assert(_viewToken == null); - _viewToken = viewToken; - assert(_viewKey == null); - if (_attached) - _addChildToViewHost(); - return viewToken; - } + mojom.ViewOwnerProxy _viewOwner; static int _nextViewKey = 1; int _viewKey; void _addChildToViewHost() { assert(_attached); - assert(_viewToken != null); + assert(_viewOwner != null); assert(_viewKey == null); _viewKey = _nextViewKey++; - _viewHost.addChild(_viewKey, _viewToken); + _view.addChild(_viewKey, _viewOwner.impl); + _viewOwner = null; } void _removeChildFromViewHost() { assert(!_attached); - assert(_viewToken != null); + assert(_viewOwner == null); assert(_viewKey != null); - _viewHost.removeChild(_viewKey); + _viewOwner = new mojom.ViewOwnerProxy.unbound(); + _view.removeChild(_viewKey, _viewOwner); _viewKey = null; } @@ -97,7 +85,7 @@ class ChildViewConnection { void _attach() { assert(_attachments >= 0); ++_attachments; - if (_viewToken != null && _viewKey == null) + if (_viewKey == null) _addChildToViewHost(); } @@ -130,7 +118,7 @@ class ChildViewConnection { mojom.ViewLayoutParams layoutParams = new mojom.ViewLayoutParams() ..constraints = childConstraints ..devicePixelRatio = scale; - return (await _viewHost.layoutChild(_viewKey, layoutParams)).info; + return (await _view.layoutChild(_viewKey, layoutParams)).info; } String toString() { @@ -142,10 +130,7 @@ class RenderChildView extends RenderBox { RenderChildView({ ChildViewConnection child, double scale - }) : _child = child, _scale = scale { - if (_child != null) - _awaitViewToken(); - } + }) : _child = child, _scale = scale; ChildViewConnection get child => _child; ChildViewConnection _child; @@ -158,26 +143,13 @@ class RenderChildView extends RenderBox { _layoutInfo = null; if (attached) _child?._attach(); - if (_child == null) { markNeedsPaint(); - } else if (_child._viewToken != null) { - // We've already connected to the view, so we're ready to invalidate our - // layout immediately. - markNeedsLayout(); } else { - // Otherwise, we're still in the process of connecting, so we need to - // repaint now (to remove any old child view), and we need to watch for - // the view token resolving before attempting layout. - markNeedsPaint(); - _awaitViewToken(); + markNeedsLayout(); } } - void _awaitViewToken() { - _child._unresolvedViewToken.then(_handleViewTokenResolved); - } - double get scale => _scale; double _scale; void set scale (double value) { @@ -206,7 +178,7 @@ class RenderChildView extends RenderBox { } void performLayout() { - if (_child != null && _child._viewToken != null) + if (_child != null) _child._layout(size: size, scale: scale).then(_handleLayoutInfoChanged); } @@ -217,13 +189,6 @@ class RenderChildView extends RenderBox { markNeedsPaint(); } - void _handleViewTokenResolved(mojom.ViewToken viewToken) { - // The _viewToken might not match viewToken if _child changed between the - // time we started waiting for the future and the time it resolved. - if (attached && _child?._viewToken == viewToken) - markNeedsLayout(); - } - bool hitTestSelf(Point position) => true; void paint(PaintingContext context, Offset offset) { diff --git a/packages/flutter/lib/src/widgets/drag_target.dart b/packages/flutter/lib/src/widgets/drag_target.dart index 030620efe76..015094ae772 100644 --- a/packages/flutter/lib/src/widgets/drag_target.dart +++ b/packages/flutter/lib/src/widgets/drag_target.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:collection'; - import 'package:flutter/gestures.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; @@ -324,10 +322,7 @@ class _DragTargetState extends State> { return new MetaData( metaData: this, behavior: HitTestBehavior.translucent, - child: config.builder(context, - new UnmodifiableListView(_candidateData), - new UnmodifiableListView(_rejectedData) - ) + child: config.builder(context, _candidateData, _rejectedData) ); } }