浏览代码

Revert "Merge pull request #37 from Unity-Technologies/upgrade_scheduler"

This reverts commit 90a94113824095e376cf649b81df98e93ba71e58, reversing
changes made to 9a62cfdb9cc72dfd465f52dcc6e63931e8898b97.
/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
c98a7e85
共有 27 个文件被更改,包括 546 次插入1487 次删除
  1. 128
      com.unity.uiwidgets/Runtime/animation/listener_helpers.mixin.gen.cs
  2. 30
      com.unity.uiwidgets/Runtime/animation/listener_helpers.mixin.njk
  3. 381
      com.unity.uiwidgets/Runtime/foundation/assertions.cs
  4. 9
      com.unity.uiwidgets/Runtime/foundation/binding.cs
  5. 15
      com.unity.uiwidgets/Runtime/foundation/change_notifier.cs
  6. 896
      com.unity.uiwidgets/Runtime/foundation/diagnostics.cs
  7. 4
      com.unity.uiwidgets/Runtime/foundation/object.cs
  8. 16
      com.unity.uiwidgets/Runtime/foundation/observer_list.cs
  9. 6
      com.unity.uiwidgets/Runtime/foundation/print.cs
  10. 11
      com.unity.uiwidgets/Runtime/gestures/binding.cs
  11. 11
      com.unity.uiwidgets/Runtime/gestures/pointer_signal_resolver.cs
  12. 26
      com.unity.uiwidgets/Runtime/gestures/recognizer.cs
  13. 41
      com.unity.uiwidgets/Runtime/painting/image_provider.cs
  14. 14
      com.unity.uiwidgets/Runtime/painting/image_stream.cs
  15. 33
      com.unity.uiwidgets/Runtime/rendering/box.cs
  16. 46
      com.unity.uiwidgets/Runtime/rendering/debug_overflow_indicator.cs
  17. 23
      com.unity.uiwidgets/Runtime/rendering/flex.cs
  18. 20
      com.unity.uiwidgets/Runtime/rendering/layer.cs
  19. 108
      com.unity.uiwidgets/Runtime/rendering/object.cs
  20. 100
      com.unity.uiwidgets/Runtime/rendering/sliver.cs
  21. 75
      com.unity.uiwidgets/Runtime/scheduler2/binding.cs
  22. 14
      com.unity.uiwidgets/Runtime/scheduler2/ticker.cs
  23. 4
      com.unity.uiwidgets/Runtime/services/binding.cs
  24. 2
      com.unity.uiwidgets/Runtime/widgets/binding.cs
  25. 2
      com.unity.uiwidgets/Runtime/widgets/debug.cs
  26. 16
      com.unity.uiwidgets/Runtime/widgets/framework.cs
  27. 2
      com.unity.uiwidgets/Runtime/widgets/image.cs

128
com.unity.uiwidgets/Runtime/animation/listener_helpers.mixin.gen.cs


using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.animation {
public abstract class AnimationLazyListenerMixinAnimation<T> : Animation<T> {
int _listenerCounter = 0;

}
public abstract class AnimationEagerListenerMixinAnimation<T> : Animation<T> {
protected void didRegisterListener() {
}

}
public abstract class
AnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLazyListenerMixinAnimation<T> {
public abstract class AnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLazyListenerMixinAnimation<T> {
readonly ObserverList<VoidCallback> _listeners = new ObserverList<VoidCallback>();
public override void addListener(VoidCallback listener) {

if (_listeners.Contains(listener)) {
listener();
}
}
catch (Exception exception) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new DiagnosticsProperty<
AnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T>>(
"The " + GetType() + " notifying listeners was:",
this,
style: DiagnosticsTreeStyle.errorProperty
);
}
} catch (Exception exception) {
context: new ErrorDescription("while notifying listeners for " + GetType()),
informationCollector: infoCollector
context: "while notifying listeners for " + GetType(),
informationCollector: information => {
information.AppendLine("The " + GetType() + " notifying listeners was:");
information.Append(" " + this);
}
));
}
}

public abstract class
AnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> : AnimationEagerListenerMixinAnimation<T> {
public abstract class AnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> : AnimationEagerListenerMixinAnimation<T> {
readonly ObserverList<VoidCallback> _listeners = new ObserverList<VoidCallback>();
public override void addListener(VoidCallback listener) {

if (_listeners.Contains(listener)) {
listener();
}
}
catch (Exception exception) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new DiagnosticsProperty<
AnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T>>(
"The " + GetType() + " notifying listeners was:",
this,
style: DiagnosticsTreeStyle.errorProperty
);
}
} catch (Exception exception) {
context: new ErrorDescription("while notifying listeners for " + GetType()),
informationCollector: infoCollector
context: "while notifying listeners for " + GetType(),
informationCollector: information => {
information.AppendLine("The " + GetType() + " notifying listeners was:");
information.Append(" " + this);
}
));
}
}

public abstract class
AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> :
AnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> {
public abstract class AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> {
readonly ObserverList<AnimationStatusListener> _statusListeners = new ObserverList<AnimationStatusListener>();
public override void addStatusListener(AnimationStatusListener listener) {

if (_statusListeners.Contains(listener)) {
listener(status);
}
}
catch (Exception exception) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new DiagnosticsProperty<
AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationLazyListenerMixinAnimation
<T>>(
"The " + GetType() + " notifying listeners was:",
this,
style: DiagnosticsTreeStyle.errorProperty
);
}
} catch (Exception exception) {
context: new ErrorDescription("while notifying status listeners for " + GetType()),
informationCollector: infoCollector
context: "while notifying status listeners for " + GetType(),
informationCollector: information => {
information.AppendLine("The " + GetType() + " notifying status listeners was:");
information.Append(" " + this);
}
));
}
}

public abstract class
AnimationLocalStatusListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLazyListenerMixinAnimation<T
> {
public abstract class AnimationLocalStatusListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLazyListenerMixinAnimation<T> {
readonly ObserverList<AnimationStatusListener> _statusListeners = new ObserverList<AnimationStatusListener>();
public override void addStatusListener(AnimationStatusListener listener) {

if (_statusListeners.Contains(listener)) {
listener(status);
}
}
catch (Exception exception) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new DiagnosticsProperty<
AnimationLocalStatusListenersMixinAnimationLazyListenerMixinAnimation<T>>(
"The " + GetType() + " notifying listeners was:",
this,
style: DiagnosticsTreeStyle.errorProperty
);
}
} catch (Exception exception) {
context: new ErrorDescription("while notifying status listeners for " + GetType()),
informationCollector: infoCollector
context: "while notifying status listeners for " + GetType(),
informationCollector: information => {
information.AppendLine("The " + GetType() + " notifying status listeners was:");
information.Append(" " + this);
}
));
}
}

public abstract class
AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> :
AnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> {
public abstract class AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> : AnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> {
readonly ObserverList<AnimationStatusListener> _statusListeners = new ObserverList<AnimationStatusListener>();
public override void addStatusListener(AnimationStatusListener listener) {

if (_statusListeners.Contains(listener)) {
listener(status);
}
}
catch (Exception exception) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new DiagnosticsProperty<
AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationEagerListenerMixinAnimation
<T>>(
"The " + GetType() + " notifying listeners was:",
this,
style: DiagnosticsTreeStyle.errorProperty
);
}
} catch (Exception exception) {
context: new ErrorDescription("while notifying status listeners for " + GetType()),
informationCollector: infoCollector
context: "while notifying status listeners for " + GetType(),
informationCollector: information => {
information.AppendLine("The " + GetType() + " notifying status listeners was:");
information.Append(" " + this);
}
}

30
com.unity.uiwidgets/Runtime/animation/listener_helpers.mixin.njk


listener();
}
} catch (Exception exception) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new DiagnosticsProperty<AnimationLocalListenersMixin{{with | safe}}>(
"The " + this.GetType() + " notifying listeners was:",
this,
style: DiagnosticsTreeStyle.errorProperty
);
}
context: new ErrorDescription("while notifying listeners for " + this.GetType()),
informationCollector: infoCollector
context: "while notifying listeners for " + this.GetType(),
informationCollector: information => {
information.AppendLine("The " + this.GetType() + " notifying listeners was:");
information.Append(" " + this);
}
));
}
}

listener(status);
}
} catch (Exception exception) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new DiagnosticsProperty<AnimationLocalStatusListenersMixin{{with | safe}}>(
"The " + this.GetType() + " notifying listeners was:",
this,
style: DiagnosticsTreeStyle.errorProperty
);
}
context: new ErrorDescription("while notifying status listeners for " + this.GetType()),
informationCollector: infoCollector
context: "while notifying status listeners for " + this.GetType(),
informationCollector: information => {
information.AppendLine("The " + this.GetType() + " notifying status listeners was:");
information.Append(" " + this);
}
));
}
}

381
com.unity.uiwidgets/Runtime/foundation/assertions.cs


namespace Unity.UIWidgets.foundation {
public delegate void UIWidgetsExceptionHandler(UIWidgetsErrorDetails details);
public delegate IEnumerable<DiagnosticsNode> DiagnosticPropertiesTransformer(IEnumerable<DiagnosticsNode> properties);
public delegate IEnumerable<DiagnosticsNode> InformationCollector();
internal abstract class _ErrorDiagnostic : DiagnosticsProperty<List<object>> {
internal _ErrorDiagnostic(
String message,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.flat,
DiagnosticLevel level = DiagnosticLevel.info
) : base(
name: null,
value: new List<object>() {message},
showName: false,
showSeparator: false,
defaultValue: null,
style: style,
level: level) {
D.assert(message != null);
}
internal _ErrorDiagnostic(
List<object> messageParts,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.flat,
DiagnosticLevel level = DiagnosticLevel.info
) : base(
name: null,
value: messageParts,
showName: false,
showSeparator: false,
defaultValue: null,
style: style,
level: level) {
D.assert(messageParts != null);
}
protected override string valueToString(TextTreeConfiguration parentConfiguration = null) {
return string.Join("", value);
}
}
internal class ErrorDescription : _ErrorDiagnostic {
public ErrorDescription(string message) : base(message, level: DiagnosticLevel.info) {
}
public ErrorDescription(List<object> messageParts) : base(messageParts, level: DiagnosticLevel.info) {
}
}
internal class ErrorSummary : _ErrorDiagnostic {
public ErrorSummary(string message) : base(message, level: DiagnosticLevel.summary) {
}
public ErrorSummary(List<object> messageParts) : base(messageParts, level: DiagnosticLevel.summary) {
}
}
internal class ErrorHint : _ErrorDiagnostic {
public ErrorHint(string message) : base(message, level: DiagnosticLevel.hint) {
}
public ErrorHint(List<object> messageParts) : base(messageParts, level: DiagnosticLevel.hint) {
}
}
public delegate void InformationCollector(StringBuilder information);
public class ErrorSpacer : DiagnosticsProperty<object> {
public ErrorSpacer() : base(

}
}
public class UIWidgetsErrorDetails : Diagnosticable {
public class UIWidgetsErrorDetails {
DiagnosticsNode context = null,
string context = null,
IterableFilter<string> stackFilter = null,
InformationCollector informationCollector = null,
bool silent = false

this.silent = silent;
}
public static readonly List<DiagnosticPropertiesTransformer> propertiesTransformers =
new List<DiagnosticPropertiesTransformer>();
public readonly DiagnosticsNode context;
public readonly string context;
public readonly bool silent;
public string exceptionAsString() {

return longMessage;
}
Diagnosticable _exceptionToDiagnosticable() {
return null;
}
public DiagnosticsNode summary {
get {
string formatException() {
return exceptionAsString().Split('\n')[0].TrimStart();
public override string ToString() {
var buffer = new StringBuilder();
if (library.isNotEmpty() || context.isNotEmpty()) {
if (library.isNotEmpty()) {
buffer.AppendFormat("Error caught by {0}", library);
if (context.isNotEmpty()) {
buffer.Append(", ");
}
if (foundation_.kReleaseMode) {
return DiagnosticsNode.message(formatException());
else {
buffer.Append("Exception ");
Diagnosticable diagnosticable = _exceptionToDiagnosticable();
DiagnosticsNode summary = null;
if (diagnosticable != null) {
DiagnosticPropertiesBuilder builder = new DiagnosticPropertiesBuilder();
debugFillProperties(builder);
summary = builder.properties.First((DiagnosticsNode node) => node.level == DiagnosticLevel.summary);
if (context.isNotEmpty()) {
buffer.AppendFormat("thrown {0}", context);
return summary ?? new ErrorSummary(formatException());
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
DiagnosticsNode verb = context != null
? new ErrorDescription($"thrown {new ErrorDescription($" {context}")}")
: new ErrorDescription("");
Diagnosticable diagnosticable = _exceptionToDiagnosticable();
if (exception is NullReferenceException) {
properties.add(new ErrorDescription($"The null value was {verb}."));
buffer.Append(". ");
DiagnosticsNode errorName;
errorName = new ErrorDescription($"{exception.GetType()}");
properties.add(new ErrorDescription($"The following {errorName} was {verb}:"));
if (diagnosticable != null) {
diagnosticable.debugFillProperties(properties);
}
else {
string prefix = $"{exception.GetType()}";
string message = exceptionAsString();
if (message.StartsWith(prefix)) {
message = message.Substring(prefix.Length);
}
properties.add(new ErrorSummary(message));
}
buffer.Append("An error was caught. ");
buffer.AppendLine(exceptionAsString());
properties.add(new ErrorSpacer());
foreach (var diagnosticsNode in informationCollector()) {
properties.add(diagnosticsNode);
}
informationCollector(buffer);
}
public override string toStringShort() {
return library != null ? $"Exception caught by {library}" : "Exception caught";
}
public override string toString(DiagnosticLevel minLevel = DiagnosticLevel.info) {
return toDiagnosticsNode(style: DiagnosticsTreeStyle.error).toStringDeep(minLevel: minLevel);
}
public override DiagnosticsNode toDiagnosticsNode(string name = null,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.sparse) {
return new _UIWIdgetsErrorDetailsNode(
name: name,
value: this,
style: style
);
}
}
internal class _UIWIdgetsErrorDetailsNode : DiagnosticableNode<UIWidgetsErrorDetails> {
public _UIWIdgetsErrorDetailsNode(
string name,
UIWidgetsErrorDetails value,
DiagnosticsTreeStyle style
) : base(
name: name,
value: value,
style: style
) {
D.assert(value != null);
}
new DiagnosticPropertiesBuilder builder {
get {
DiagnosticPropertiesBuilder builder = base.builder;
if (builder == null) {
return null;
if (exception.StackTrace != null) {
IEnumerable<string> stackLines = exception.StackTrace.TrimEnd().Split('\n');
if (stackFilter != null) {
stackLines = stackFilter(stackLines);
IEnumerable<DiagnosticsNode> properties = builder.properties;
foreach (DiagnosticPropertiesTransformer transformer in UIWidgetsErrorDetails.propertiesTransformers) {
properties = transformer(properties);
else {
stackLines = UIWidgetsError.defaultStackFilter(stackLines);
return new DiagnosticPropertiesBuilder(properties.ToList());
buffer.Append(string.Join("\n", stackLines.ToArray()));
return buffer.ToString().TrimEnd();
public UIWidgetsError(string message) {
string[] lines = message.Split('\n');
diagnostics = new List<DiagnosticsNode>() {
new ErrorSummary(lines[0])
};
for (var i = 1; i < lines.Length; i++) {
diagnostics.Add(new ErrorDescription(lines[i]));
}
public UIWidgetsError(string message) : base(message) {
public UIWidgetsError(List<DiagnosticsNode> diagnostics) {
this.diagnostics = diagnostics;
D.assert(diagnostics != null && diagnostics.isNotEmpty(), () => new UIWidgetsError(new List<DiagnosticsNode>() {new ErrorSummary("Empty FlutterError")}).ToString());
D.assert(diagnostics.first().level == DiagnosticLevel.summary,
() => new UIWidgetsError(new List<DiagnosticsNode>() {
new ErrorSummary("UIWidgetsError is missing a summary."),
new ErrorDescription("All UIWidgetsError objects should start with a short (one line) " +
"summary description of the problem that was detected."),
new DiagnosticsProperty<UIWidgetsError>("Malformed", this, expandableValue: true, showSeparator: false, style : DiagnosticsTreeStyle.whitespace),
new ErrorDescription(
"\nThis error should still help you solve your problem, " +
"however please also report this malformed error in the " +
"framework by filing a bug on GitHub:\n" +
" https://https://github.com/Unity-Technologies/com.unity.uiwidgets"
)
}).ToString());
D.assert(() => {
IEnumerable<DiagnosticsNode> summaries =
diagnostics.Where((DiagnosticsNode node) => node.level == DiagnosticLevel.summary);
if (summaries.Count() > 1) {
return false;
}
return true;
}, () => {
IEnumerable<DiagnosticsNode> summaries =
diagnostics.Where((DiagnosticsNode node) => node.level == DiagnosticLevel.summary);
List<DiagnosticsNode> message = new List<DiagnosticsNode>() {
new ErrorSummary("UIWidgetsError contained multiple error summaries."),
new ErrorDescription(
"All UIWidgetsError objects should have only a single short " +
"(one line) summary description of the problem that was " +
"detected."
),
new DiagnosticsProperty<UIWidgetsError>("Malformed", this, expandableValue: true, showSeparator: false, style : DiagnosticsTreeStyle.whitespace)
};
int i = 0;
foreach (DiagnosticsNode summary in summaries) {
message.Add(new DiagnosticsProperty<DiagnosticsNode>($"Summary {i}", summary, expandableValue : true));
i += 1;
}
message.Add(new ErrorDescription(
"\nThis error should still help you solve your problem, " +
"however please also report this malformed error in the " +
"framework by filing a bug on GitHub:\n" +
" https://https://github.com/Unity-Technologies/com.unity.uiwidgets"
));
return new UIWidgetsError(message).ToString();
});
}
public readonly List<DiagnosticsNode> diagnostics;
public override string Message => ToString();
static int _errorCount = 0;
public static void resetErrorCount() {
_errorCount = 0;
}
const int wrapWidth = 100;
public static void dumpErrorToConsole(UIWidgetsErrorDetails details) {
dumpErrorToConsole(details, forceReport: false);
}

return;
}
if (_errorCount == 0 || forceReport) {
D.logError(new TextTreeRenderer(
wrapWidth: wrapWidth,
wrapWidthProperties: wrapWidth,
maxDescendentsTruncatableNode: 5).render(
details.toDiagnosticsNode(style: DiagnosticsTreeStyle.error)).TrimEnd(), details.exception);
}
D.logError($"Another exception was thrown: ${details.summary}");
_errorCount += 1;
D.logError(details.ToString(), details.exception);
}
public static IEnumerable<string> defaultStackFilter(IEnumerable<string> frames) {

public void debugFillProperties(DiagnosticPropertiesBuilder properties) {
foreach (var diagnosticsNode in diagnostics)
{
properties.add(diagnosticsNode);
public static void reportError(UIWidgetsErrorDetails details) {
D.assert(details != null);
D.assert(details.exception != null);
if (onError != null) {
onError(details);
}
public string toStringShort() => "UIWidgetsError";
internal abstract class _ErrorDiagnostic : DiagnosticsProperty<List<object>> {
/// This constructor provides a reliable hook for a kernel transformer to find
/// error messages that need to be rewritten to include object references for
/// interactive display of errors.
internal _ErrorDiagnostic(
String message,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.sparse, // DiagnosticsTreeStyle.flat
DiagnosticLevel level = DiagnosticLevel.info
) : base(
name: null,
value: new List<object>() {message},
showName: false,
showSeparator: false,
defaultValue: null,
style: style,
level: level) {
D.assert(message != null);
}
/// In debug builds, a kernel transformer rewrites calls to the default
/// constructors for [ErrorSummary], [ErrorDetails], and [ErrorHint] to use
/// this constructor.
//
// ```dart
// _ErrorDiagnostic('Element $element must be $color')
// ```
// Desugars to:
// ```dart
// _ErrorDiagnostic.fromParts(<Object>['Element ', element, ' must be ', color])
// ```
//
// Slightly more complex case:
// ```dart
// _ErrorDiagnostic('Element ${element.runtimeType} must be $color')
// ```
// Desugars to:
//```dart
// _ErrorDiagnostic.fromParts(<Object>[
// 'Element ',
// DiagnosticsProperty(null, element, description: element.runtimeType?.toString()),
// ' must be ',
// color,
// ])
// ```
internal _ErrorDiagnostic(
List<object> messageParts,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.sparse,
DiagnosticLevel level = DiagnosticLevel.info
) : base(
name: null,
value: messageParts,
showName: false,
showSeparator: false,
defaultValue: null,
style: style,
level: level) {
D.assert(messageParts != null);
}
public override string ToString() {
TextTreeRenderer renderer = new TextTreeRenderer(wrapWidth: 400000000);
return string.Join("\n", diagnostics.Select((DiagnosticsNode node) => renderer.render(node).TrimEnd()));
protected override string valueToString(TextTreeConfiguration parentConfiguration = null) {
return String.Join("", value);
}
}
internal class ErrorDescription : _ErrorDiagnostic {
/// A lint enforces that this constructor can only be called with a string
/// literal to match the limitations of the Dart Kernel transformer that
/// optionally extracts out objects referenced using string interpolation in
/// the message passed in.
///
/// The message will display with the same text regardless of whether the
/// kernel transformer is used. The kernel transformer is required so that
/// debugging tools can provide interactive displays of objects described by
/// the error.
public ErrorDescription(string message) : base(message, level: DiagnosticLevel.info) {
public static void reportError(UIWidgetsErrorDetails details) {
D.assert(details != null);
D.assert(details.exception != null);
if (onError != null) {
onError(details);
}
/// Calls to the default constructor may be rewritten to use this constructor
/// in debug mode using a kernel transformer.
// ignore: unused_element
public ErrorDescription(List<object> messageParts) : base(messageParts, level: DiagnosticLevel.info) {
}
}
}

9
com.unity.uiwidgets/Runtime/foundation/binding.cs


protected BindingBase() {
Timeline.startSync("Framework initialization");
D.assert(!_debugInitialized);
D.assert(_debugInitialized);
initServiceExtensions();

}
static bool _debugInitialized = false;
D.assert(!_debugInitialized);
D.assert(() => {
_debugInitialized = true;
return true;
});
}
protected virtual void initServiceExtensions() {

15
com.unity.uiwidgets/Runtime/foundation/change_notifier.cs


}
}
catch (Exception ex) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new DiagnosticsProperty<ChangeNotifier>(
$"The {GetType()} sending notification was",
this,
style: DiagnosticsTreeStyle.errorProperty
);
}
context: new ErrorDescription($"while dispatching notifications for {GetType()}"),
informationCollector: infoCollector
context: "while dispatching notifications for " + GetType(),
informationCollector: information => {
information.AppendLine("The " + GetType() + " sending notification was:");
information.Append(" " + this);
}
));
}
}

896
com.unity.uiwidgets/Runtime/foundation/diagnostics.cs
文件差异内容过多而无法显示
查看文件

4
com.unity.uiwidgets/Runtime/foundation/object.cs


namespace Unity.UIWidgets.foundation {
public static partial class foundation_ {
public static string objectRuntimeType(object obj, string optimizedValue) {
public static string objectRuntimeType(object @object, string optimizedValue) {
optimizedValue = obj.GetType().ToString();
optimizedValue = @object.GetType().ToString();
return true;
});
return optimizedValue;

16
com.unity.uiwidgets/Runtime/foundation/observer_list.cs


_list.Add(item);
}
public bool Remove(T item) {
public void Clear() {
_set?.Clear();
return _list.Remove(item);
_list.Clear();
}
public bool Contains(T item) {

_set.Clear();
_set.UnionWith(_list);
}
_isDirty = false;
}

public void Clear() {
_isDirty = true;
_list.Clear();
}
}
public bool Remove(T item) {
_isDirty = true;
return _list.Remove(item);
}
public int Count {

6
com.unity.uiwidgets/Runtime/foundation/print.cs


using System.Text.RegularExpressions;
namespace Unity.UIWidgets.foundation {
enum _WordWrapParseMode {
inSpace,
inWord,
atBreak
}
public static class DebugPrint {
static readonly Regex _indentPattern = new Regex("^ *(?:[-+*] |[0-9]+[.):] )?");

11
com.unity.uiwidgets/Runtime/gestures/binding.cs


pointerRouter.route(evt);
}
catch (Exception ex) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new DiagnosticsProperty<PointerEvent>("Event", evt, style: DiagnosticsTreeStyle.errorProperty);
}
context: new ErrorDescription("while dispatching a non-hit-tested pointer event"),
informationCollector: infoCollector
context: "while dispatching a non-hit-tested pointer event",
informationCollector: information => {
information.AppendLine("Event: ");
information.AppendFormat(" {0}", evt);
}
)
);
}

11
com.unity.uiwidgets/Runtime/gestures/pointer_signal_resolver.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.gestures {

_firstRegisteredCallback(_currentEvent);
}
catch (Exception exception) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new DiagnosticsProperty<PointerSignalEvent>("Event", evt, style: DiagnosticsTreeStyle.errorProperty);
}
context: new ErrorDescription("while resolving a PointerSignalEvent"),
informationCollector: infoCollector
context: "while resolving a PointerSignalEvent",
informationCollector: information => {
information.AppendLine("Event: ");
information.AppendFormat(" {0}", evt);
}
)
);
}

26
com.unity.uiwidgets/Runtime/gestures/recognizer.cs


result = callback();
}
catch (Exception ex) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new StringProperty("Handler", name);
yield return new DiagnosticsProperty<GestureRecognizer>("Recognizer", this, style: DiagnosticsTreeStyle.errorProperty);
}
context: new ErrorDescription("while handling a gesture"),
informationCollector: infoCollector
context: "while handling a gesture",
informationCollector: information => {
information.AppendLine("Handler: " + name);
information.AppendLine("Recognizer:");
information.AppendLine(" " + this);
}
));
}

}
catch (Exception ex) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new StringProperty("Handler", name);
yield return new DiagnosticsProperty<GestureRecognizer>("Recognizer", this, style: DiagnosticsTreeStyle.errorProperty);
}
context: new ErrorDescription("while handling a gesture"),
informationCollector: infoCollector
context: "while handling a gesture",
informationCollector: information => {
information.AppendLine("Handler: " + name);
information.AppendLine("Recognizer:");
information.AppendLine(" " + this);
}
));
}

41
com.unity.uiwidgets/Runtime/painting/image_provider.cs


stream.setCompleter(imageCompleter);
InformationCollector collector = null;
D.assert(() => {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new DiagnosticsProperty<ImageProvider>("Image provider", this);
yield return new DiagnosticsProperty<ImageConfiguration>("Image configuration",
configuration);
yield return new DiagnosticsProperty<T>("Image key", key, defaultValue: null);
}
collector = infoCollector;
collector = (sb) => {
sb.Append(new DiagnosticsProperty<ImageProvider>("Image provider", this));
sb.Append(new DiagnosticsProperty<ImageConfiguration>("Image configuration",
configuration));
sb.Append(new DiagnosticsProperty<T>("Image key", key, defaultValue: null));
};
return true;
});
imageCompleter.setError(

}
protected override ImageStreamCompleter load(AssetBundleImageKey key, DecoderCallback decode) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new DiagnosticsProperty<ImageProvider>("Image provider", this);
yield return new DiagnosticsProperty<AssetBundleImageKey>("Image key", key);
}
informationCollector: infoCollector
informationCollector: information => {
information.AppendLine($"Image provider: {this}");
information.Append($"Image key: {key}");
}
);
}

}
protected override ImageStreamCompleter load(NetworkImage key, DecoderCallback decode) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new ErrorDescription($"url: {url}");
}
informationCollector: infoCollector
informationCollector: information => {
information.AppendLine($"Image provider: {this}");
information.Append($"Image key: {key}");
}
);
}

}
protected override ImageStreamCompleter load(FileImage key, DecoderCallback decode) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new ErrorDescription($"Path: {file}");
}
informationCollector: infoCollector);
informationCollector: information => { information.AppendLine($"Path: {file}"); });
}
Future<Codec> _loadAsync(FileImage key, DecoderCallback decode) {

bool silent = false
) {
reportError(
context: context,
context: context.toDescription(),
exception: exception,
informationCollector: informationCollector,
silent: silent

14
com.unity.uiwidgets/Runtime/painting/image_stream.cs


}
catch (Exception ex) {
reportError(
context: new ErrorDescription("by a synchronously-called image listener"),
context: "by a synchronously-called image listener",
exception: ex
);
}

new UIWidgetsErrorDetails(
exception: ex,
library: "image resource service",
context: new ErrorDescription("when reporting an error to an image listener")
context: "when reporting an error to an image listener"
)
);
}

}
catch (Exception ex) {
reportError(
context: new ErrorDescription("by an image listener"),
context: "by an image listener",
exception: ex
);
}

protected void reportError(
DiagnosticsNode context = null,
string context = null,
Exception exception = null,
InformationCollector informationCollector = null,
bool silent = false) {

catch (Exception ex) {
UIWidgetsError.reportError(
new UIWidgetsErrorDetails(
context: new ErrorDescription("when reporting an error to an image listener"),
context: "when reporting an error to an image listener",
library: "image resource service",
exception: ex
)

image.then_(result => { setImage(result); }).catchError(err => {
reportError(
context: new ErrorDescription("resolving a single-frame image stream"),
context: "resolving a single-frame image stream",
exception: err,
informationCollector: informationCollector,
silent: true

codec.then_((Action<Codec>) _handleCodecReady, ex => {
reportError(
context: new ErrorDescription("resolving an image codec"),
context: "resolving an image codec",
exception: ex,
informationCollector: informationCollector,
silent: true

33
com.unity.uiwidgets/Runtime/rendering/box.cs


InformationCollector informationCollector = null
) {
D.assert(() => {
var throwError = new Action<DiagnosticsNode>(message => {
var diagnositicsInfo = new List<DiagnosticsNode>();
diagnositicsInfo.Add(message);
var throwError = new Action<string>(message => {
var information = new StringBuilder();
diagnositicsInfo.AddRange(informationCollector.Invoke());
informationCollector(information);
diagnositicsInfo.Add(new DiagnosticsProperty<BoxConstraints>("The offending constraints were", this, style: DiagnosticsTreeStyle.errorProperty));
throw new UIWidgetsError(
diagnositicsInfo
);
throw new UIWidgetsError($"{message}\n{information}The offending constraints were:\n {this}");
});
if (minWidth.isNaN() ||

whichFields = affectedFieldsList.Single();
}
throwError(new ErrorSummary("BoxConstraints has NaN values in " + whichFields + "."));
throwError("BoxConstraints has NaN values in " + whichFields + ".");
throwError(new ErrorSummary("BoxConstraints has both a negative minimum width and a negative minimum height."));
throwError("BoxConstraints has both a negative minimum width and a negative minimum height.");
throwError(new ErrorSummary("BoxConstraints has a negative minimum width."));
throwError("BoxConstraints has a negative minimum width.");
throwError(new ErrorSummary("BoxConstraints has a negative minimum height."));
throwError("BoxConstraints has a negative minimum height.");
throwError(new ErrorSummary("BoxConstraints has both width and height constraints non-normalized."));
throwError("BoxConstraints has both width and height constraints non-normalized.");
throwError(new ErrorSummary("BoxConstraints has non-normalized width constraints."));
throwError("BoxConstraints has non-normalized width constraints.");
throwError(new ErrorSummary("BoxConstraints has non-normalized height constraints."));
throwError("BoxConstraints has non-normalized height constraints.");
throwError(new ErrorSummary("BoxConstraints forces an infinite width and infinite height."));
throwError("BoxConstraints forces an infinite width and infinite height.");
throwError(new ErrorSummary("BoxConstraints forces an infinite width."));
throwError("BoxConstraints forces an infinite width.");
throwError(new ErrorSummary("BoxConstraints forces an infinite height."));
throwError("BoxConstraints forces an infinite height.");
}
}

46
com.unity.uiwidgets/Runtime/rendering/debug_overflow_indicator.cs


using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEditor.PackageManager;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using Gradient = Unity.UIWidgets.ui.Gradient;

return regions;
}
static void _reportOverflow(RenderObject renderObject, RelativeRect overflow, List<DiagnosticsNode> overflowHints) {
overflowHints = overflowHints ?? new List<DiagnosticsNode>();
if (overflowHints.isEmpty()) {
overflowHints.Add(new ErrorDescription($"The edge of the {renderObject.GetType()} that is " +
"overflowing has been marked in the rendering with a yellow and black " +
"striped pattern. This is usually caused by the contents being too big " +
$"for the {renderObject.GetType()}."));
overflowHints.Add(new ErrorHint("This is considered an error condition because it indicates that there " +
"is content that cannot be seen. If the content is legitimately bigger " +
"than the available space, consider clipping it with a ClipRect widget " +
$"before putting it in the {renderObject.GetType()}, or using a scrollable " +
"container, like a ListView."));
}
static void _reportOverflow(RenderObject renderObject, RelativeRect overflow, string overflowHints) {
overflowHints = overflowHints ?? $"The edge of the {renderObject.GetType()} that is " +
"overflowing has been marked in the rendering with a yellow and black " +
"striped pattern. This is usually caused by the contents being too big " +
$"for the {renderObject.GetType()}.\n" +
"This is considered an error condition because it indicates that there " +
"is content that cannot be seen. If the content is legitimately bigger " +
"than the available space, consider clipping it with a ClipRect widget " +
$"before putting it in the {renderObject.GetType()}, or using a scrollable " +
"container, like a ListView.";
List<string> overflows = new List<string> { };
if (overflow.left > 0.0f) {

break;
}
IEnumerable<DiagnosticsNode> infoCollector() {
foreach (var hint in overflowHints) {
yield return hint;
}
yield return DiagnosticsNode.message($"The specific {renderObject.GetType()} in question is: {renderObject.toStringShallow(joiner: "\n ")}");
yield return DiagnosticsNode.message(string.Concat(Enumerable.Repeat("◢◤", 32)));
}
context: new ErrorDescription("during layout"),
informationCollector: infoCollector
context: "during layout",
informationCollector: (information) => {
information.AppendLine(overflowHints);
information.AppendLine($"The specific {renderObject.GetType()} in question is:");
information.AppendLine($" {renderObject.toStringShallow(joiner: "\n ")}");
information.AppendLine(string.Concat(Enumerable.Repeat("◢◤", 32)));
}
)
);
}

Offset offset,
Rect containerRect,
Rect childRect,
List<DiagnosticsNode> overflowHints = null
string overflowHints = null
) {
RelativeRect overflow = RelativeRect.fromRect(containerRect, childRect);

23
com.unity.uiwidgets/Runtime/rendering/flex.cs


context.pushClipRect(needsCompositing, offset, Offset.zero & size, defaultPaint);
D.assert(() => {
List<DiagnosticsNode> debugOverflowHints = new List<DiagnosticsNode>{
new ErrorDescription(
$"The overflowing {GetType()} has an orientation of {_direction}."
),
new ErrorDescription(
string debugOverflowHints =
$"The overflowing {GetType()} has an orientation of {_direction}.\n" +
"in the rendering with a yellow and black striped pattern. This is " +
"usually caused by the contents being too big for the $runtimeType."
),
new ErrorHint(
"in the rendering with a yellow and black striped pattern. This is " +
$"usually caused by the contents being too big for the {GetType()}. " +
"space instead of being sized to their natural size."
),
new ErrorHint(
"space instead of being sized to their natural size.\n" +
"than a Flex, like a ListView."
)
};
"than a Flex, like a ListView.";
Rect overflowChildRect;
switch (_direction) {
case Axis.horizontal:

20
com.unity.uiwidgets/Runtime/rendering/layer.cs


}
List<PictureLayer> _processConflictingPhysicalLayers(PhysicalModelLayer predecessor, PhysicalModelLayer child) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return child.toDiagnosticsNode(name: "Attempted to composite layer",
style: DiagnosticsTreeStyle.errorProperty);
yield return predecessor.toDiagnosticsNode(name: "after layer",
style: DiagnosticsTreeStyle.errorProperty);
yield return new ErrorDescription("which occupies the same area at a higher elevation.");
}
library: "rendering library",
context: new ErrorDescription("during compositing"),
informationCollector: infoCollector
context: "during compositing",
informationCollector: (StringBuilder builder) => {
builder.AppendLine("Attempted to composite layer");
builder.AppendLine(child.ToString());
builder.AppendLine("after layer");
builder.AppendLine(predecessor.ToString());
builder.AppendLine("which occupies the same area at a higher elevation.");
}
return new List<PictureLayer> {
_highlightConflictingLayer(predecessor),
_highlightConflictingLayer(child)

108
com.unity.uiwidgets/Runtime/rendering/object.cs


public object debugCreator;
void _debugReportException(string method, Exception exception) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new DiagnosticsDebugCreator(debugCreator);
yield return describeForError("The following RenderObject was being processed when the exception was fired");
yield return describeForError("RenderObject", style: DiagnosticsTreeStyle.truncateChildren);
}
context: new ErrorDescription("during " + method),
context: "during " + method,
informationCollector: infoCollector
informationCollector: information => {
information.AppendLine(
"The following RenderObject was being processed when the exception was fired:");
information.AppendLine(" " + toStringShallow(joiner: "\n "));
var descendants = new List<string>();
const int maxDepth = 5;
int depth = 0;
const int maxLines = 25;
int lines = 0;
RenderObjectVisitor visitor = null;
visitor = new RenderObjectVisitor((RenderObject child) => {
if (lines < maxLines) {
depth += 1;
descendants.Add(new string(' ', 2 * depth) + child);
if (depth < maxDepth) {
child.visitChildren(visitor);
}
depth -= 1;
}
else if (lines == maxLines) {
descendants.Add(" ...(descendants list truncated after " + lines + " lines)");
}
lines += 1;
});
visitChildren(visitor);
if (lines > 1) {
information.AppendLine(
"This RenderObject had the following descendants (showing up to depth " +
maxDepth + "):");
}
else if (descendants.Count == 1) {
information.AppendLine("This RenderObject had the following child:");
}
else {
information.AppendLine("This RenderObject has no descendants.");
}
information.Append(string.Join("\n", descendants.ToArray()));
}
));
}

public void layout(Constraints constraints, bool parentUsesSize = false) {
D.assert(constraints != null);
D.assert(
() => {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return new ErrorDescription(
$"These invalid constraints were provided to {GetType()}'s layout() " +
"function by the following function, which probably computed the " +
"invalid constraints in question:\n" +
" unknown");
}
return constraints.debugAssertIsValid(
isAppliedConstraint: true,
informationCollector: infoCollector);
}
);
D.assert(constraints.debugAssertIsValid(
isAppliedConstraint: true,
informationCollector: information => {
// final List<String> stack = StackTrace.current.toString().split('\n');
// int targetFrame;
// final Pattern layoutFramePattern = RegExp(r'^#[0-9]+ +RenderObject.layout \(');
// for (int i = 0; i < stack.length; i += 1) {
// if (layoutFramePattern.matchAsPrefix(stack[i]) != null) {
// targetFrame = i + 1;
// break;
// }
// }
// if (targetFrame != null && targetFrame < stack.length) {
// information.writeln(
// 'These invalid constraints were provided to $runtimeType\'s layout() '
// 'function by the following function, which probably computed the '
// 'invalid constraints in question:'
// );
// final Pattern targetFramePattern = RegExp(r'^#[0-9]+ +(.+)$');
// final Match targetFrameMatch = targetFramePattern.matchAsPrefix(stack[targetFrame]);
// if (targetFrameMatch != null && targetFrameMatch.groupCount > 0) {
// information.writeln(' ${targetFrameMatch.group(1)}');
// } else {
// information.writeln(stack[targetFrame]);
// }
// }
}));
D.assert(!_debugDoingThisResize);
D.assert(!_debugDoingThisLayout);

);
}
}
protected DiagnosticsNode describeForError(String name, DiagnosticsTreeStyle style = DiagnosticsTreeStyle.shallow) {
return toDiagnosticsNode(name: name, style: style);
}
}
public interface RenderObjectWithChildMixin {

public UIWidgetsErrorDetailsForRendering(
Exception exception = null,
string library = null,
DiagnosticsNode context = null,
string context = null,
RenderObject renderObject = null,
InformationCollector informationCollector = null,
bool silent = false

}
public readonly RenderObject renderObject;
}
public class DiagnosticsDebugCreator : DiagnosticsProperty<object> {
public DiagnosticsDebugCreator(object value) :
base(
"debugCreator",
value,
level: DiagnosticLevel.hidden
) {
D.assert(value != null);
}
}
}

100
com.unity.uiwidgets/Runtime/rendering/sliver.cs


using System;
using System.Collections.Generic;
using System.Text;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;

InformationCollector informationCollector = null
) {
D.assert(() => {
bool hasErrors = false;
StringBuilder errorMessage = new StringBuilder("\n");
hasErrors = true;
errorMessage.AppendLine($" {message}");
var information = new StringBuilder();
if (informationCollector != null) {
informationCollector(information);
}
throw new UIWidgetsError(
$"{GetType()} is not valid: {message}\n{information}The offending constraints were: \n {this}");
});
verify(scrollOffset >= 0.0f, "The \"scrollOffset\" is negative.");

verify(remainingCacheExtent >= 0.0f, "The \"remainingCacheExtent\" is negative.");
verify(cacheOrigin <= 0.0f, "The \"cacheOrigin\" is positive.");
verify(isNormalized, "The constraints are not normalized.");
if (hasErrors) {
List<DiagnosticsNode> diagnosticInfo = new List<DiagnosticsNode>();
diagnosticInfo.Add(new ErrorSummary($"{GetType()} is not valid: {errorMessage}"));
if (informationCollector != null) {
diagnosticInfo.AddRange(informationCollector.Invoke());
}
diagnosticInfo.Add(new DiagnosticsProperty<SliverConstraints>("The offending constraints were", this, style: DiagnosticsTreeStyle.errorProperty));
throw new UIWidgetsError(
diagnosticInfo);
}
return true;
});

public readonly float cacheExtent;
public const float precisionErrorTolerance = 1e-10f;
internal static List<DiagnosticsNode> _debugCompareFloats(string labelA, float valueA, string labelB, float valueB) {
List<DiagnosticsNode> diagnosticInfo = new List<DiagnosticsNode>();
internal static string _debugCompareFloats(string labelA, float valueA, string labelB, float valueB) {
diagnosticInfo.Add(new ErrorDescription($"The {labelA} is {valueA:F1}, but the {labelB} is {valueB:F1}. "));
}
else {
diagnosticInfo.Add(new ErrorDescription($"The {labelA} is {valueA}, but the {labelB} is {valueB}."));
diagnosticInfo.Add(new ErrorHint("Maybe you have fallen prey to floating point rounding errors, and should explicitly " +
$"apply the min() or max() functions, or the clamp() method, to the {labelB}? "));
return $"The {labelA} is {valueA:F1}, but the {labelB} is {valueB:F1}. ";
return diagnosticInfo;
return string.Format(
"The {0} is {1}, but the {2} is {3}. " +
"Maybe you have fallen prey to floating point rounding errors, and should explicitly " +
"apply the min() or max() functions, or the clamp() method, to the {2}? ",
labelA, valueA, labelB, valueB);
void verify(bool check, string summary, List<DiagnosticsNode> details = null) {
var verify = new Action<bool, string>((bool check, string message) => {
List<DiagnosticsNode> diagnosticInfo = new List<DiagnosticsNode>();
diagnosticInfo.Add(new ErrorSummary($"{GetType()} is not valid: {summary}"));
if (details != null) {
diagnosticInfo.AddRange(details);
}
var information = new StringBuilder();
diagnosticInfo.AddRange(informationCollector.Invoke());
informationCollector(information);
throw new UIWidgetsError(diagnosticInfo);
};
throw new UIWidgetsError($"{GetType()} is not valid: {message}\n{information}");
});
verify(scrollExtent >= 0.0f, "The \"scrollExtent\" is negative.");
verify(paintExtent >= 0.0f, "The \"paintExtent\" is negative.");

verify(false,
"The \"layoutExtent\" exceeds the \"paintExtent\".",
details: _debugCompareFloats("paintExtent", paintExtent, "layoutExtent",
"The \"layoutExtent\" exceeds the \"paintExtent\".\n" +
_debugCompareFloats("paintExtent", paintExtent, "layoutExtent",
var details = _debugCompareFloats("maxPaintExtent", maxPaintExtent, "paintExtent",
paintExtent);
details.Add(new ErrorDescription("By definition, a sliver can\"t paint more than the maximum that it can paint!"));
"The \"maxPaintExtent\" is less than the \"paintExtent\".",
details: details
"The \"maxPaintExtent\" is less than the \"paintExtent\".\n" +
_debugCompareFloats("maxPaintExtent", maxPaintExtent, "paintExtent",
paintExtent) +
"By definition, a sliver can\"t paint more than the maximum that it can paint!"
);
}

}
protected override void debugAssertDoesMeetConstraints() {
D.assert(
() => {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return describeForError("The RenderSliver that returned the offending geometry was");
}
return geometry.debugAssertIsValid(
informationCollector: infoCollector);
});
D.assert(geometry.debugAssertIsValid(
informationCollector: (information) => {
information.AppendLine("The RenderSliver that returned the offending geometry was:");
information.AppendLine(" " + toStringShallow(joiner: "\n "));
}));
List<DiagnosticsNode> diagnosticInfo = new List<DiagnosticsNode>();
diagnosticInfo.Add(new ErrorSummary("SliverGeometry has a paintOffset that exceeds the remainingPaintExtent from the constraints."));
diagnosticInfo.Add(describeForError("The render object whose geometry violates the constraints is the following:"));
diagnosticInfo.AddRange(SliverGeometry._debugCompareFloats("remainingPaintExtent", constraints.remainingPaintExtent,
"paintExtent", geometry.paintExtent));
diagnosticInfo.Add(new ErrorDescription("The paintExtent must cause the child sliver to paint within the viewport, and so " +
"cannot exceed the remainingPaintExtent."));
diagnosticInfo
"SliverGeometry has a paintOffset that exceeds the remainingPaintExtent from the constraints.\n" +
"The render object whose geometry violates the constraints is the following:\n" +
" " + toStringShallow(joiner: "\n ") + "\n" +
SliverGeometry._debugCompareFloats(
"remainingPaintExtent", constraints.remainingPaintExtent,
"paintExtent", geometry.paintExtent) +
"The paintExtent must cause the child sliver to paint within the viewport, and so " +
"cannot exceed the remainingPaintExtent."
);
}

75
com.unity.uiwidgets/Runtime/scheduler2/binding.cs


using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEditor.PackageManager;
using UnityEngine;
using FrameTiming = Unity.UIWidgets.ui.FrameTiming;
using Timer = Unity.UIWidgets.async2.Timer;

D.assert(() => {
if (debugCurrentCallbackStack == null) {
throw new UIWidgetsError(
new List<DiagnosticsNode>() {
new ErrorSummary(
"scheduleFrameCallback called with rescheduling true, but no callback is in scope."),
new ErrorDescription(
"The \"rescheduling\" argument should only be set to true if the " +
"callback is being reregistered from within the callback itself, " +
"and only then if the callback itself is entirely synchronous."),
new ErrorHint("If this is the initial registration of the callback, or if the " +
"callback is asynchronous, then do not use the \"rescheduling\" " +
"argument.")
});
"scheduleFrameCallback called with rescheduling true, but no callback is in scope.\n" +
"The \"rescheduling\" argument should only be set to true if the " +
"callback is being reregistered from within the callback itself, " +
"and only then if the callback itself is entirely synchronous. \n" +
"If this is the initial registration of the callback, or if the " +
"callback is asynchronous, then do not use the \"rescheduling\" " +
"argument.");
}
return true;

catch (Exception ex) {
InformationCollector collector = null;
D.assert(() => {
IEnumerable<DiagnosticsNode> infoCollect() {
yield return new DiagnosticsProperty<TimingsCallback>(
"The TimingsCallback that gets executed was",
callback,
style: DiagnosticsTreeStyle.errorProperty);
}
collector = infoCollect;
collector = (StringBuilder sb) => {
sb.AppendLine("The TimingsCallback that gets executed was " + callback);
};
context: new ErrorDescription("while executing callbacks for FrameTiming"),
context: "while executing callbacks for FrameTiming",
informationCollector: collector
));
}

callbackStack = entry.debugStack;
return true;
});
IEnumerable<DiagnosticsNode> infoCollector() {
yield return DiagnosticsNode.message("\nThis exception was thrown in the context of a scheduler callback. " +
"When the scheduler callback was _registered_ (as opposed to when the " +
"exception was thrown), this was the stack: " + callbackStack);
}
context: new ErrorDescription("during a task callback"),
context: "during a task callback",
: infoCollector
: sb => {
sb.AppendLine("\nThis exception was thrown in the context of a scheduler callback. " +
"When the scheduler callback was _registered_ (as opposed to when the " +
"exception was thrown), this was the stack: " + callbackStack);
}
));
}

}
public void scheduleFrame() {
if (_hasScheduledFrame || !framesEnabled)
if (_hasScheduledFrame || !_framesEnabled)
return;
D.assert(() => {

callback(timeStamp);
}
catch (Exception ex) {
IEnumerable<DiagnosticsNode> infoCollector() {
yield return DiagnosticsNode.message("\nThis exception was thrown in the context of a scheduler callback. " +
"When the scheduler callback was _registered_ (as opposed to when the " +
"exception was thrown), this was the stack:");
StringBuilder builder = new StringBuilder();
foreach (var line in UIWidgetsError.defaultStackFilter(
callbackStack.TrimEnd().Split('\n'))) {
builder.AppendLine(line);
}
yield return DiagnosticsNode.message(builder.ToString());
}
context: new ErrorDescription("during a scheduler callback"),
context: "during a scheduler callback",
: infoCollector
: information => {
information.AppendLine(
"\nThis exception was thrown in the context of a scheduler callback. " +
"When the scheduler callback was _registered_ (as opposed to when the " +
"exception was thrown), this was the stack:"
);
foreach (var line in UIWidgetsError.defaultStackFilter(
callbackStack.TrimEnd().Split('\n'))) {
information.AppendLine(line);
}
}
));
}

14
com.unity.uiwidgets/Runtime/scheduler2/ticker.cs


using System;
using System.Collections.Generic;
using System.Text;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;

D.assert(() => {
if (isActive) {
throw new UIWidgetsError(
new List<DiagnosticsNode>() {
new ErrorSummary("A ticker was started twice."),
new ErrorDescription(
"A ticker that is already active cannot be started again without first stopping it."),
describeForError("The affected ticker was: ")
});
"A ticker was started twice.\nA ticker that is already active cannot be started again without first stopping it.\n" +
"The affected ticker was: " + toString(debugIncludeStack: true));
return true;
});

}
return _future;
}
DiagnosticsNode describeForError(string name) {
return new DiagnosticsProperty<Ticker>(name, this, description: toString(debugIncludeStack: true));
}
public void stop(bool canceled = false) {

4
com.unity.uiwidgets/Runtime/services/binding.cs


UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: exception,
library: "services library",
context: new ErrorDescription("during a platform message response callback")
context: "during a platform message response callback"
));
}
});

UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: exception,
library: "services library",
context: new ErrorDescription("during a platform message callback"))
context: "during a platform message callback")
);
callback(null);
return FutureOr.nil;

2
com.unity.uiwidgets/Runtime/widgets/binding.cs


var details = new UIWidgetsErrorDetails(
exception: ex,
library: "widgets library",
context: new ErrorDescription("attaching to the render tree")
context: "attaching to the render tree"
);
UIWidgetsError.reportError(details);

2
com.unity.uiwidgets/Runtime/widgets/debug.cs


var details = new UIWidgetsErrorDetails(
exception: exception,
library: "widgets library",
context: new ErrorDescription(context),
context: context,
informationCollector: informationCollector
);
UIWidgetsError.reportError(details);

16
com.unity.uiwidgets/Runtime/widgets/framework.cs


_dirtyElements[index].rebuild();
}
catch (Exception ex) {
IEnumerable<DiagnosticsNode> infoCollector() {
//yield return new DiagnosticsDebugCreator(new DebugCreator(_dirtyElements[index]));
yield return _dirtyElements[index].describeElement($"The element being rebuilt at the time was index {index} of {dirtyCount}");
}
informationCollector: infoCollector
informationCollector: (information) => {
information.AppendLine(
"The element being rebuilt at the time was index "
+ index + " of " + dirtyCount + ":");
information.Append(" " + _dirtyElements[index]);
}
);
}

public delegate Widget ErrorWidgetBuilder(UIWidgetsErrorDetails details);
internal class _ElementDiagnosticableTreeNode : DiagnosticableTreeNode {
internal class _ElementDiagnosticableTreeNode : _DiagnosticableTreeNode {
internal _ElementDiagnosticableTreeNode(
Element value,
DiagnosticsTreeStyle style,

}
catch (UIWidgetsError e) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
context: new ErrorDescription("while apply parent data"),
context: "while apply parent data",
exception: e
));
}

2
com.unity.uiwidgets/Runtime/widgets/image.cs


}
else {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
context: new ErrorDescription("image failed to precache"),
context: "image failed to precache",
library: "image resource service",
exception: exception,
silent: true

正在加载...
取消
保存