Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c6f0444

Browse files
committed
Reduce the differences between Web and non-Web versions
1 parent dc750de commit c6f0444

File tree

7 files changed

+372
-266
lines changed

7 files changed

+372
-266
lines changed

lib/ui/channel_buffers.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// @dart = 2.10
66

7+
// KEEP THIS SYNCHRONIZED WITH ../web_ui/lib/src/ui/channel_buffers.dart
8+
79
part of dart.ui;
810

911
/// Signature for [ChannelBuffers.drain]'s `callback` argument.

lib/web_ui/lib/src/engine.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ library engine;
88

99
import 'dart:async';
1010
import 'dart:collection'
11-
show ListBase, ListQueue, IterableBase, DoubleLinkedQueue, DoubleLinkedQueueEntry;
11+
show ListBase, IterableBase, DoubleLinkedQueue, DoubleLinkedQueueEntry;
1212
import 'dart:convert' hide Codec;
1313
import 'dart:developer' as developer;
1414
import 'dart:html' as html;
@@ -56,7 +56,6 @@ part 'engine/canvaskit/util.dart';
5656
part 'engine/canvaskit/vertices.dart';
5757
part 'engine/canvaskit/viewport_metrics.dart';
5858
part 'engine/canvas_pool.dart';
59-
part 'engine/channel_buffers.dart';
6059
part 'engine/clipboard.dart';
6160
part 'engine/color_filter.dart';
6261
part 'engine/dom_canvas.dart';

lib/web_ui/lib/src/engine/channel_buffers.dart

Lines changed: 0 additions & 168 deletions
This file was deleted.

lib/web_ui/lib/src/engine/window.dart

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class EngineWindow extends ui.Window {
216216
/// Engine code should use this method instead of the callback directly.
217217
/// Otherwise zones won't work properly.
218218
void invokeOnTextScaleFactorChanged() {
219-
_invoke(_onTextScaleFactorChanged, _onTextScaleFactorChangedZone);
219+
invoke(_onTextScaleFactorChanged, _onTextScaleFactorChangedZone);
220220
}
221221

222222
@override
@@ -233,7 +233,7 @@ class EngineWindow extends ui.Window {
233233
/// Engine code should use this method instead of the callback directly.
234234
/// Otherwise zones won't work properly.
235235
void invokeOnPlatformBrightnessChanged() {
236-
_invoke(_onPlatformBrightnessChanged, _onPlatformBrightnessChangedZone);
236+
invoke(_onPlatformBrightnessChanged, _onPlatformBrightnessChangedZone);
237237
}
238238

239239
@override
@@ -250,7 +250,7 @@ class EngineWindow extends ui.Window {
250250
/// Otherwise zones won't work properly.
251251
void invokeOnMetricsChanged() {
252252
if (window._onMetricsChanged != null) {
253-
_invoke(_onMetricsChanged, _onMetricsChangedZone);
253+
invoke(_onMetricsChanged, _onMetricsChangedZone);
254254
}
255255
}
256256

@@ -321,7 +321,7 @@ class EngineWindow extends ui.Window {
321321
/// Engine code should use this method instead of the callback directly.
322322
/// Otherwise zones won't work properly.
323323
void invokeOnLocaleChanged() {
324-
_invoke(_onLocaleChanged, _onLocaleChangedZone);
324+
invoke(_onLocaleChanged, _onLocaleChangedZone);
325325
}
326326

327327
@override
@@ -337,7 +337,7 @@ class EngineWindow extends ui.Window {
337337
/// Engine code should use this method instead of the callback directly.
338338
/// Otherwise zones won't work properly.
339339
void invokeOnBeginFrame(Duration duration) {
340-
_invoke1<Duration>(_onBeginFrame, _onBeginFrameZone, duration);
340+
invoke1<Duration>(_onBeginFrame, _onBeginFrameZone, duration);
341341
}
342342

343343
@override
@@ -353,7 +353,7 @@ class EngineWindow extends ui.Window {
353353
/// Engine code should use this method instead of the callback directly.
354354
/// Otherwise zones won't work properly.
355355
void invokeOnReportTimings(List<ui.FrameTiming> timings) {
356-
_invoke1<List<ui.FrameTiming>>(
356+
invoke1<List<ui.FrameTiming>>(
357357
_onReportTimings, _onReportTimingsZone, timings);
358358
}
359359

@@ -370,7 +370,7 @@ class EngineWindow extends ui.Window {
370370
/// Engine code should use this method instead of the callback directly.
371371
/// Otherwise zones won't work properly.
372372
void invokeOnDrawFrame() {
373-
_invoke(_onDrawFrame, _onDrawFrameZone);
373+
invoke(_onDrawFrame, _onDrawFrameZone);
374374
}
375375

376376
@override
@@ -386,7 +386,7 @@ class EngineWindow extends ui.Window {
386386
/// Engine code should use this method instead of the callback directly.
387387
/// Otherwise zones won't work properly.
388388
void invokeOnPointerDataPacket(ui.PointerDataPacket packet) {
389-
_invoke1<ui.PointerDataPacket>(
389+
invoke1<ui.PointerDataPacket>(
390390
_onPointerDataPacket, _onPointerDataPacketZone, packet);
391391
}
392392

@@ -403,7 +403,7 @@ class EngineWindow extends ui.Window {
403403
/// Engine code should use this method instead of the callback directly.
404404
/// Otherwise zones won't work properly.
405405
void invokeOnSemanticsEnabledChanged() {
406-
_invoke(_onSemanticsEnabledChanged, _onSemanticsEnabledChangedZone);
406+
invoke(_onSemanticsEnabledChanged, _onSemanticsEnabledChangedZone);
407407
}
408408

409409
@override
@@ -420,7 +420,7 @@ class EngineWindow extends ui.Window {
420420
/// Otherwise zones won't work properly.
421421
void invokeOnSemanticsAction(
422422
int id, ui.SemanticsAction action, ByteData? args) {
423-
_invoke3<int, ui.SemanticsAction, ByteData?>(
423+
invoke3<int, ui.SemanticsAction, ByteData?>(
424424
_onSemanticsAction, _onSemanticsActionZone, id, action, args);
425425
}
426426

@@ -438,7 +438,7 @@ class EngineWindow extends ui.Window {
438438
/// Engine code should use this method instead of the callback directly.
439439
/// Otherwise zones won't work properly.
440440
void invokeOnAccessibilityFeaturesChanged() {
441-
_invoke(
441+
invoke(
442442
_onAccessibilityFeaturesChanged, _onAccessibilityFeaturesChangedZone);
443443
}
444444

@@ -464,20 +464,20 @@ class EngineWindow extends ui.Window {
464464
if (name == ui.ChannelBuffers.kControlChannelName) {
465465
// TODO(ianh): move this logic into ChannelBuffers once we remove onPlatformMessage
466466
try {
467-
channelBuffers.handleMessage(data!);
467+
ui.channelBuffers.handleMessage(data!);
468468
} finally {
469469
callback(null);
470470
}
471471
} else if (_onPlatformMessage != null) {
472-
_invoke3<String, ByteData?, ui.PlatformMessageResponseCallback>(
472+
invoke3<String, ByteData?, ui.PlatformMessageResponseCallback>(
473473
_onPlatformMessage,
474474
_onPlatformMessageZone,
475475
name,
476476
data,
477477
callback,
478478
);
479479
} else {
480-
channelBuffers.push(name, data, callback);
480+
ui.channelBuffers.push(name, data, callback);
481481
}
482482
}
483483

@@ -843,7 +843,7 @@ bool _handleWebTestEnd2EndMessage(MethodCodec codec, ByteData? data) {
843843
}
844844

845845
/// Invokes [callback] inside the given [zone].
846-
void _invoke(void callback()?, Zone? zone) {
846+
void invoke(void callback()?, Zone? zone) {
847847
if (callback == null) {
848848
return;
849849
}
@@ -858,7 +858,7 @@ void _invoke(void callback()?, Zone? zone) {
858858
}
859859

860860
/// Invokes [callback] inside the given [zone] passing it [arg].
861-
void _invoke1<A>(void callback(A a)?, Zone? zone, A arg) {
861+
void invoke1<A>(void callback(A a)?, Zone? zone, A arg) {
862862
if (callback == null) {
863863
return;
864864
}
@@ -873,7 +873,7 @@ void _invoke1<A>(void callback(A a)?, Zone? zone, A arg) {
873873
}
874874

875875
/// Invokes [callback] inside the given [zone] passing it [arg1] and [arg2].
876-
void _invoke2<A1, A2>(
876+
void invoke2<A1, A2>(
877877
void callback(A1 a1, A2 a2)?, Zone? zone, A1 arg1, A2 arg2) {
878878
if (callback == null) {
879879
return;
@@ -891,7 +891,7 @@ void _invoke2<A1, A2>(
891891
}
892892

893893
/// Invokes [callback] inside the given [zone] passing it [arg1], [arg2], and [arg3].
894-
void _invoke3<A1, A2, A3>(void callback(A1 a1, A2 a2, A3 a3)?, Zone? zone,
894+
void invoke3<A1, A2, A3>(void callback(A1 a1, A2 a2, A3 a3)?, Zone? zone,
895895
A1 arg1, A2 arg2, A3 arg3) {
896896
if (callback == null) {
897897
return;

0 commit comments

Comments
 (0)