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
780ee181
Commit
780ee181
authored
Oct 18, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1657 from Hixie/debugging
Reduce latency of low-volume debugPrint output
parents
fb8fe97a
aed45ba9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
debug.dart
packages/flutter/lib/src/rendering/debug.dart
+11
-2
No files found.
packages/flutter/lib/src/rendering/debug.dart
View file @
780ee181
...
...
@@ -47,11 +47,18 @@ void debugPrint(String message) {
_debugPrintTask
();
}
int
_debugPrintedCharacters
=
0
;
int
_kDebugPrintCapacity
=
32
*
1024
;
int
_kDebugPrintCapacity
=
16
*
1024
;
Duration
_kDebugPrintPauseTime
=
const
Duration
(
seconds:
1
);
Queue
<
String
>
_debugPrintBuffer
=
new
Queue
<
String
>();
Stopwatch
_debugPrintStopwatch
=
new
Stopwatch
();
bool
_debugPrintScheduled
=
false
;
void
_debugPrintTask
(
)
{
_debugPrintScheduled
=
false
;
if
(
_debugPrintStopwatch
.
elapsed
>
_kDebugPrintPauseTime
)
{
_debugPrintStopwatch
.
stop
();
_debugPrintStopwatch
.
reset
();
_debugPrintedCharacters
=
0
;
}
while
(
_debugPrintedCharacters
<
_kDebugPrintCapacity
&&
_debugPrintBuffer
.
length
>
0
)
{
String
line
=
_debugPrintBuffer
.
removeFirst
();
_debugPrintedCharacters
+=
line
.
length
;
// TODO(ianh): Use the UTF-8 byte length instead
...
...
@@ -60,6 +67,8 @@ void _debugPrintTask() {
if
(
_debugPrintBuffer
.
length
>
0
)
{
_debugPrintScheduled
=
true
;
_debugPrintedCharacters
=
0
;
new
Timer
(
new
Duration
(
seconds:
1
),
_debugPrintTask
);
new
Timer
(
_kDebugPrintPauseTime
,
_debugPrintTask
);
}
else
{
_debugPrintStopwatch
.
start
();
}
}
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