Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
7da44d2d
Commit
7da44d2d
authored
Mar 30, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2994 from abarth/faster_checked_mode
The intrinsic size checks were very slow
parents
243a49f7
9157c164
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
37 deletions
+46
-37
box.dart
packages/flutter/lib/src/rendering/box.dart
+43
-37
debug.dart
packages/flutter/lib/src/rendering/debug.dart
+3
-0
No files found.
packages/flutter/lib/src/rendering/box.dart
View file @
7da44d2d
...
...
@@ -653,6 +653,9 @@ abstract class RenderBox extends RenderObject {
@override
BoxConstraints
get
constraints
=>
super
.
constraints
;
// We check the intrinsic sizes of each render box once by default.
bool
_debugNeedsIntrinsicSizeCheck
=
true
;
@override
void
debugAssertDoesMeetConstraints
()
{
assert
(
constraints
!=
null
);
...
...
@@ -716,43 +719,46 @@ abstract class RenderBox extends RenderObject {
'your fault. Contact support: https://github.com/flutter/flutter/issues/new'
);
}
// verify that the intrinsics are also within the constraints
assert
(!
RenderObject
.
debugCheckingIntrinsics
);
RenderObject
.
debugCheckingIntrinsics
=
true
;
double
intrinsic
;
StringBuffer
failures
=
new
StringBuffer
();
int
failureCount
=
0
;
intrinsic
=
getMinIntrinsicWidth
(
constraints
);
if
(
intrinsic
!=
constraints
.
constrainWidth
(
intrinsic
))
{
failures
.
writeln
(
' * getMinIntrinsicWidth() -- returned: w=
$intrinsic
'
);
failureCount
+=
1
;
}
intrinsic
=
getMaxIntrinsicWidth
(
constraints
);
if
(
intrinsic
!=
constraints
.
constrainWidth
(
intrinsic
))
{
failures
.
writeln
(
' * getMaxIntrinsicWidth() -- returned: w=
$intrinsic
'
);
failureCount
+=
1
;
}
intrinsic
=
getMinIntrinsicHeight
(
constraints
);
if
(
intrinsic
!=
constraints
.
constrainHeight
(
intrinsic
))
{
failures
.
writeln
(
' * getMinIntrinsicHeight() -- returned: h=
$intrinsic
'
);
failureCount
+=
1
;
}
intrinsic
=
getMaxIntrinsicHeight
(
constraints
);
if
(
intrinsic
!=
constraints
.
constrainHeight
(
intrinsic
))
{
failures
.
writeln
(
' * getMaxIntrinsicHeight() -- returned: h=
$intrinsic
'
);
failureCount
+=
1
;
}
RenderObject
.
debugCheckingIntrinsics
=
false
;
if
(
failures
.
isNotEmpty
)
{
assert
(
failureCount
>
0
);
throw
new
FlutterError
(
'The intrinsic dimension methods of the
$runtimeType
class returned values that violate the given constraints.
\n
'
'The constraints were:
$constraints
\n
'
'The following method
${failureCount > 1 ? "s" : ""}
returned values outside of those constraints:
\n
'
'
$failures
'
'If you are not writing your own RenderBox subclass, then this is not
\n
'
'your fault. Contact support: https://github.com/flutter/flutter/issues/new'
);
if
(
_debugNeedsIntrinsicSizeCheck
||
debugCheckIntrinsicSizes
)
{
// verify that the intrinsics are also within the constraints
assert
(!
RenderObject
.
debugCheckingIntrinsics
);
RenderObject
.
debugCheckingIntrinsics
=
true
;
double
intrinsic
;
StringBuffer
failures
=
new
StringBuffer
();
int
failureCount
=
0
;
intrinsic
=
getMinIntrinsicWidth
(
constraints
);
if
(
intrinsic
!=
constraints
.
constrainWidth
(
intrinsic
))
{
failures
.
writeln
(
' * getMinIntrinsicWidth() -- returned: w=
$intrinsic
'
);
failureCount
+=
1
;
}
intrinsic
=
getMaxIntrinsicWidth
(
constraints
);
if
(
intrinsic
!=
constraints
.
constrainWidth
(
intrinsic
))
{
failures
.
writeln
(
' * getMaxIntrinsicWidth() -- returned: w=
$intrinsic
'
);
failureCount
+=
1
;
}
intrinsic
=
getMinIntrinsicHeight
(
constraints
);
if
(
intrinsic
!=
constraints
.
constrainHeight
(
intrinsic
))
{
failures
.
writeln
(
' * getMinIntrinsicHeight() -- returned: h=
$intrinsic
'
);
failureCount
+=
1
;
}
intrinsic
=
getMaxIntrinsicHeight
(
constraints
);
if
(
intrinsic
!=
constraints
.
constrainHeight
(
intrinsic
))
{
failures
.
writeln
(
' * getMaxIntrinsicHeight() -- returned: h=
$intrinsic
'
);
failureCount
+=
1
;
}
RenderObject
.
debugCheckingIntrinsics
=
false
;
_debugNeedsIntrinsicSizeCheck
=
false
;
if
(
failures
.
isNotEmpty
)
{
assert
(
failureCount
>
0
);
throw
new
FlutterError
(
'The intrinsic dimension methods of the
$runtimeType
class returned values that violate the given constraints.
\n
'
'The constraints were:
$constraints
\n
'
'The following method
${failureCount > 1 ? "s" : ""}
returned values outside of those constraints:
\n
'
'
$failures
'
'If you are not writing your own RenderBox subclass, then this is not
\n
'
'your fault. Contact support: https://github.com/flutter/flutter/issues/new'
);
}
}
return
true
;
});
...
...
packages/flutter/lib/src/rendering/debug.dart
View file @
7da44d2d
...
...
@@ -68,6 +68,9 @@ bool debugPrintMarkNeedsPaintStacks = false;
/// Log the call stacks that mark render objects as needing layout.
bool
debugPrintMarkNeedsLayoutStacks
=
false
;
/// Check the intrinsic sizes of each [RenderBox] during layout.
bool
debugCheckIntrinsicSizes
=
false
;
List
<
String
>
debugDescribeTransform
(
Matrix4
transform
)
{
List
<
String
>
matrix
=
transform
.
toString
().
split
(
'
\n
'
).
map
((
String
s
)
=>
'
$s
'
).
toList
();
matrix
.
removeLast
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment