Add 'ext.ui.window.scheduleFrame' service protocol extension (flutter/engine#3030)

This commit is contained in:
John McCutchan
2016-09-14 11:32:57 -07:00
committed by GitHub
parent 1ac1e37f63
commit 4ea908ee09
2 changed files with 21 additions and 0 deletions

View File

@@ -13,10 +13,28 @@ class _Logger {
static void _printString(String s) native "Logger_PrintString";
}
// A service protocol extension to schedule a frame to be rendered into the
// window.
Future<developer.ServiceExtensionResponse> _scheduleFrame(
String method,
Map<String, String> parameters
) async {
// Schedule the frame.
window.scheduleFrame();
// Always succeed.
return new developer.ServiceExtensionResponse.result(JSON.encode({
'type': 'Success',
}));
}
void _setupHooks() {
// Wire up timer implementation that is driven by MojoHandleWatcher.
VMLibraryHooks.eventHandlerSendData = MojoHandleWatcher.timer;
VMLibraryHooks.timerMillisecondClock = MojoCoreNatives.timerMillisecondClock;
assert(() {
// In debug mode, register the schedule frame extension.
developer.registerExtension('ext.ui.window.scheduleFrame', _scheduleFrame);
});
}
void _scheduleMicrotask(void callback()) native "ScheduleMicrotask";

View File

@@ -14,6 +14,9 @@
library dart_ui;
import 'dart:_internal';
import 'dart:async';
import 'dart:convert';
import 'dart:developer' as developer;
import 'dart:math' as math;
import 'dart:mojo.internal';
import 'dart:nativewrappers';