mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:51:18 +00:00
1a6d1eca32
Allow members of patch classes to be annotated with @patch. The VM ignores the annotation. I simply replaces the original method if the name matches, or reports an error if field names match. Adding a bit is_patched to members to do more checking remains a TODO. There are currently no unused bits available, and I don’t want to increase the size of Function objects for this. BUG= R=asiva@google.com Review URL: https://codereview.chromium.org/2230383003 .
39 lines
1.6 KiB
Dart
39 lines
1.6 KiB
Dart
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
@patch class Asset {
|
|
/// Call to request assets from the embedder.
|
|
@patch static HashMap<String, Asset> request() {
|
|
HashMap<String, Asset> assets = new HashMap<String, Asset>();
|
|
Uint8List tarBytes = _requestAssets();
|
|
if (tarBytes == null) {
|
|
return assets;
|
|
}
|
|
List assetList = _decodeAssets(tarBytes);
|
|
for (int i = 0; i < assetList.length; i += 2) {
|
|
var a = new Asset(assetList[i], assetList[i + 1]);
|
|
assets[a.name] = a;
|
|
}
|
|
return assets;
|
|
}
|
|
}
|
|
|
|
List _decodeAssets(Uint8List data) native "VMService_DecodeAssets";
|
|
|
|
@patch bool sendIsolateServiceMessage(SendPort sp, List m)
|
|
native "VMService_SendIsolateServiceMessage";
|
|
@patch void sendRootServiceMessage(List m)
|
|
native "VMService_SendRootServiceMessage";
|
|
@patch void sendObjectRootServiceMessage(List m)
|
|
native "VMService_SendObjectRootServiceMessage";
|
|
@patch void _onStart() native "VMService_OnStart";
|
|
@patch void _onExit() native "VMService_OnExit";
|
|
@patch void onServerAddressChange(String address)
|
|
native "VMService_OnServerAddressChange";
|
|
@patch bool _vmListenStream(String streamId) native "VMService_ListenStream";
|
|
@patch void _vmCancelStream(String streamId) native "VMService_CancelStream";
|
|
@patch Uint8List _requestAssets() native "VMService_RequestAssets";
|
|
@patch void _spawnUriNotify(obj, String token)
|
|
native "VMService_spawnUriNotify";
|