diff --git a/engine/src/flutter/ci/licenses_golden/licenses_flutter b/engine/src/flutter/ci/licenses_golden/licenses_flutter index 2f7d7d9cdd..8d918f8187 100644 --- a/engine/src/flutter/ci/licenses_golden/licenses_flutter +++ b/engine/src/flutter/ci/licenses_golden/licenses_flutter @@ -41149,7 +41149,6 @@ ORIGIN: ../../../flutter/lib/web_ui/lib/canvas.dart + ../../../flutter/LICENSE ORIGIN: ../../../flutter/lib/web_ui/lib/channel_buffers.dart + ../../../flutter/LICENSE ORIGIN: ../../../flutter/lib/web_ui/lib/compositing.dart + ../../../flutter/LICENSE ORIGIN: ../../../flutter/lib/web_ui/lib/geometry.dart + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/lib/web_ui/lib/initialization.dart + ../../../flutter/LICENSE ORIGIN: ../../../flutter/lib/web_ui/lib/key.dart + ../../../flutter/LICENSE ORIGIN: ../../../flutter/lib/web_ui/lib/lerp.dart + ../../../flutter/LICENSE ORIGIN: ../../../flutter/lib/web_ui/lib/math.dart + ../../../flutter/LICENSE @@ -44097,7 +44096,6 @@ FILE: ../../../flutter/lib/web_ui/lib/canvas.dart FILE: ../../../flutter/lib/web_ui/lib/channel_buffers.dart FILE: ../../../flutter/lib/web_ui/lib/compositing.dart FILE: ../../../flutter/lib/web_ui/lib/geometry.dart -FILE: ../../../flutter/lib/web_ui/lib/initialization.dart FILE: ../../../flutter/lib/web_ui/lib/key.dart FILE: ../../../flutter/lib/web_ui/lib/lerp.dart FILE: ../../../flutter/lib/web_ui/lib/math.dart diff --git a/engine/src/flutter/lib/web_ui/lib/initialization.dart b/engine/src/flutter/lib/web_ui/lib/initialization.dart deleted file mode 100644 index 15b69a61b8..0000000000 --- a/engine/src/flutter/lib/web_ui/lib/initialization.dart +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2013 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. - -// TODO(yjbanov): rename this file to web_only_api.dart. -// https://github.com/flutter/flutter/issues/100394 -// Rather than extending this file with new APIs, we -// should instead use js interop. - -// This file contains extra web-only API that non-web engines do not have. -// -// Why have web-only API? -// -// Because all Dart code is compiled (and tree shaken) as a single compilation -// unit it only has one entry-point - the `main()` function of the Flutter -// app. The top-level `main()` is generated by Flutter tool and it needs to -// ask the engine to initialize itself before calling the handwritten `main()` -// function of the app itself. To do that, it needs something to call. The -// mobile engine doesn't provide a function like that because the application -// starts from the Java (Android) or Objective-C (iOS). Any initial -// configuration can be done in Java and the engine's C++ code prior to -// calling Dart's `main()`. - -part of ui; - -// TODO(mdebbar): Deprecate this and remove it. -// https://github.com/flutter/flutter/issues/127395 -Future webOnlyWarmupEngine({VoidCallback? registerPlugins, VoidCallback? runApp}) { - assert(() { - engine.printWarning( - 'The webOnlyWarmupEngine API is deprecated and will be removed in a ' - 'future release. Please use `bootstrapEngine` from `dart:ui_web` instead.', - ); - return true; - }()); - return ui_web.bootstrapEngine(registerPlugins: registerPlugins, runApp: runApp); -} - -// TODO(mdebbar): Deprecate this and remove it. -// https://github.com/flutter/flutter/issues/127395 -bool get debugEmulateFlutterTesterEnvironment { - assert(() { - engine.printWarning( - 'The debugEmulateFlutterTesterEnvironment getter is deprecated and will ' - 'be removed in a future release. Please use ' - '`debugEmulateFlutterTesterEnvironment` from `dart:ui_web` instead.', - ); - return true; - }()); - return ui_web.debugEmulateFlutterTesterEnvironment; -} - -// TODO(mdebbar): Deprecate this and remove it. -// https://github.com/flutter/flutter/issues/127395 -set debugEmulateFlutterTesterEnvironment(bool value) { - assert(() { - engine.printWarning( - 'The debugEmulateFlutterTesterEnvironment setter is deprecated and will ' - 'be removed in a future release. Please use ' - '`debugEmulateFlutterTesterEnvironment` from `dart:ui_web` instead.', - ); - return true; - }()); - ui_web.debugEmulateFlutterTesterEnvironment = value; -} - -// TODO(mdebbar): Deprecate this and remove it. -// https://github.com/flutter/flutter/issues/127395 -ui_web.AssetManager get webOnlyAssetManager { - assert(() { - engine.printWarning( - 'The webOnlyAssetManager getter is deprecated and will be removed in a ' - 'future release. Please use `assetManager` from `dart:ui_web` instead.', - ); - return true; - }()); - return ui_web.assetManager; -} - -// TODO(mdebbar): Deprecate this and remove it. -// https://github.com/flutter/flutter/issues/127395 -void webOnlySetPluginHandler(PlatformMessageCallback handler) { - assert(() { - engine.printWarning( - 'The webOnlySetPluginHandler API is deprecated and will be removed in a ' - 'future release. Please use `setPluginHandler` from `dart:ui_web` instead.', - ); - return true; - }()); - ui_web.setPluginHandler(handler); -} - -// TODO(mdebbar): Deprecate this and remove it. -// https://github.com/flutter/flutter/issues/127395 -ui_web.PlatformViewRegistry get platformViewRegistry { - assert(() { - engine.printWarning( - 'The platformViewRegistry getter is deprecated and will be removed in a ' - 'future release. Please import it from `dart:ui_web` instead.', - ); - return true; - }()); - return ui_web.platformViewRegistry; -} diff --git a/engine/src/flutter/lib/web_ui/lib/painting.dart b/engine/src/flutter/lib/web_ui/lib/painting.dart index 94d8c11f61..32d7623ace 100644 --- a/engine/src/flutter/lib/web_ui/lib/painting.dart +++ b/engine/src/flutter/lib/web_ui/lib/painting.dart @@ -689,23 +689,6 @@ class TargetImageSize { final int? height; } -// TODO(mdebbar): Deprecate this and remove it. -// https://github.com/flutter/flutter/issues/127395 -Future webOnlyInstantiateImageCodecFromUrl( - Uri uri, { - ui_web.ImageCodecChunkCallback? chunkCallback, -}) { - assert(() { - engine.printWarning( - 'The webOnlyInstantiateImageCodecFromUrl API is deprecated and will be ' - 'removed in a future release. Please use `createImageCodecFromUrl` from ' - '`dart:ui_web` instead.', - ); - return true; - }()); - return ui_web.createImageCodecFromUrl(uri, chunkCallback: chunkCallback); -} - void decodeImageFromList(Uint8List list, ImageDecoderCallback callback) { _decodeImageFromListAsync(list, callback); } diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/html_image_element_codec.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/html_image_element_codec.dart index 2be5e5fa8b..8e0fde1535 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/html_image_element_codec.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/html_image_element_codec.dart @@ -8,10 +8,6 @@ import 'package:ui/src/engine.dart'; import 'package:ui/ui.dart' as ui; import 'package:ui/ui_web/src/ui_web.dart' as ui_web; -// TODO(mdebbar): Deprecate this and remove it. -// https://github.com/flutter/flutter/issues/127395 -typedef WebOnlyImageCodecChunkCallback = ui_web.ImageCodecChunkCallback; - abstract class HtmlImageElementCodec implements ui.Codec { HtmlImageElementCodec(this.src, {this.chunkCallback, this.debugSource}); diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/profiler.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/profiler.dart index dcca071037..da189e28aa 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/profiler.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/profiler.dart @@ -3,17 +3,9 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:js_interop'; import 'package:ui/ui_web/src/ui_web.dart' as ui_web; -import 'util.dart'; - -// TODO(mdebbar): Deprecate this and remove it. -// https://github.com/flutter/flutter/issues/127395 -@JS('window._flutter_internal_on_benchmark') -external JSExportedDartFunction? get jsBenchmarkValueCallback; - ui_web.BenchmarkValueCallback? engineBenchmarkValueCallback; /// A function that computes a value of type [R]. @@ -59,8 +51,8 @@ R timeAction(String name, Action action) { /// /// 1. Set the environment variable `FLUTTER_WEB_ENABLE_PROFILING` to true. /// -/// 2. Using JS interop, assign a listener function to -/// `window._flutter_internal_on_benchmark` in the browser. +/// 2. Set the [engineBenchmarkValueCallback] to a function that will receive +/// the benchmark data. /// /// The listener function will be called every time a new benchmark number is /// calculated. The signature is `Function(String name, num value)`. @@ -105,17 +97,6 @@ class Profiler { void benchmark(String name, double value) { _checkBenchmarkMode(); - final ui_web.BenchmarkValueCallback? callback = - jsBenchmarkValueCallback?.toDart as ui_web.BenchmarkValueCallback?; - if (callback != null) { - printWarning( - 'The JavaScript benchmarking API (i.e. `window._flutter_internal_on_benchmark`) ' - 'is deprecated and will be removed in a future release. Please use ' - '`benchmarkValueCallback` from `dart:ui_web` instead.', - ); - callback(name, value); - } - if (engineBenchmarkValueCallback != null) { engineBenchmarkValueCallback!(name, value); } diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/window.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/window.dart index f4cce74800..b158736b0a 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/window.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/window.dart @@ -656,50 +656,6 @@ final class EngineFlutterWindow extends EngineFlutterView implements ui.Singleto return false; }); } - - // TODO(mdebbar): Deprecate this and remove it. - // https://github.com/flutter/flutter/issues/127395 - void debugOverrideDevicePixelRatio(double? value) { - assert(() { - printWarning( - 'The window.debugOverrideDevicePixelRatio API is deprecated and will ' - 'be removed in a future release. Please use ' - '`debugOverrideDevicePixelRatio` from `dart:ui_web` instead.', - ); - return true; - }()); - display.debugOverrideDevicePixelRatio(value); - } - - // TODO(mdebbar): Deprecate this and remove it. - // https://github.com/flutter/flutter/issues/127395 - ui.Size? get webOnlyDebugPhysicalSizeOverride { - assert(() { - printWarning( - 'The webOnlyDebugPhysicalSizeOverride API is deprecated and will be ' - 'removed in a future release. Please use ' - '`SingletonFlutterWindow.debugPhysicalSizeOverride` from `dart:ui_web` ' - 'instead.', - ); - return true; - }()); - return debugPhysicalSizeOverride; - } - - // TODO(mdebbar): Deprecate this and remove it. - // https://github.com/flutter/flutter/issues/127395 - set webOnlyDebugPhysicalSizeOverride(ui.Size? value) { - assert(() { - printWarning( - 'The webOnlyDebugPhysicalSizeOverride API is deprecated and will be ' - 'removed in a future release. Please use ' - '`SingletonFlutterWindow.debugPhysicalSizeOverride` from `dart:ui_web` ' - 'instead.', - ); - return true; - }()); - debugPhysicalSizeOverride = value; - } } /// The window singleton. diff --git a/engine/src/flutter/lib/web_ui/lib/ui.dart b/engine/src/flutter/lib/web_ui/lib/ui.dart index 5dc40b227e..bd53947ba8 100644 --- a/engine/src/flutter/lib/web_ui/lib/ui.dart +++ b/engine/src/flutter/lib/web_ui/lib/ui.dart @@ -14,14 +14,12 @@ import 'dart:math' as math; import 'dart:typed_data'; import 'src/engine.dart' as engine; -import 'ui_web/src/ui_web.dart' as ui_web; part 'annotations.dart'; part 'canvas.dart'; part 'channel_buffers.dart'; part 'compositing.dart'; part 'geometry.dart'; -part 'initialization.dart'; part 'key.dart'; part 'lerp.dart'; part 'math.dart'; diff --git a/engine/src/flutter/lib/web_ui/test/engine/profiler_test.dart b/engine/src/flutter/lib/web_ui/test/engine/profiler_test.dart index ff49e31dc1..326b0b6892 100644 --- a/engine/src/flutter/lib/web_ui/test/engine/profiler_test.dart +++ b/engine/src/flutter/lib/web_ui/test/engine/profiler_test.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:js_interop'; - import 'package:test/bootstrap/browser.dart'; import 'package:test/test.dart'; import 'package:ui/src/engine.dart'; @@ -11,9 +9,6 @@ import 'package:ui/ui_web/src/ui_web.dart' as ui_web; import '../common/spy.dart'; -@JS('window._flutter_internal_on_benchmark') -external set jsBenchmarkValueCallback(JSAny? object); - void main() { internalBootstrapBrowserTest(() => testMain); } @@ -50,7 +45,6 @@ void _profilerTests() { }); tearDown(() { - jsBenchmarkValueCallback = null; ui_web.benchmarkValueCallback = null; Profiler.isBenchmarkMode = false; }); @@ -79,102 +73,6 @@ void _profilerTests() { expect(() => Profiler.instance.benchmark('baz', 99.999), returnsNormally); expect(data, isEmpty); }); - - // TODO(mdebbar): Remove this group once the JS API is removed. - // https://github.com/flutter/flutter/issues/127395 - group('[JS API]', () { - test('can listen to benchmarks', () { - final List data = []; - jsBenchmarkValueCallback = - (String name, double value) { - data.add((name, value)); - }.toJS; - - Profiler.instance.benchmark('foo', 123); - expect(warnings, hasLength(1)); - expect(warnings.single, contains('deprecated')); - expect(warnings.single, contains('benchmarkValueCallback')); - expect(warnings.single, contains('dart:ui_web')); - warnings.clear(); - - expect(data, [('foo', 123)]); - data.clear(); - - Profiler.instance.benchmark('bar', 0.0125); - expect(data, [('bar', 0.0125)]); - data.clear(); - - // Remove listener and make sure nothing breaks and the data isn't being - // sent to the old callback anymore. - jsBenchmarkValueCallback = null; - expect(() => Profiler.instance.benchmark('baz', 99.999), returnsNormally); - expect(data, isEmpty); - }); - - test('throws on wrong listener type', () { - final List data = []; - - // Wrong callback signature. - jsBenchmarkValueCallback = - (double value) { - data.add(('bad', value)); - }.toJS; - expect( - () => Profiler.instance.benchmark('foo', 123), - - // dart2js throws a NoSuchMethodError, dart2wasm throws a TypeError here. - // Just make sure it throws an error in this case. - throwsA(isA()), - ); - expect(data, isEmpty); - - // Not even a callback. - jsBenchmarkValueCallback = 'string'.toJS; - expect( - () => Profiler.instance.benchmark('foo', 123), - // dart2js throws a TypeError, while dart2wasm throws an explicit - // exception. - throwsA(anything), - ); - }); - - test('can be combined with ui_web API', () { - final List uiWebData = []; - final List jsData = []; - - ui_web.benchmarkValueCallback = (String name, double value) { - uiWebData.add((name, value)); - }; - jsBenchmarkValueCallback = - (String name, double value) { - jsData.add((name, value)); - }.toJS; - - Profiler.instance.benchmark('foo', 123); - expect(warnings, hasLength(1)); - expect(warnings.single, contains('deprecated')); - expect(warnings.single, contains('benchmarkValueCallback')); - expect(warnings.single, contains('dart:ui_web')); - warnings.clear(); - - expect(uiWebData, [('foo', 123)]); - expect(jsData, [('foo', 123)]); - uiWebData.clear(); - jsData.clear(); - - Profiler.instance.benchmark('bar', 0.0125); - expect(uiWebData, [('bar', 0.0125)]); - expect(jsData, [('bar', 0.0125)]); - uiWebData.clear(); - jsData.clear(); - - ui_web.benchmarkValueCallback = null; - jsBenchmarkValueCallback = null; - expect(() => Profiler.instance.benchmark('baz', 99.999), returnsNormally); - expect(uiWebData, isEmpty); - expect(jsData, isEmpty); - }); - }); } void _instrumentationTests() { diff --git a/engine/src/flutter/lib/web_ui/test/engine/surface/platform_view_test.dart b/engine/src/flutter/lib/web_ui/test/engine/surface/platform_view_test.dart deleted file mode 100644 index 88078efb03..0000000000 --- a/engine/src/flutter/lib/web_ui/test/engine/surface/platform_view_test.dart +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2013 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 'dart:async'; - -import 'package:test/bootstrap/browser.dart'; -import 'package:test/test.dart'; -import 'package:ui/src/engine.dart'; -import 'package:ui/ui.dart' as ui; -import 'package:ui/ui_web/src/ui_web.dart' as ui_web; - -void main() { - internalBootstrapBrowserTest(() => testMain); -} - -Future testMain() async { - test('importing platformViewRegistry from dart:ui is deprecated', () { - final void Function(String) oldPrintWarning = printWarning; - - final List warnings = []; - printWarning = (String message) { - warnings.add(message); - }; - - // ignore: unnecessary_statements - ui_web.platformViewRegistry; - expect(warnings, isEmpty); - - // ignore: unnecessary_statements - ui.platformViewRegistry; - expect(warnings, hasLength(1)); - expect(warnings.single, contains('platformViewRegistry')); - expect(warnings.single, contains('deprecated')); - expect(warnings.single, contains('dart:ui_web')); - - printWarning = oldPrintWarning; - }); -}