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
7cf58702
Unverified
Commit
7cf58702
authored
Jan 09, 2018
by
Ian Hickson
Committed by
GitHub
Jan 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap _debug flag setting in asserts. (#13974)
Fixes the last bits of #5759.
parent
3905d991
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
23 deletions
+58
-23
object.dart
packages/flutter/lib/src/rendering/object.dart
+58
-23
No files found.
packages/flutter/lib/src/rendering/object.dart
View file @
7cf58702
...
...
@@ -700,8 +700,13 @@ class PipelineOwner {
///
/// See [RendererBinding] for an example of how this function is used.
void
flushLayout
()
{
Timeline
.
startSync
(
'Layout'
,
arguments:
timelineWhitelistArguments
);
_debugDoingLayout
=
true
;
profile
(()
{
Timeline
.
startSync
(
'Layout'
,
arguments:
timelineWhitelistArguments
);
});
assert
(()
{
_debugDoingLayout
=
true
;
return
true
;
}());
try
{
// TODO(ianh): assert that we're not allowing previously dirty nodes to redirty themselves
while
(
_nodesNeedingLayout
.
isNotEmpty
)
{
...
...
@@ -713,8 +718,13 @@ class PipelineOwner {
}
}
}
finally
{
_debugDoingLayout
=
false
;
Timeline
.
finishSync
();
assert
(()
{
_debugDoingLayout
=
false
;
return
true
;
}());
profile
(()
{
Timeline
.
finishSync
();
});
}
}
...
...
@@ -728,12 +738,19 @@ class PipelineOwner {
// See [RenderObject.invokeLayoutCallback].
void
_enableMutationsToDirtySubtrees
(
VoidCallback
callback
)
{
assert
(
_debugDoingLayout
);
final
bool
oldState
=
_debugAllowMutationsToDirtySubtrees
;
_debugAllowMutationsToDirtySubtrees
=
true
;
bool
oldState
;
assert
(()
{
oldState
=
_debugAllowMutationsToDirtySubtrees
;
_debugAllowMutationsToDirtySubtrees
=
true
;
return
true
;
}());
try
{
callback
();
}
finally
{
_debugAllowMutationsToDirtySubtrees
=
oldState
;
assert
(()
{
_debugAllowMutationsToDirtySubtrees
=
oldState
;
return
true
;
}());
}
}
...
...
@@ -743,14 +760,14 @@ class PipelineOwner {
/// Called as part of the rendering pipeline after [flushLayout] and before
/// [flushPaint].
void
flushCompositingBits
()
{
Timeline
.
startSync
(
'Compositing bits'
);
profile
(()
{
Timeline
.
startSync
(
'Compositing bits'
);
}
);
_nodesNeedingCompositingBitsUpdate
.
sort
((
RenderObject
a
,
RenderObject
b
)
=>
a
.
depth
-
b
.
depth
);
for
(
RenderObject
node
in
_nodesNeedingCompositingBitsUpdate
)
{
if
(
node
.
_needsCompositingBitsUpdate
&&
node
.
owner
==
this
)
node
.
_updateCompositingBits
();
}
_nodesNeedingCompositingBitsUpdate
.
clear
();
Timeline
.
finishSync
(
);
profile
(()
{
Timeline
.
finishSync
();
}
);
}
List
<
RenderObject
>
_nodesNeedingPaint
=
<
RenderObject
>[];
...
...
@@ -771,8 +788,11 @@ class PipelineOwner {
///
/// See [RendererBinding] for an example of how this function is used.
void
flushPaint
()
{
Timeline
.
startSync
(
'Paint'
,
arguments:
timelineWhitelistArguments
);
_debugDoingPaint
=
true
;
profile
(()
{
Timeline
.
startSync
(
'Paint'
,
arguments:
timelineWhitelistArguments
);
});
assert
(()
{
_debugDoingPaint
=
true
;
return
true
;
}());
try
{
final
List
<
RenderObject
>
dirtyNodes
=
_nodesNeedingPaint
;
_nodesNeedingPaint
=
<
RenderObject
>[];
...
...
@@ -789,8 +809,11 @@ class PipelineOwner {
}
assert
(
_nodesNeedingPaint
.
isEmpty
);
}
finally
{
_debugDoingPaint
=
false
;
Timeline
.
finishSync
();
assert
(()
{
_debugDoingPaint
=
false
;
return
true
;
}());
profile
(()
{
Timeline
.
finishSync
();
});
}
}
...
...
@@ -860,7 +883,7 @@ class PipelineOwner {
void
flushSemantics
()
{
if
(
_semanticsOwner
==
null
)
return
;
Timeline
.
startSync
(
'Semantics'
);
profile
(()
{
Timeline
.
startSync
(
'Semantics'
);
}
);
assert
(
_semanticsOwner
!=
null
);
assert
(()
{
_debugDoingSemantics
=
true
;
return
true
;
}());
try
{
...
...
@@ -875,7 +898,7 @@ class PipelineOwner {
}
finally
{
assert
(
_nodesNeedingSemantics
.
isEmpty
);
assert
(()
{
_debugDoingSemantics
=
false
;
return
true
;
}());
Timeline
.
finishSync
(
);
profile
(()
{
Timeline
.
finishSync
();
}
);
}
}
}
...
...
@@ -2452,16 +2475,21 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
String
prefixOtherLines:
''
,
DiagnosticLevel
minLevel:
DiagnosticLevel
.
debug
,
})
{
final
RenderObject
debugPreviousActiveLayout
=
_debugActiveLayout
;
_debugActiveLayout
=
null
;
RenderObject
debugPreviousActiveLayout
;
assert
(()
{
debugPreviousActiveLayout
=
_debugActiveLayout
;
_debugActiveLayout
=
null
;
return
true
;
}());
final
String
result
=
super
.
toStringDeep
(
prefixLineOne:
prefixLineOne
,
prefixOtherLines:
prefixOtherLines
,
minLevel:
minLevel
,
);
_debugActiveLayout
=
debugPreviousActiveLayout
;
assert
(()
{
_debugActiveLayout
=
debugPreviousActiveLayout
;
return
true
;
}());
return
result
;
}
...
...
@@ -2475,10 +2503,17 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
String
joiner:
'; '
,
DiagnosticLevel
minLevel:
DiagnosticLevel
.
debug
,
})
{
final
RenderObject
debugPreviousActiveLayout
=
_debugActiveLayout
;
_debugActiveLayout
=
null
;
RenderObject
debugPreviousActiveLayout
;
assert
(()
{
debugPreviousActiveLayout
=
_debugActiveLayout
;
_debugActiveLayout
=
null
;
return
true
;
}());
final
String
result
=
super
.
toStringShallow
(
joiner:
joiner
,
minLevel:
minLevel
);
_debugActiveLayout
=
debugPreviousActiveLayout
;
assert
(()
{
_debugActiveLayout
=
debugPreviousActiveLayout
;
return
true
;
}());
return
result
;
}
...
...
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