Update engine
This change brings in a new version of Mojo, which has improved Mozart interfaces.
This commit is contained in:
parent
5ccfd94871
commit
865e3cc0ce
2
bin/cache/dart-sdk.version
vendored
2
bin/cache/dart-sdk.version
vendored
@ -1 +1 @@
|
|||||||
1.15.0-dev.4.0
|
1.15.0-dev.5.0
|
||||||
|
2
bin/cache/engine.version
vendored
2
bin/cache/engine.version
vendored
@ -1 +1 @@
|
|||||||
d474e9d2b60a9cb111c09844c10081b68bde9252
|
abd1afd598b659b3c1033cc52eedbc4a4069ac7d
|
||||||
|
@ -17,14 +17,14 @@ import 'package:mojo/mojo/service_provider.mojom.dart' as mojom;
|
|||||||
import 'box.dart';
|
import 'box.dart';
|
||||||
import 'object.dart';
|
import 'object.dart';
|
||||||
|
|
||||||
mojom.ViewHostProxy _initViewHostProxy() {
|
mojom.ViewProxy _initViewProxy() {
|
||||||
int viewHost = ui.takeViewHostHandle();
|
int viewHandle = ui.takeViewHandle();
|
||||||
assert(() {
|
assert(() {
|
||||||
if (viewHost == 0)
|
if (viewHandle == 0)
|
||||||
debugPrint('Child view are supported only when running in Mojo shell.');
|
debugPrint('Child view are supported only when running in Mojo shell.');
|
||||||
return true;
|
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
|
// 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
|
// 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
|
// view keys, which means any scheme for sharing the view host also needs to
|
||||||
// provide a mechanism for coordinating about view keys.
|
// provide a mechanism for coordinating about view keys.
|
||||||
final mojom.ViewHostProxy _viewHostProxy = _initViewHostProxy();
|
final mojom.ViewProxy _viewProxy = _initViewProxy();
|
||||||
final mojom.ViewHost _viewHost = _viewHostProxy?.ptr;
|
final mojom.View _view = _viewProxy?.ptr;
|
||||||
|
|
||||||
class ChildViewConnection {
|
class ChildViewConnection {
|
||||||
ChildViewConnection({ this.url }) {
|
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();
|
mojom.ViewProviderProxy viewProvider = new mojom.ViewProviderProxy.unbound();
|
||||||
shell.connectToService(url, viewProvider);
|
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);
|
_connection = new ApplicationConnection(outgoingServices, incomingServices);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,39 +52,26 @@ class ChildViewConnection {
|
|||||||
ApplicationConnection get connection => _connection;
|
ApplicationConnection get connection => _connection;
|
||||||
ApplicationConnection _connection;
|
ApplicationConnection _connection;
|
||||||
|
|
||||||
Future<mojom.ViewToken> _unresolvedViewToken;
|
mojom.ViewOwnerProxy _viewOwner;
|
||||||
mojom.ViewToken _viewToken;
|
|
||||||
|
|
||||||
Future<mojom.ViewToken> _awaitResponse(
|
|
||||||
Future<mojom.ViewProviderCreateViewResponseParams> 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _nextViewKey = 1;
|
static int _nextViewKey = 1;
|
||||||
int _viewKey;
|
int _viewKey;
|
||||||
|
|
||||||
void _addChildToViewHost() {
|
void _addChildToViewHost() {
|
||||||
assert(_attached);
|
assert(_attached);
|
||||||
assert(_viewToken != null);
|
assert(_viewOwner != null);
|
||||||
assert(_viewKey == null);
|
assert(_viewKey == null);
|
||||||
_viewKey = _nextViewKey++;
|
_viewKey = _nextViewKey++;
|
||||||
_viewHost.addChild(_viewKey, _viewToken);
|
_view.addChild(_viewKey, _viewOwner.impl);
|
||||||
|
_viewOwner = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _removeChildFromViewHost() {
|
void _removeChildFromViewHost() {
|
||||||
assert(!_attached);
|
assert(!_attached);
|
||||||
assert(_viewToken != null);
|
assert(_viewOwner == null);
|
||||||
assert(_viewKey != null);
|
assert(_viewKey != null);
|
||||||
_viewHost.removeChild(_viewKey);
|
_viewOwner = new mojom.ViewOwnerProxy.unbound();
|
||||||
|
_view.removeChild(_viewKey, _viewOwner);
|
||||||
_viewKey = null;
|
_viewKey = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +85,7 @@ class ChildViewConnection {
|
|||||||
void _attach() {
|
void _attach() {
|
||||||
assert(_attachments >= 0);
|
assert(_attachments >= 0);
|
||||||
++_attachments;
|
++_attachments;
|
||||||
if (_viewToken != null && _viewKey == null)
|
if (_viewKey == null)
|
||||||
_addChildToViewHost();
|
_addChildToViewHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +118,7 @@ class ChildViewConnection {
|
|||||||
mojom.ViewLayoutParams layoutParams = new mojom.ViewLayoutParams()
|
mojom.ViewLayoutParams layoutParams = new mojom.ViewLayoutParams()
|
||||||
..constraints = childConstraints
|
..constraints = childConstraints
|
||||||
..devicePixelRatio = scale;
|
..devicePixelRatio = scale;
|
||||||
return (await _viewHost.layoutChild(_viewKey, layoutParams)).info;
|
return (await _view.layoutChild(_viewKey, layoutParams)).info;
|
||||||
}
|
}
|
||||||
|
|
||||||
String toString() {
|
String toString() {
|
||||||
@ -142,10 +130,7 @@ class RenderChildView extends RenderBox {
|
|||||||
RenderChildView({
|
RenderChildView({
|
||||||
ChildViewConnection child,
|
ChildViewConnection child,
|
||||||
double scale
|
double scale
|
||||||
}) : _child = child, _scale = scale {
|
}) : _child = child, _scale = scale;
|
||||||
if (_child != null)
|
|
||||||
_awaitViewToken();
|
|
||||||
}
|
|
||||||
|
|
||||||
ChildViewConnection get child => _child;
|
ChildViewConnection get child => _child;
|
||||||
ChildViewConnection _child;
|
ChildViewConnection _child;
|
||||||
@ -158,26 +143,13 @@ class RenderChildView extends RenderBox {
|
|||||||
_layoutInfo = null;
|
_layoutInfo = null;
|
||||||
if (attached)
|
if (attached)
|
||||||
_child?._attach();
|
_child?._attach();
|
||||||
|
|
||||||
if (_child == null) {
|
if (_child == null) {
|
||||||
markNeedsPaint();
|
markNeedsPaint();
|
||||||
} else if (_child._viewToken != null) {
|
|
||||||
// We've already connected to the view, so we're ready to invalidate our
|
|
||||||
// layout immediately.
|
|
||||||
markNeedsLayout();
|
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, we're still in the process of connecting, so we need to
|
markNeedsLayout();
|
||||||
// repaint now (to remove any old child view), and we need to watch for
|
|
||||||
// the view token resolving before attempting layout.
|
|
||||||
markNeedsPaint();
|
|
||||||
_awaitViewToken();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _awaitViewToken() {
|
|
||||||
_child._unresolvedViewToken.then(_handleViewTokenResolved);
|
|
||||||
}
|
|
||||||
|
|
||||||
double get scale => _scale;
|
double get scale => _scale;
|
||||||
double _scale;
|
double _scale;
|
||||||
void set scale (double value) {
|
void set scale (double value) {
|
||||||
@ -206,7 +178,7 @@ class RenderChildView extends RenderBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void performLayout() {
|
void performLayout() {
|
||||||
if (_child != null && _child._viewToken != null)
|
if (_child != null)
|
||||||
_child._layout(size: size, scale: scale).then(_handleLayoutInfoChanged);
|
_child._layout(size: size, scale: scale).then(_handleLayoutInfoChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,13 +189,6 @@ class RenderChildView extends RenderBox {
|
|||||||
markNeedsPaint();
|
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;
|
bool hitTestSelf(Point position) => true;
|
||||||
|
|
||||||
void paint(PaintingContext context, Offset offset) {
|
void paint(PaintingContext context, Offset offset) {
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'dart:collection';
|
|
||||||
|
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@ -324,10 +322,7 @@ class _DragTargetState<T> extends State<DragTarget<T>> {
|
|||||||
return new MetaData(
|
return new MetaData(
|
||||||
metaData: this,
|
metaData: this,
|
||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
child: config.builder(context,
|
child: config.builder(context, _candidateData, _rejectedData)
|
||||||
new UnmodifiableListView<T>(_candidateData),
|
|
||||||
new UnmodifiableListView<dynamic>(_rejectedData)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user