Skip to content

Commit

Permalink
Roll dart to 0116766 (flutter#5146)
Browse files Browse the repository at this point in the history
* Roll Dart to 0116766.

Reverts b6be937 and uses Dart_NewExternalTypedDataWithFinalizer.

* update license goldens
  • Loading branch information
yjbanov authored May 2, 2018
1 parent beb988c commit d5c1117
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 29 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ vars = {
# Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS.
# You can use //tools/dart/create_updated_flutter_deps.py to produce
# updated revision list of existing dependencies.
'dart_revision': '0cc70c4a7c448078dd2aea8e45c56bc50fbbb31c',
'dart_revision': '011676641a8b4b77bb372384c712709cbf037675',

'dart_args_tag': '1.4.1',
'dart_async_tag': '2.0.6',
Expand Down
12 changes: 4 additions & 8 deletions lib/ui/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ typedef void SemanticsActionCallback(int id, SemanticsAction action, ByteData ar
/// [Window.onPlatformMessage].
typedef void PlatformMessageResponseCallback(ByteData data);

// The engine returns message responses as a Uint8List which is then wrapped
// in a ByteData.
typedef void _InternalPlatformMessageResponseCallback(Uint8List data);

/// Signature for [Window.onPlatformMessage].
typedef void PlatformMessageCallback(String name, ByteData data, PlatformMessageResponseCallback callback);

Expand Down Expand Up @@ -691,7 +687,7 @@ class Window {
throw new Exception(error);
}
String _sendPlatformMessage(String name,
_InternalPlatformMessageResponseCallback callback,
PlatformMessageResponseCallback callback,
ByteData data) native 'Window_sendPlatformMessage';

/// Called whenever this window receives a message from a platform-specific
Expand Down Expand Up @@ -721,15 +717,15 @@ class Window {

/// Wraps the given [callback] in another callback that ensures that the
/// original callback is called in the zone it was registered in.
static _InternalPlatformMessageResponseCallback _zonedPlatformMessageResponseCallback(PlatformMessageResponseCallback callback) {
static PlatformMessageResponseCallback _zonedPlatformMessageResponseCallback(PlatformMessageResponseCallback callback) {
if (callback == null)
return null;

// Store the zone in which the callback is being registered.
final Zone registrationZone = Zone.current;

return (Uint8List data) {
registrationZone.runUnaryGuarded(callback, data?.buffer?.asByteData());
return (ByteData data) {
registrationZone.runUnaryGuarded(callback, data);
};
}
}
Expand Down
9 changes: 4 additions & 5 deletions lib/ui/window/platform_message_response_dart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ void MessageDataFinalizer(void* isolate_callback_data,

Dart_Handle WrapByteData(std::vector<uint8_t> data) {
if (data.size() < kMessageCopyThreshold) {
return ToTypedData(Dart_TypedData_kUint8, data);
return ToByteData(data);
} else {
std::vector<uint8_t>* heap_data = new std::vector<uint8_t>(std::move(data));
Dart_Handle data_handle = Dart_NewExternalTypedData(
Dart_TypedData_kUint8, heap_data->data(), heap_data->size());
Dart_Handle data_handle = Dart_NewExternalTypedDataWithFinalizer(
Dart_TypedData_kByteData, heap_data->data(), heap_data->size(),
heap_data, heap_data->size(), MessageDataFinalizer);
DART_CHECK_VALID(data_handle);
Dart_NewWeakPersistentHandle(data_handle, heap_data, heap_data->size(),
MessageDataFinalizer);
return data_handle;
}
}
Expand Down
12 changes: 2 additions & 10 deletions lib/ui/window/window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,8 @@ void _RespondToPlatformMessage(Dart_NativeArguments args) {
} // namespace

Dart_Handle ToByteData(const std::vector<uint8_t>& buffer) {
return ToTypedData(Dart_TypedData_kByteData, buffer);
}

Dart_Handle ToTypedData(Dart_TypedData_Type data_type,
const std::vector<uint8_t>& buffer) {
FXL_DCHECK(data_type == Dart_TypedData_kByteData ||
data_type == Dart_TypedData_kInt8 ||
data_type == Dart_TypedData_kUint8);

Dart_Handle data_handle = Dart_NewTypedData(data_type, buffer.size());
Dart_Handle data_handle =
Dart_NewTypedData(Dart_TypedData_kByteData, buffer.size());
if (Dart_IsError(data_handle))
return data_handle;

Expand Down
3 changes: 0 additions & 3 deletions lib/ui/window/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ class Scene;

Dart_Handle ToByteData(const std::vector<uint8_t>& buffer);

Dart_Handle ToTypedData(Dart_TypedData_Type data_type,
const std::vector<uint8_t>& buffer);

class WindowClient {
public:
virtual std::string DefaultRouteName() = 0;
Expand Down
2 changes: 1 addition & 1 deletion tools/licenses/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ packages:
source: hosted
version: "1.1.5"
sdks:
dart: ">=1.21.0 <=2.0.0-edge.c080951d45e79cd25df98036c4be835b284a269c"
dart: ">=1.21.0 <=2.0.0-dev.50.0"
2 changes: 1 addition & 1 deletion travis/licenses_golden/licenses_third_party
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Signature: d817d994a56938d75e1cb5ace14dc096
Signature: 9c979e243a76318a53f18a79498ab23f

UNUSED LICENSES:

Expand Down

0 comments on commit d5c1117

Please sign in to comment.