Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRemove slice_to_array_buffer_view and update_array_buffer_view #15427
Conversation
highfive
commented
Feb 7, 2017
|
Heads up! This PR modifies the following files:
|
highfive
commented
Feb 7, 2017
| let _ = TypedArray::<Float32>::create(global.get_cx(), matrix.len() as u32, Some(&matrix), | ||
| MutableHandleObject::from_marked_location(framedata.right_proj.get_unsafe())); | ||
| let _ = TypedArray::<Float32>::create(global.get_cx(), matrix.len() as u32, Some(&matrix), | ||
| MutableHandleObject::from_marked_location(framedata.right_view.get_unsafe())); |
This comment has been minimized.
This comment has been minimized.
jdm
Feb 7, 2017
Member
We should add a handle_mut() method to Heap instead of using from_marked_location everywhere.
This comment has been minimized.
This comment has been minimized.
yysung1123
Feb 7, 2017
Author
Contributor
Yes, the code is too long.
I can add handle_mut() and fix the code in this PR.
3085939
to
d58082c
|
Change all |
|
Looks good! I just have some stylistic comments to make it easier to read. |
| @@ -39,7 +39,8 @@ impl VREyeParameters { | |||
| }; | |||
|
|
|||
| unsafe { | |||
| result.offset.set(slice_to_array_buffer_view(global.get_cx(), &result.parameters.borrow().offset)); | |||
| let _ = TypedArray::<Float32>::create(global.get_cx(), result.parameters.borrow().offset.len() as u32, | |||
| Some(&result.parameters.borrow().offset), result.offset.handle_mut()); | |||
This comment has been minimized.
This comment has been minimized.
jdm
Feb 9, 2017
Member
Let format this like:
let _ = Float32Array::create(global.get_cx(),
result.parameters.borrow().offset.len() as u32,
Some(&result.parameters.borrow().offset),
result.offset.handle_mut());| let _ = TypedArray::<Float32>::create(global.get_cx(), matrix.len() as u32, Some(&matrix), | ||
| framedata.right_proj.handle_mut()); | ||
| let _ = TypedArray::<Float32>::create(global.get_cx(), matrix.len() as u32, Some(&matrix), | ||
| framedata.right_view.handle_mut()); |
This comment has been minimized.
This comment has been minimized.
jdm
Feb 9, 2017
Member
nit: use Float32Array::create and indent the second line to match global.get_cx().
| @@ -33,9 +33,13 @@ unsafe fn update_or_create_typed_array(cx: *mut JSContext, | |||
| match src { | |||
| Some(ref data) => { | |||
| if dst.get().is_null() { | |||
| dst.set(slice_to_array_buffer_view(cx, &data)); | |||
| let _ = TypedArray::<Float32>::create(cx, data.len() as u32, src, | |||
| dst.handle_mut()); | |||
This comment has been minimized.
This comment has been minimized.
| let _ = TypedArray::<Float32>::create(global.get_cx(), | ||
| stage.parameters.borrow().sitting_to_standing_transform.len() as u32, | ||
| Some(&stage.parameters.borrow().sitting_to_standing_transform), | ||
| stage.transform.handle_mut()); |
This comment has been minimized.
This comment has been minimized.
|
Fixed changes requested. |
|
Sorry, one last issue that I noticed. |
| let _ = Float32Array::create(global.get_cx(), matrix.len() as u32, Some(&matrix), | ||
| framedata.right_proj.handle_mut()); | ||
| let _ = Float32Array::create(global.get_cx(), matrix.len() as u32, Some(&matrix), | ||
| framedata.right_view.handle_mut()); |
This comment has been minimized.
This comment has been minimized.
jdm
Feb 10, 2017
Member
This is a GC hazard right now - the GC does not know about framedata yet, so if any of the Float32Array::create calls trigger a GC, the existing typed arrays will be GCed and framedata will store invalid pointers. We should call reflect_dom_object first before creating the arrays.
|
@bors-servo: r+ |
|
|
Remove slice_to_array_buffer_view and update_array_buffer_view <!-- Please describe your changes on the following line: --> Remove slice_to_array_buffer_view and update_array_buffer_view --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #15350 - [X] These changes do not require tests <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15427) <!-- Reviewable:end -->
|
|
yysung1123 commentedFeb 7, 2017
•
edited by larsbergstrom
Remove slice_to_array_buffer_view and update_array_buffer_view
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is