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
cde14ab6
Commit
cde14ab6
authored
Dec 15, 2015
by
Devon Carew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more checked mode guards; more types; fewer todos
parent
211aeabb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
28 deletions
+36
-28
binding.dart
packages/flutter/lib/src/rendering/binding.dart
+4
-1
debug.dart
packages/flutter/lib/src/rendering/debug.dart
+32
-27
No files found.
packages/flutter/lib/src/rendering/binding.dart
View file @
cde14ab6
...
...
@@ -24,8 +24,11 @@ abstract class Renderer extends Scheduler
_instance
=
this
;
ui
.
window
.
onMetricsChanged
=
handleMetricsChanged
;
initRenderView
();
assert
(()
{
initServiceExtensions
();
return
true
;
});
addPersistentFrameCallback
(
_handlePersistentFrameCallback
);
initServiceExtensions
();
}
static
Renderer
_instance
;
...
...
packages/flutter/lib/src/rendering/debug.dart
View file @
cde14ab6
...
...
@@ -5,7 +5,7 @@
import
'dart:async'
;
import
'dart:collection'
;
import
'dart:convert'
show
JSON
;
import
'dart:developer'
;
import
'dart:developer'
as
developer
;
import
'dart:ui'
as
ui
;
import
'package:flutter/painting.dart'
;
...
...
@@ -67,15 +67,13 @@ void initServiceExtensions() {
_extensionsInitialized
=
true
;
assert
(()
{
registerExtension
(
'flutter'
,
_flutter
);
// TODO: Expose debugDumpApp().
// TODO: Expose StatisticsOverlay.
registerExtension
(
'flutter.debugPaint'
,
_debugPaint
);
registerExtension
(
'flutter.timeDilation'
,
_timeDilation
);
developer
.
registerExtension
(
'flutter'
,
_flutter
);
developer
.
registerExtension
(
'flutter.debugPaint'
,
_debugPaint
);
developer
.
registerExtension
(
'flutter.timeDilation'
,
_timeDilation
);
// Emit an info level log message; this tells the debugger that the Flutter
// service extensions are registered.
log
(
'Flutter initialized'
,
name:
'flutter'
,
level:
800
);
developer
.
log
(
'Flutter initialized'
,
name:
'flutter'
,
level:
800
);
return
true
;
});
...
...
@@ -83,15 +81,20 @@ void initServiceExtensions() {
/// Just respond to the request. Clients can use the existence of this call to
/// know that the debug client is a Flutter app.
Future
<
ServiceExtensionResponse
>
_flutter
(
String
method
,
Map
<
String
,
dynamic
>
parameters
)
{
String
result
=
JSON
.
encode
({
'type'
:
'_extensionType'
,
'method'
:
method
});
return
new
Future
<
ServiceExtensionResponse
>.
value
(
new
ServiceExtensionResponse
.
result
(
result
));
Future
<
developer
.
ServiceExtensionResponse
>
_flutter
(
String
method
,
Map
<
String
,
dynamic
>
parameters
)
{
return
new
Future
<
developer
.
ServiceExtensionResponse
>.
value
(
new
developer
.
ServiceExtensionResponse
.
result
(
JSON
.
encode
({
'type'
:
'_extensionType'
,
'method'
:
method
}))
);
}
/// Toggle the [debugPaintSizeEnabled] setting.
Future
<
ServiceExtensionResponse
>
_debugPaint
(
String
method
,
Map
<
String
,
dynamic
>
parameters
)
{
Future
<
developer
.
ServiceExtensionResponse
>
_debugPaint
(
String
method
,
Map
<
String
,
dynamic
>
parameters
)
{
if
(
parameters
.
containsKey
(
'enabled'
))
{
// TODO: This is a work around for a VM bug: sdk/25208 - all params are coerced to strings.
// TODO(devoncarew): This is a work around for a VM bug: sdk/25208 - all
// params are coerced to strings.
debugPaintSizeEnabled
=
parameters
[
'enabled'
].
toString
()
==
'true'
;
// Redraw everything - mark the world as dirty.
...
...
@@ -100,21 +103,22 @@ Future<ServiceExtensionResponse> _debugPaint(String method, Map<String, dynamic>
child
.
markNeedsPaint
();
child
.
visitChildren
(
visitor
);
};
Renderer
.
instance
.
renderView
.
visitChildren
(
visitor
);
Renderer
.
instance
?.
renderView
?
.
visitChildren
(
visitor
);
}
String
result
=
JSON
.
encode
({
'type'
:
'_extensionType'
,
'method'
:
method
,
'enabled'
:
debugPaintSizeEnabled
});
return
new
Future
<
ServiceExtensionResponse
>.
value
(
new
ServiceExtensionResponse
.
result
(
result
));
return
new
Future
<
developer
.
ServiceExtensionResponse
>.
value
(
new
developer
.
ServiceExtensionResponse
.
result
(
JSON
.
encode
({
'type'
:
'_extensionType'
,
'method'
:
method
,
'enabled'
:
debugPaintSizeEnabled
}))
);
}
/// Manipulate the scheduler's [timeDilation] field.
Future
<
ServiceExtensionResponse
>
_timeDilation
(
String
method
,
Map
<
String
,
dynamic
>
parameters
)
{
Future
<
developer
.
ServiceExtensionResponse
>
_timeDilation
(
String
method
,
Map
<
String
,
dynamic
>
parameters
)
{
if
(
parameters
.
containsKey
(
'timeDilation'
))
{
// TODO: Workaround for https://github.com/dart-lang/sdk/issues/25208.
// TODO
(devoncarew)
: Workaround for https://github.com/dart-lang/sdk/issues/25208.
dynamic
param
=
parameters
[
'timeDilation'
];
if
(
param
is
String
)
{
param
=
double
.
parse
(
param
);
...
...
@@ -126,12 +130,13 @@ Future<ServiceExtensionResponse> _timeDilation(String method, Map<String, dynami
timeDilation
=
1.0
;
}
String
result
=
JSON
.
encode
({
'type'
:
'_extensionType'
,
'method'
:
method
,
'timeDilation'
:
'
$timeDilation
'
});
return
new
Future
<
ServiceExtensionResponse
>.
value
(
new
ServiceExtensionResponse
.
result
(
result
));
return
new
Future
<
developer
.
ServiceExtensionResponse
>.
value
(
new
developer
.
ServiceExtensionResponse
.
result
(
JSON
.
encode
({
'type'
:
'_extensionType'
,
'method'
:
method
,
'timeDilation'
:
'
$timeDilation
'
}))
);
}
/// Prints a message to the console, which you can access using the "flutter"
...
...
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