Unverified Commit fe309e34 authored by Kenzie Davisson's avatar Kenzie Davisson Committed by GitHub

Create service extension consts for rendering lib (#111149)

parent 10d7e314
...@@ -55,6 +55,7 @@ export 'src/rendering/proxy_box.dart'; ...@@ -55,6 +55,7 @@ export 'src/rendering/proxy_box.dart';
export 'src/rendering/proxy_sliver.dart'; export 'src/rendering/proxy_sliver.dart';
export 'src/rendering/rotated_box.dart'; export 'src/rendering/rotated_box.dart';
export 'src/rendering/selection.dart'; export 'src/rendering/selection.dart';
export 'src/rendering/service_extensions.dart';
export 'src/rendering/shifted_box.dart'; export 'src/rendering/shifted_box.dart';
export 'src/rendering/sliver.dart'; export 'src/rendering/sliver.dart';
export 'src/rendering/sliver_fill.dart'; export 'src/rendering/sliver_fill.dart';
......
...@@ -14,6 +14,7 @@ import 'box.dart'; ...@@ -14,6 +14,7 @@ import 'box.dart';
import 'debug.dart'; import 'debug.dart';
import 'mouse_tracker.dart'; import 'mouse_tracker.dart';
import 'object.dart'; import 'object.dart';
import 'service_extensions.dart';
import 'view.dart'; import 'view.dart';
export 'package:flutter/gestures.dart' show HitTestResult; export 'package:flutter/gestures.dart' show HitTestResult;
...@@ -63,7 +64,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture ...@@ -63,7 +64,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
assert(() { assert(() {
// these service extensions only work in debug mode // these service extensions only work in debug mode
registerBoolServiceExtension( registerBoolServiceExtension(
name: 'invertOversizedImages', name: RenderingServiceExtensions.invertOversizedImages.name,
getter: () async => debugInvertOversizedImages, getter: () async => debugInvertOversizedImages,
setter: (bool value) async { setter: (bool value) async {
if (debugInvertOversizedImages != value) { if (debugInvertOversizedImages != value) {
...@@ -74,7 +75,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture ...@@ -74,7 +75,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
}, },
); );
registerBoolServiceExtension( registerBoolServiceExtension(
name: 'debugPaint', name: RenderingServiceExtensions.debugPaint.name,
getter: () async => debugPaintSizeEnabled, getter: () async => debugPaintSizeEnabled,
setter: (bool value) { setter: (bool value) {
if (debugPaintSizeEnabled == value) { if (debugPaintSizeEnabled == value) {
...@@ -85,7 +86,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture ...@@ -85,7 +86,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
}, },
); );
registerBoolServiceExtension( registerBoolServiceExtension(
name: 'debugPaintBaselinesEnabled', name: RenderingServiceExtensions.debugPaintBaselinesEnabled.name,
getter: () async => debugPaintBaselinesEnabled, getter: () async => debugPaintBaselinesEnabled,
setter: (bool value) { setter: (bool value) {
if (debugPaintBaselinesEnabled == value) { if (debugPaintBaselinesEnabled == value) {
...@@ -96,7 +97,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture ...@@ -96,7 +97,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
}, },
); );
registerBoolServiceExtension( registerBoolServiceExtension(
name: 'repaintRainbow', name: RenderingServiceExtensions.repaintRainbow.name,
getter: () async => debugRepaintRainbowEnabled, getter: () async => debugRepaintRainbowEnabled,
setter: (bool value) { setter: (bool value) {
final bool repaint = debugRepaintRainbowEnabled && !value; final bool repaint = debugRepaintRainbowEnabled && !value;
...@@ -108,7 +109,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture ...@@ -108,7 +109,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
}, },
); );
registerServiceExtension( registerServiceExtension(
name: 'debugDumpLayerTree', name: RenderingServiceExtensions.debugDumpLayerTree.name,
callback: (Map<String, String> parameters) async { callback: (Map<String, String> parameters) async {
final String data = RendererBinding.instance.renderView.debugLayer?.toStringDeep() ?? 'Layer tree unavailable.'; final String data = RendererBinding.instance.renderView.debugLayer?.toStringDeep() ?? 'Layer tree unavailable.';
return <String, Object>{ return <String, Object>{
...@@ -117,7 +118,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture ...@@ -117,7 +118,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
}, },
); );
registerBoolServiceExtension( registerBoolServiceExtension(
name: 'debugDisableClipLayers', name: RenderingServiceExtensions.debugDisableClipLayers.name,
getter: () async => debugDisableClipLayers, getter: () async => debugDisableClipLayers,
setter: (bool value) { setter: (bool value) {
if (debugDisableClipLayers == value) { if (debugDisableClipLayers == value) {
...@@ -128,7 +129,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture ...@@ -128,7 +129,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
}, },
); );
registerBoolServiceExtension( registerBoolServiceExtension(
name: 'debugDisablePhysicalShapeLayers', name: RenderingServiceExtensions.debugDisablePhysicalShapeLayers.name,
getter: () async => debugDisablePhysicalShapeLayers, getter: () async => debugDisablePhysicalShapeLayers,
setter: (bool value) { setter: (bool value) {
if (debugDisablePhysicalShapeLayers == value) { if (debugDisablePhysicalShapeLayers == value) {
...@@ -139,7 +140,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture ...@@ -139,7 +140,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
}, },
); );
registerBoolServiceExtension( registerBoolServiceExtension(
name: 'debugDisableOpacityLayers', name: RenderingServiceExtensions.debugDisableOpacityLayers.name,
getter: () async => debugDisableOpacityLayers, getter: () async => debugDisableOpacityLayers,
setter: (bool value) { setter: (bool value) {
if (debugDisableOpacityLayers == value) { if (debugDisableOpacityLayers == value) {
...@@ -155,7 +156,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture ...@@ -155,7 +156,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
if (!kReleaseMode) { if (!kReleaseMode) {
// these service extensions work in debug or profile mode // these service extensions work in debug or profile mode
registerServiceExtension( registerServiceExtension(
name: 'debugDumpRenderTree', name: RenderingServiceExtensions.debugDumpRenderTree.name,
callback: (Map<String, String> parameters) async { callback: (Map<String, String> parameters) async {
final String data = RendererBinding.instance.renderView.toStringDeep(); final String data = RendererBinding.instance.renderView.toStringDeep();
return <String, Object>{ return <String, Object>{
...@@ -164,7 +165,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture ...@@ -164,7 +165,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
}, },
); );
registerServiceExtension( registerServiceExtension(
name: 'debugDumpSemanticsTreeInTraversalOrder', name: RenderingServiceExtensions.debugDumpSemanticsTreeInTraversalOrder.name,
callback: (Map<String, String> parameters) async { callback: (Map<String, String> parameters) async {
return <String, Object>{ return <String, Object>{
'data': _generateSemanticsTree(DebugSemanticsDumpOrder.traversalOrder), 'data': _generateSemanticsTree(DebugSemanticsDumpOrder.traversalOrder),
...@@ -172,7 +173,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture ...@@ -172,7 +173,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
}, },
); );
registerServiceExtension( registerServiceExtension(
name: 'debugDumpSemanticsTreeInInverseHitTestOrder', name: RenderingServiceExtensions.debugDumpSemanticsTreeInInverseHitTestOrder.name,
callback: (Map<String, String> parameters) async { callback: (Map<String, String> parameters) async {
return <String, Object>{ return <String, Object>{
'data': _generateSemanticsTree(DebugSemanticsDumpOrder.inverseHitTest), 'data': _generateSemanticsTree(DebugSemanticsDumpOrder.inverseHitTest),
...@@ -180,7 +181,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture ...@@ -180,7 +181,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
}, },
); );
registerBoolServiceExtension( registerBoolServiceExtension(
name: 'profileRenderObjectPaints', name: RenderingServiceExtensions.profileRenderObjectPaints.name,
getter: () async => debugProfilePaintsEnabled, getter: () async => debugProfilePaintsEnabled,
setter: (bool value) async { setter: (bool value) async {
if (debugProfilePaintsEnabled != value) { if (debugProfilePaintsEnabled != value) {
...@@ -189,7 +190,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture ...@@ -189,7 +190,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
}, },
); );
registerBoolServiceExtension( registerBoolServiceExtension(
name: 'profileRenderObjectLayouts', name: RenderingServiceExtensions.profileRenderObjectLayouts.name,
getter: () async => debugProfileLayoutsEnabled, getter: () async => debugProfileLayoutsEnabled,
setter: (bool value) async { setter: (bool value) async {
if (debugProfileLayoutsEnabled != value) { if (debugProfileLayoutsEnabled != value) {
......
...@@ -94,7 +94,7 @@ bool debugPrintLayouts = false; ...@@ -94,7 +94,7 @@ bool debugPrintLayouts = false;
/// this on in your unit tests for additional validations. /// this on in your unit tests for additional validations.
bool debugCheckIntrinsicSizes = false; bool debugCheckIntrinsicSizes = false;
/// Adds [dart:developer.Timeline] events for every [RenderObject] layout. /// Adds [Timeline] events for every [RenderObject] layout.
/// ///
/// The timing information this flag exposes is not representative of the actual /// The timing information this flag exposes is not representative of the actual
/// cost of layout, because the overhead of adding timeline events is /// cost of layout, because the overhead of adding timeline events is
...@@ -120,7 +120,7 @@ bool debugCheckIntrinsicSizes = false; ...@@ -120,7 +120,7 @@ bool debugCheckIntrinsicSizes = false;
/// debugging information related to [RenderObject] layouts. /// debugging information related to [RenderObject] layouts.
bool debugProfileLayoutsEnabled = false; bool debugProfileLayoutsEnabled = false;
/// Adds [dart:developer.Timeline] events for every [RenderObject] painted. /// Adds [Timeline] events for every [RenderObject] painted.
/// ///
/// The timing information this flag exposes is not representative of actual /// The timing information this flag exposes is not representative of actual
/// paints, because the overhead of adding timeline events is significant /// paints, because the overhead of adding timeline events is significant
......
// 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.
/// Service extension constants for the rendering library.
///
/// These constants will be used when registering service extensions in the
/// framework, and they will also be used by tools and services that call these
/// service extensions.
///
/// The String value for each of these extension names should be accessed by
/// calling the `.name` property on the enum value.
enum RenderingServiceExtensions {
/// Name of service extension that, when called, will toggle whether the
/// framework will color invert and horizontally flip images that have been
/// decoded to a size taking at least [debugImageOverheadAllowance] bytes more
/// than necessary.
///
/// See also:
///
/// * [debugInvertOversizedImages], which is the flag that this service
/// extension exposes.
/// * [RendererBinding.initServiceExtensions], where the service extension is
/// registered.
invertOversizedImages,
/// Name of service extension that, when called, will toggle whether each
/// [RenderBox] will paint a box around its bounds as well as additional boxes
/// showing construction lines.
///
/// See also:
///
/// * [debugPaintSizeEnabled], which is the flag that this service extension
/// exposes.
/// * [RendererBinding.initServiceExtensions], where the service extension is
/// registered.
debugPaint,
/// Name of service extension that, when called, will toggle whether each
/// [RenderBox] will paint a line at each of its baselines.
///
/// See also:
///
/// * [debugPaintBaselinesEnabled], which is the flag that this service
/// extension exposes.
/// * [RendererBinding.initServiceExtensions], where the service extension is
/// registered.
debugPaintBaselinesEnabled,
/// Name of service extension that, when called, will toggle whether a rotating
/// set of colors will be overlaid on the device when repainting layers in debug
/// mode.
///
/// See also:
///
/// * [debugRepaintRainbowEnabled], which is the flag that this service
/// extension exposes.
/// * [RendererBinding.initServiceExtensions], where the service extension is
/// registered.
repaintRainbow,
/// Name of service extension that, when called, will dump a [String]
/// representation of the layer tree to console.
///
/// See also:
///
/// * [RendererBinding.initServiceExtensions], where the service extension is
/// registered.
debugDumpLayerTree,
/// Name of service extension that, when called, will toggle whether all
/// clipping effects from the layer tree will be ignored.
///
/// See also:
///
/// * [debugDisableClipLayers], which is the flag that this service extension
/// exposes.
/// * [RendererBinding.initServiceExtensions], where the service extension is
/// registered.
debugDisableClipLayers,
/// Name of service extension that, when called, will toggle whether all
/// physical modeling effects from the layer tree will be ignored.
///
/// See also:
///
/// * [debugDisablePhysicalShapeLayers], which is the flag that this service
/// extension exposes.
/// * [RendererBinding.initServiceExtensions], where the service extension is
/// registered.
debugDisablePhysicalShapeLayers,
/// Name of service extension that, when called, will toggle whether all opacity
/// effects from the layer tree will be ignored.
///
/// See also:
///
/// * [debugDisableOpacityLayers], which is the flag that this service extension
/// exposes.
/// * [RendererBinding.initServiceExtensions], where the service extension is
/// registered.
debugDisableOpacityLayers,
/// Name of service extension that, when called, will dump a [String]
/// representation of the render tree to console.
///
/// See also:
///
/// * [RendererBinding.initServiceExtensions], where the service extension is
/// registered.
debugDumpRenderTree,
/// Name of service extension that, when called, will dump a [String]
/// representation of the semantics tree (in traversal order) to console.
///
/// See also:
///
/// * [RendererBinding.initServiceExtensions], where the service extension is
/// registered.
debugDumpSemanticsTreeInTraversalOrder,
/// Name of service extension that, when called, will dump a [String]
/// representation of the semantics tree (in inverse hit test order) to console.
///
/// See also:
///
/// * [RendererBinding.initServiceExtensions], where the service extension is
/// registered.
debugDumpSemanticsTreeInInverseHitTestOrder,
/// Name of service extension that, when called, will toggle whether [Timeline]
/// events are added for every [RenderObject] painted.
///
/// See also:
///
/// * [debugProfilePaintsEnabled], which is the flag that this service extension
/// exposes.
/// * [RendererBinding.initServiceExtensions], where the service extension is
/// registered.
profileRenderObjectPaints,
/// Name of service extension that, when called, will toggle whether [Timeline]
/// events are added for every [RenderObject] laid out.
///
/// See also:
///
/// * [debugProfileLayoutsEnabled], which is the flag that this service
/// extension exposes.
/// * [RendererBinding.initServiceExtensions], where the service extension is
/// registered.
profileRenderObjectLayouts,
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment