Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Issue 14065006: Add support for typed data views on native threads (Closed)

Created:
7 years, 8 months ago by Søren Gjesse
Modified:
7 years, 8 months ago
CC:
reviews_dartlang.org, siva
Visibility:
Public.

Description

Add support for typed data views on native threads The deserializer running outside the VM can now decode typed data views. As the typed data views are implemented as normal Dart instances and not a internal VM object the deserializer have been expanded to process serialized objects of the type used to create these views. The typed data object that the view is based on will always be serialized as part of the message. Currently only vews created with constructor Uint8List.view on top of an Uint8List are supported. R=ager@google.com BUG=https://code.google.com/p/dart/issues/detail?id=9484 Committed: https://code.google.com/p/dart/source/detail?r=21252

Patch Set 1 #

Total comments: 4

Patch Set 2 : Addressed review commetns #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+201 lines, -14 lines) Patch
M runtime/vm/dart_api_message.h View 1 2 chunks +20 lines, -2 lines 0 comments Download
M runtime/vm/dart_api_message.cc View 4 chunks +79 lines, -5 lines 6 comments Download
M runtime/vm/snapshot_test.cc View 8 chunks +60 lines, -7 lines 0 comments Download
A tests/standalone/io/file_typed_data_test.dart View 1 1 chunk +42 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Søren Gjesse
7 years, 8 months ago (2013-04-10 14:48:15 UTC) #1
Mads Ager (google)
LGTM https://codereview.chromium.org/14065006/diff/1/runtime/vm/dart_api_message.h File runtime/vm/dart_api_message.h (right): https://codereview.chromium.org/14065006/diff/1/runtime/vm/dart_api_message.h#newcode17 runtime/vm/dart_api_message.h:17: // TODO(sjesse): Remove this when message serialization format ...
7 years, 8 months ago (2013-04-11 05:57:04 UTC) #2
Søren Gjesse
https://codereview.chromium.org/14065006/diff/1/runtime/vm/dart_api_message.h File runtime/vm/dart_api_message.h (right): https://codereview.chromium.org/14065006/diff/1/runtime/vm/dart_api_message.h#newcode17 runtime/vm/dart_api_message.h:17: // TODO(sjesse): Remove this when message serialization format is ...
7 years, 8 months ago (2013-04-11 06:47:27 UTC) #3
Søren Gjesse
Committed patchset #2 manually as r21252.
7 years, 8 months ago (2013-04-11 07:15:20 UTC) #4
siva
https://codereview.chromium.org/14065006/diff/6001/runtime/vm/dart_api_message.cc File runtime/vm/dart_api_message.cc (right): https://codereview.chromium.org/14065006/diff/6001/runtime/vm/dart_api_message.cc#newcode225 runtime/vm/dart_api_message.cc:225: strncmp("_Uint8ArrayView", class_name, 15) == 0) { This seems rather ...
7 years, 8 months ago (2013-04-15 20:17:47 UTC) #5
siva
https://codereview.chromium.org/14065006/diff/6001/runtime/vm/dart_api_message.cc File runtime/vm/dart_api_message.cc (right): https://codereview.chromium.org/14065006/diff/6001/runtime/vm/dart_api_message.cc#newcode239 runtime/vm/dart_api_message.cc:239: // Now turn the view into a byte array. ...
7 years, 8 months ago (2013-04-15 20:26:30 UTC) #6
Søren Gjesse
https://codereview.chromium.org/14065006/diff/6001/runtime/vm/dart_api_message.cc File runtime/vm/dart_api_message.cc (right): https://codereview.chromium.org/14065006/diff/6001/runtime/vm/dart_api_message.cc#newcode225 runtime/vm/dart_api_message.cc:225: strncmp("_Uint8ArrayView", class_name, 15) == 0) { On 2013/04/15 20:17:47, ...
7 years, 8 months ago (2013-04-17 12:54:58 UTC) #7
siva
7 years, 8 months ago (2013-04-18 02:30:40 UTC) #8
Message was sent while issue was closed.
https://codereview.chromium.org/14065006/diff/6001/runtime/vm/dart_api_messag...
File runtime/vm/dart_api_message.cc (right):

https://codereview.chromium.org/14065006/diff/6001/runtime/vm/dart_api_messag...
runtime/vm/dart_api_message.cc:225: strncmp("_Uint8ArrayView", class_name, 15)
== 0) {
Yes these predefined Cid's are already assigned to these instances (look for the
macro REGISTER_TYPED_DATA_VIEW_CLASS in object.cc).

On 2013/04/17 12:54:58, Søren Gjesse wrote:
> On 2013/04/15 20:17:47, siva wrote:
> > This seems rather inefficient having to do a strcmp to identify the class id
> > every time.
> > I am wondering if we should change the writing of TypedData View objects in
> the
> > snapshot to be similar to regular TypedData objects (i.e explicitly write
out
> > the class id etc.)
> > 
> > That way reading it back will also be easy.
> 
> That would be a great idea. I added this way of processing a Dart instance as
a
> temporary solution. There are already specific Cid's for these classes
> (kTypedDataUint8ArrayViewCid etc.) - are these already assigned to these
> instances?

https://codereview.chromium.org/14065006/diff/6001/runtime/vm/dart_api_messag...
runtime/vm/dart_api_message.cc:239: // Now turn the view into a byte array.
On 2013/04/17 12:54:58, Søren Gjesse wrote:
> On 2013/04/15 20:26:30, siva wrote:
> > Another issue that might need addressing :
> > 
> > if we send an array of typed data view objects and all these typed data view
> > objects are views to the same typed data object then this scheme of
converting
> > the view to a typed data may not quite work.
> 
> Why is that? The view will just point to the underlying deserialized data.
Some
> of the tests added in  https://codereview.chromium.org/14200031 should show
> this.

True it would point to the underlying deserialized data but we have now
converted it into a kUint8Array which means it is a regular byte array and
should not share the data with the other view objects which were also converted
into kUint8Array types.

Maybe I am not quite understanding why you need to change the type to
kUint8Array instead of just leaving it as a kView.

Powered by Google App Engine
This is Rietveld 408576698