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
4cc9416b
Commit
4cc9416b
authored
Apr 01, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3026 from abarth/capture_closure
Capture closures around megamorphic dispatches
parents
fca2ac11
622bec43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
object.dart
packages/flutter/lib/src/rendering/object.dart
+11
-2
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+8
-2
No files found.
packages/flutter/lib/src/rendering/object.dart
View file @
4cc9416b
...
...
@@ -777,6 +777,9 @@ class PipelineOwner {
}
// See _performLayout.
void
_doNothing
(
)
{
}
/// An object in the render tree.
///
/// The [RenderObject] class hierarchy is the core of the rendering
...
...
@@ -804,6 +807,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
RenderObject
()
{
_needsCompositing
=
isRepaintBoundary
||
alwaysNeedsCompositing
;
_performLayout
=
performLayout
;
}
// LAYOUT
...
...
@@ -1073,7 +1077,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
return
true
;
});
try
{
performLayout
();
_
performLayout
();
markNeedsSemanticsUpdate
();
}
catch
(
e
,
stack
)
{
_debugReportException
(
'performLayout'
,
e
,
stack
);
...
...
@@ -1168,7 +1172,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
return
true
;
});
try
{
performLayout
();
_
performLayout
();
markNeedsSemanticsUpdate
();
assert
(()
{
debugAssertDoesMeetConstraints
();
return
true
;
});
}
catch
(
e
,
stack
)
{
...
...
@@ -1235,6 +1239,11 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
/// information without informing this render object.
void
performLayout
();
// We cache a closure to performLayout so that the callsite is monomorphic.
// Initializing this field with _buildNothing helps the compiler prove that
// this field always holds a closure.
VoidCallback
_performLayout
=
_doNothing
;
/// Allows this render object to mutate its child list during layout and
/// invokes callback.
void
invokeLayoutCallback
(
LayoutCallback
callback
)
{
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
4cc9416b
...
...
@@ -1351,12 +1351,18 @@ abstract class BuildableElement extends Element {
typedef
Widget
WidgetBuilder
(
BuildContext
context
);
// See _builder.
Widget
_buildNothing
(
BuildContext
context
)
=>
null
;
/// Base class for the instantiation of [StatelessWidget], [StatefulWidget],
/// and [_ProxyWidget] widgets.
abstract
class
ComponentElement
extends
BuildableElement
{
ComponentElement
(
Widget
widget
)
:
super
(
widget
);
WidgetBuilder
_builder
;
// Initializing this field with _buildNothing helps the compiler prove that
// this field always holds a closure.
WidgetBuilder
_builder
=
_buildNothing
;
Element
_child
;
@override
...
...
@@ -1456,7 +1462,7 @@ class StatefulElement extends ComponentElement {
assert
(
_state
.
_debugTypesAreRight
(
widget
));
assert
(
_state
.
_element
==
null
);
_state
.
_element
=
this
;
assert
(
_builder
==
null
);
assert
(
_builder
==
_buildNothing
);
_builder
=
_state
.
build
;
assert
(
_state
.
_config
==
null
);
_state
.
_config
=
widget
;
...
...
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