Changeset 223279 in webkit
- Timestamp:
- Oct 13, 2017 2:22:48 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r223273 r223279 1 2017-10-13 Romain Bellessort <romain.bellessort@crf.canon.fr> 2 3 [Readable Streams API] Align queue with spec for ReadableStreamDefaultController 4 https://bugs.webkit.org/show_bug.cgi?id=178082 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 Updated test expectations for tests that were previously failing but now pass. 9 10 * web-platform-tests/streams/readable-streams/floating-point-total-queue-size-expected.txt: 11 * web-platform-tests/streams/readable-streams/floating-point-total-queue-size.dedicatedworker-expected.txt: 12 1 13 2017-10-12 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/floating-point-total-queue-size-expected.txt
r213882 r223279 1 1 2 FAIL Floating point arithmetic must manifest near NUMBER.MAX_SAFE_INTEGER (total ends up positive) assert_equals: [[queueTotalSize]] must clamp to 0 if it becomes negative expected 0 but got 1 3 FAIL Floating point arithmetic must manifest near 0 (total ends up positive, but clamped) assert_equals: [[queueTotalSize]] must clamp to 0 if it becomes negative expected 0 but got 1.1102230246251565e-16 2 PASS Floating point arithmetic must manifest near NUMBER.MAX_SAFE_INTEGER (total ends up positive) 3 PASS Floating point arithmetic must manifest near 0 (total ends up positive, but clamped) 4 4 PASS Floating point arithmetic must manifest near 0 (total ends up positive, and not clamped) 5 5 PASS Floating point arithmetic must manifest near 0 (total ends up zero) -
trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/floating-point-total-queue-size.dedicatedworker-expected.txt
r217225 r223279 1 1 2 FAIL Floating point arithmetic must manifest near NUMBER.MAX_SAFE_INTEGER (total ends up positive) assert_equals: [[queueTotalSize]] must clamp to 0 if it becomes negative expected 0 but got 1 3 FAIL Floating point arithmetic must manifest near 0 (total ends up positive, but clamped) assert_equals: [[queueTotalSize]] must clamp to 0 if it becomes negative expected 0 but got 1.1102230246251565e-16 2 PASS Floating point arithmetic must manifest near NUMBER.MAX_SAFE_INTEGER (total ends up positive) 3 PASS Floating point arithmetic must manifest near 0 (total ends up positive, but clamped) 4 4 PASS Floating point arithmetic must manifest near 0 (total ends up positive, and not clamped) 5 5 PASS Floating point arithmetic must manifest near 0 (total ends up zero) -
trunk/Source/WebCore/ChangeLog
r223278 r223279 1 2017-10-13 Romain Bellessort <romain.bellessort@crf.canon.fr> 2 3 [Readable Streams API] Align queue with spec for ReadableStreamDefaultController 4 https://bugs.webkit.org/show_bug.cgi?id=178082 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 Implemented new queue behavior for dequeueValue (used by ReadableStreamDefaultController), 9 which fixes rounding errors (as described in https://github.com/whatwg/streams/pull/661). 10 Also aligned ReadableByteStreamController queue so that both queues are implemented in 11 the same way. 12 13 No new tests (covered by existing tests, especially WPT tests that now pass). 14 15 * Modules/streams/ReadableByteStreamInternals.js: 16 (privateInitializeReadableByteStreamController): Aligned queue with RSDC. 17 (readableByteStreamControllerCancel): Aligned queue with RSDC. 18 (readableByteStreamControllerError): Aligned queue with RSDC. 19 (readableByteStreamControllerClose): Aligned queue with RSDC. 20 (readableByteStreamControllerHandleQueueDrain): Aligned queue with RSDC. 21 (readableByteStreamControllerPull): Aligned queue with RSDC. 22 (readableByteStreamControllerEnqueue): Aligned queue with RSDC. 23 (readableByteStreamControllerEnqueueChunk): Aligned queue with RSDC. 24 (readableByteStreamControllerProcessPullDescriptors): Aligned queue with RSDC. 25 (readableByteStreamControllerFillDescriptorFromQueue): Aligned queue with RSDC. 26 (readableByteStreamControllerPullInto): Aligned queue with RSDC. 27 * Modules/streams/StreamInternals.js: 28 (dequeueValue): Updated to match spec. 29 * bindings/js/WebCoreBuiltinNames.h: Removed now useless "totalQueuedBytes". 30 1 31 2017-10-13 Wenson Hsieh <wenson_hsieh@apple.com> 2 32 -
trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js
r220566 r223279 60 60 this.@pulling = false; 61 61 @readableByteStreamControllerClearPendingPullIntos(this); 62 this.@queue = []; 63 this.@totalQueuedBytes = 0; 62 this.@queue = @newQueue(); 64 63 this.@started = false; 65 64 this.@closeRequested = false; … … 138 137 if (controller.@pendingPullIntos.length > 0) 139 138 controller.@pendingPullIntos[0].bytesFilled = 0; 140 controller.@queue = []; 141 controller.@totalQueuedBytes = 0; 139 controller.@queue = @newQueue(); 142 140 return @promiseInvokeOrNoop(controller.@underlyingByteSource, "cancel", [reason]); 143 141 } … … 149 147 @assert(controller.@controlledReadableStream.@state === @streamReadable); 150 148 @readableByteStreamControllerClearPendingPullIntos(controller); 151 controller.@queue = [];149 controller.@queue = @newQueue(); 152 150 @readableStreamError(controller.@controlledReadableStream, e); 153 151 } … … 160 158 @assert(controller.@controlledReadableStream.@state === @streamReadable); 161 159 162 if (controller.@ totalQueuedBytes> 0) {160 if (controller.@queue.size > 0) { 163 161 controller.@closeRequested = true; 164 162 return; … … 195 193 return 0; 196 194 197 return controller.@strategyHWM - controller.@ totalQueuedBytes;195 return controller.@strategyHWM - controller.@queue.size; 198 196 } 199 197 … … 217 215 218 216 @assert(controller.@controlledReadableStream.@state === @streamReadable); 219 if (!controller.@ totalQueuedBytes&& controller.@closeRequested)217 if (!controller.@queue.size && controller.@closeRequested) 220 218 @readableStreamClose(controller.@controlledReadableStream); 221 219 else … … 230 228 @assert(@readableStreamHasDefaultReader(stream)); 231 229 232 if (controller.@ totalQueuedBytes> 0) {230 if (controller.@queue.size > 0) { 233 231 @assert(stream.@reader.@readRequests.length === 0); 234 const entry = controller.@queue. @shift();235 controller.@ totalQueuedBytes-= entry.byteLength;232 const entry = controller.@queue.content.@shift(); 233 controller.@queue.size -= entry.byteLength; 236 234 @readableByteStreamControllerHandleQueueDrain(controller); 237 235 let view; … … 342 340 @readableByteStreamControllerEnqueueChunk(controller, transferredBuffer, byteOffset, byteLength); 343 341 else { 344 @assert(!controller.@queue. length);342 @assert(!controller.@queue.content.length); 345 343 let transferredView = new @Uint8Array(transferredBuffer, byteOffset, byteLength); 346 344 @readableStreamFulfillReadRequest(stream, transferredView, false); … … 364 362 "use strict"; 365 363 366 controller.@queue. @push({364 controller.@queue.content.@push({ 367 365 buffer: buffer, 368 366 byteOffset: byteOffset, 369 367 byteLength: byteLength 370 368 }); 371 controller.@ totalQueuedBytes+= byteLength;369 controller.@queue.size += byteLength; 372 370 } 373 371 … … 472 470 @assert(!controller.@closeRequested); 473 471 while (controller.@pendingPullIntos.length > 0) { 474 if (controller.@ totalQueuedBytes=== 0)472 if (controller.@queue.size === 0) 475 473 return; 476 474 let pullIntoDescriptor = controller.@pendingPullIntos[0]; … … 488 486 489 487 const currentAlignedBytes = pullIntoDescriptor.bytesFilled - (pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize); 490 const maxBytesToCopy = controller.@ totalQueuedBytes< pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled ?491 controller.@ totalQueuedBytes: pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled;488 const maxBytesToCopy = controller.@queue.size < pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled ? 489 controller.@queue.size : pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled; 492 490 const maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy; 493 491 const maxAlignedBytes = maxBytesFilled - (maxBytesFilled % pullIntoDescriptor.elementSize); … … 501 499 502 500 while (totalBytesToCopyRemaining > 0) { 503 let headOfQueue = controller.@queue [0];501 let headOfQueue = controller.@queue.content[0]; 504 502 const bytesToCopy = totalBytesToCopyRemaining < headOfQueue.byteLength ? totalBytesToCopyRemaining : headOfQueue.byteLength; 505 503 // Copy appropriate part of pullIntoDescriptor.buffer to headOfQueue.buffer. … … 517 515 518 516 if (headOfQueue.byteLength === bytesToCopy) 519 controller.@queue. @shift();517 controller.@queue.content.@shift(); 520 518 else { 521 519 headOfQueue.byteOffset += bytesToCopy; … … 523 521 } 524 522 525 controller.@ totalQueuedBytes-= bytesToCopy;523 controller.@queue.size -= bytesToCopy; 526 524 @assert(controller.@pendingPullIntos.length === 0 || controller.@pendingPullIntos[0] === pullIntoDescriptor); 527 525 @readableByteStreamControllerInvalidateBYOBRequest(controller); … … 531 529 532 530 if (!ready) { 533 @assert(controller.@ totalQueuedBytes=== 0);531 @assert(controller.@queue.size === 0); 534 532 @assert(pullIntoDescriptor.bytesFilled > 0); 535 533 @assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize); … … 660 658 } 661 659 662 if (controller.@ totalQueuedBytes> 0) {660 if (controller.@queue.size > 0) { 663 661 if (@readableByteStreamControllerFillDescriptorFromQueue(controller, pullIntoDescriptor)) { 664 662 const filledView = @readableByteStreamControllerConvertDescriptor(pullIntoDescriptor); -
trunk/Source/WebCore/Modules/streams/StreamInternals.js
r220566 r223279 106 106 const record = queue.content.@shift(); 107 107 queue.size -= record.size; 108 // As described by spec, below case may occur due to rounding errors. 109 if (queue.size < 0) 110 queue.size = 0; 108 111 return record.value; 109 112 } -
trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h
r221966 r223279 267 267 macro(structuredCloneArrayBufferView) \ 268 268 macro(top) \ 269 macro(totalQueuedBytes) \270 269 macro(underlyingByteSource) \ 271 270 macro(underlyingSink) \
Note: See TracChangeset
for help on using the changeset viewer.