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
ec8693e8
Unverified
Commit
ec8693e8
authored
Apr 29, 2022
by
Jonah Williams
Committed by
GitHub
Apr 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete fast reassemble code (#102842)
parent
a8c16a70
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
191 deletions
+15
-191
binding.dart
packages/flutter/lib/src/foundation/binding.dart
+0
-27
binding.dart
packages/flutter/lib/src/rendering/binding.dart
+7
-9
binding.dart
packages/flutter/lib/src/widgets/binding.dart
+3
-12
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+3
-18
widget_inspector.dart
packages/flutter/lib/src/widgets/widget_inspector.dart
+1
-1
fast_reassemble_test.dart
packages/flutter/test/widgets/fast_reassemble_test.dart
+0
-123
widget_inspector_test_utils.dart
...ges/flutter/test/widgets/widget_inspector_test_utils.dart
+1
-1
No files found.
packages/flutter/lib/src/foundation/binding.dart
View file @
ec8693e8
...
...
@@ -157,13 +157,6 @@ abstract class BindingBase {
static
Type
?
_debugInitializedType
;
static
bool
_debugServiceExtensionsRegistered
=
false
;
/// Additional configuration used by the framework during hot reload.
///
/// See also:
///
/// * [DebugReassembleConfig], which describes the configuration.
static
DebugReassembleConfig
?
debugReassembleConfig
;
/// The main window to which this binding is bound.
///
/// A number of additional bindings are defined as extensions of
...
...
@@ -878,23 +871,3 @@ abstract class BindingBase {
Future
<
void
>
_exitApplication
()
async
{
exit
(
0
);
}
/// Additional configuration used for hot reload reassemble optimizations.
///
/// Do not extend, implement, or mixin this class. This may only be instantiated
/// in debug mode.
class
DebugReassembleConfig
{
/// Create a new [DebugReassembleConfig].
///
/// Throws a [FlutterError] if this is called in profile or release mode.
DebugReassembleConfig
({
this
.
widgetName
,
})
{
if
(!
kDebugMode
)
{
throw
FlutterError
(
'Cannot instantiate DebugReassembleConfig in profile or release mode.'
);
}
}
/// The name of the widget that was modified, or `null` if the change was elsewhere.
final
String
?
widgetName
;
}
packages/flutter/lib/src/rendering/binding.dart
View file @
ec8693e8
...
...
@@ -514,7 +514,6 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
@override
Future
<
void
>
performReassemble
()
async
{
await
super
.
performReassemble
();
if
(
BindingBase
.
debugReassembleConfig
?.
widgetName
==
null
)
{
if
(!
kReleaseMode
)
{
Timeline
.
startSync
(
'Preparing Hot Reload (layout)'
);
}
...
...
@@ -525,7 +524,6 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
Timeline
.
finishSync
();
}
}
}
scheduleWarmUpFrame
();
await
endOfFrame
;
}
...
...
packages/flutter/lib/src/widgets/binding.dart
View file @
ec8693e8
...
...
@@ -412,16 +412,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
registerServiceExtension
(
name:
'fastReassemble'
,
callback:
(
Map
<
String
,
Object
>
params
)
async
{
// This mirrors the implementation of the 'reassemble' callback registration
// in lib/src/foundation/binding.dart, but with the extra binding config used
// to skip some reassemble work.
final
String
?
className
=
params
[
'className'
]
as
String
?;
BindingBase
.
debugReassembleConfig
=
DebugReassembleConfig
(
widgetName:
className
);
try
{
await
reassembleApplication
();
}
finally
{
BindingBase
.
debugReassembleConfig
=
null
;
}
return
<
String
,
String
>{
'type'
:
'Success'
};
},
);
...
...
@@ -478,7 +469,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
Future
<
void
>
_forceRebuild
()
{
if
(
renderViewElement
!=
null
)
{
buildOwner
!.
reassemble
(
renderViewElement
!
,
null
);
buildOwner
!.
reassemble
(
renderViewElement
!);
return
endOfFrame
;
}
return
Future
<
void
>.
value
();
...
...
@@ -945,7 +936,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
}());
if
(
renderViewElement
!=
null
)
{
buildOwner
!.
reassemble
(
renderViewElement
!
,
BindingBase
.
debugReassembleConfig
);
buildOwner
!.
reassemble
(
renderViewElement
!);
}
return
super
.
performReassemble
();
}
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
ec8693e8
...
...
@@ -3028,14 +3028,13 @@ class BuildOwner {
/// changed implementations.
///
/// This is expensive and should not be called except during development.
void
reassemble
(
Element
root
,
DebugReassembleConfig
?
reassembleConfig
)
{
void
reassemble
(
Element
root
)
{
if
(!
kReleaseMode
)
{
Timeline
.
startSync
(
'Preparing Hot Reload (widgets)'
);
}
try
{
assert
(
root
.
_parent
==
null
);
assert
(
root
.
owner
==
this
);
root
.
_debugReassembleConfig
=
reassembleConfig
;
root
.
reassemble
();
}
finally
{
if
(!
kReleaseMode
)
{
...
...
@@ -3143,7 +3142,6 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
_widget
=
widget
;
Element
?
_parent
;
DebugReassembleConfig
?
_debugReassembleConfig
;
_NotificationNode
?
_notificationTree
;
/// Compare two widgets for equality.
...
...
@@ -3273,15 +3271,10 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
@mustCallSuper
@protected
void
reassemble
()
{
if
(
_debugShouldReassemble
(
_debugReassembleConfig
,
_widget
))
{
markNeedsBuild
();
_debugReassembleConfig
=
null
;
}
visitChildren
((
Element
child
)
{
child
.
_debugReassembleConfig
=
_debugReassembleConfig
;
child
.
reassemble
();
});
_debugReassembleConfig
=
null
;
}
bool
_debugIsInScope
(
Element
target
)
{
...
...
@@ -4925,9 +4918,7 @@ class StatefulElement extends ComponentElement {
@override
void
reassemble
()
{
if
(
_debugShouldReassemble
(
_debugReassembleConfig
,
_widget
))
{
state
.
reassemble
();
}
super
.
reassemble
();
}
...
...
@@ -6463,9 +6454,3 @@ class _NullWidget extends Widget {
@override
Element
createElement
()
=>
throw
UnimplementedError
();
}
// Whether a [DebugReassembleConfig] indicates that an element holding [widget] can skip
// a reassemble.
bool
_debugShouldReassemble
(
DebugReassembleConfig
?
config
,
Widget
?
widget
)
{
return
config
==
null
||
config
.
widgetName
==
null
||
widget
?.
runtimeType
.
toString
()
==
config
.
widgetName
;
}
packages/flutter/lib/src/widgets/widget_inspector.dart
View file @
ec8693e8
...
...
@@ -911,7 +911,7 @@ mixin WidgetInspectorService {
Future
<
void
>
forceRebuild
()
{
final
WidgetsBinding
binding
=
WidgetsBinding
.
instance
;
if
(
binding
.
renderViewElement
!=
null
)
{
binding
.
buildOwner
!.
reassemble
(
binding
.
renderViewElement
!
,
null
);
binding
.
buildOwner
!.
reassemble
(
binding
.
renderViewElement
!);
return
binding
.
endOfFrame
;
}
return
Future
<
void
>.
value
();
...
...
packages/flutter/test/widgets/fast_reassemble_test.dart
deleted
100644 → 0
View file @
a8c16a70
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/foundation.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'reassemble with a className only marks subtrees from the first matching element as dirty'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
Foo
(
Bar
(
Fizz
(
SizedBox
())))
);
expect
(
Foo
.
count
,
0
);
expect
(
Bar
.
count
,
0
);
expect
(
Fizz
.
count
,
0
);
DebugReassembleConfig
config
=
DebugReassembleConfig
(
widgetName:
'Bar'
);
WidgetsBinding
.
instance
.
buildOwner
!.
reassemble
(
WidgetsBinding
.
instance
.
renderViewElement
!,
config
);
expect
(
Foo
.
count
,
0
);
expect
(
Bar
.
count
,
1
);
expect
(
Fizz
.
count
,
1
);
config
=
DebugReassembleConfig
(
widgetName:
'Fizz'
);
WidgetsBinding
.
instance
.
buildOwner
!.
reassemble
(
WidgetsBinding
.
instance
.
renderViewElement
!,
config
);
expect
(
Foo
.
count
,
0
);
expect
(
Bar
.
count
,
1
);
expect
(
Fizz
.
count
,
2
);
config
=
DebugReassembleConfig
(
widgetName:
'NoMatch'
);
WidgetsBinding
.
instance
.
buildOwner
!.
reassemble
(
WidgetsBinding
.
instance
.
renderViewElement
!,
config
);
expect
(
Foo
.
count
,
0
);
expect
(
Bar
.
count
,
1
);
expect
(
Fizz
.
count
,
2
);
config
=
DebugReassembleConfig
();
WidgetsBinding
.
instance
.
buildOwner
!.
reassemble
(
WidgetsBinding
.
instance
.
renderViewElement
!,
config
);
expect
(
Foo
.
count
,
1
);
expect
(
Bar
.
count
,
2
);
expect
(
Fizz
.
count
,
3
);
WidgetsBinding
.
instance
.
buildOwner
!.
reassemble
(
WidgetsBinding
.
instance
.
renderViewElement
!,
null
);
expect
(
Foo
.
count
,
2
);
expect
(
Bar
.
count
,
3
);
expect
(
Fizz
.
count
,
4
);
});
}
class
Foo
extends
StatefulWidget
{
const
Foo
(
this
.
child
,
{
super
.
key
});
final
Widget
child
;
static
int
count
=
0
;
@override
State
<
Foo
>
createState
()
=>
_FooState
();
}
class
_FooState
extends
State
<
Foo
>
{
@override
void
reassemble
()
{
Foo
.
count
+=
1
;
super
.
reassemble
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
widget
.
child
;
}
}
class
Bar
extends
StatefulWidget
{
const
Bar
(
this
.
child
,
{
super
.
key
});
final
Widget
child
;
static
int
count
=
0
;
@override
State
<
Bar
>
createState
()
=>
_BarState
();
}
class
_BarState
extends
State
<
Bar
>
{
@override
void
reassemble
()
{
Bar
.
count
+=
1
;
super
.
reassemble
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
widget
.
child
;
}
}
class
Fizz
extends
StatefulWidget
{
const
Fizz
(
this
.
child
,
{
super
.
key
});
final
Widget
child
;
static
int
count
=
0
;
@override
State
<
Fizz
>
createState
()
=>
_FizzState
();
}
class
_FizzState
extends
State
<
Fizz
>
{
@override
void
reassemble
()
{
Fizz
.
count
+=
1
;
super
.
reassemble
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
widget
.
child
;
}
}
packages/flutter/test/widgets/widget_inspector_test_utils.dart
View file @
ec8693e8
...
...
@@ -59,7 +59,7 @@ class TestWidgetInspectorService extends Object with WidgetInspectorService {
final
WidgetsBinding
binding
=
WidgetsBinding
.
instance
;
if
(
binding
.
renderViewElement
!=
null
)
{
binding
.
buildOwner
!.
reassemble
(
binding
.
renderViewElement
!
,
null
);
binding
.
buildOwner
!.
reassemble
(
binding
.
renderViewElement
!);
}
}
...
...
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