Lines Matching refs:state
137 for(k in state.opIds){
155 for(k in state.opIds){
230 const state = Object.create(null);
231 state.verbose = options.verbose;
232 state.littleEndian = (()=>{
251 state.asyncS11nExceptions = 1;
254 state.fileBufferSize = 1024 * 64;
255 state.sabS11nOffset = state.fileBufferSize;
262 state.sabS11nSize = opfsVfs.$mxPathname * 2;
267 state.sabIO = new SharedArrayBuffer(
268 state.fileBufferSize/* file i/o block */
269 + state.sabS11nSize/* argument/result serialization block */
271 state.opIds = Object.create(null);
279 state.opIds.whichOp = i++;
282 state.opIds.rc = i++;
287 state.opIds.xAccess = i++;
288 state.opIds.xClose = i++;
289 state.opIds.xDelete = i++;
290 state.opIds.xDeleteNoWait = i++;
291 state.opIds.xFileControl = i++;
292 state.opIds.xFileSize = i++;
293 state.opIds.xLock = i++;
294 state.opIds.xOpen = i++;
295 state.opIds.xRead = i++;
296 state.opIds.xSleep = i++;
297 state.opIds.xSync = i++;
298 state.opIds.xTruncate = i++;
299 state.opIds.xUnlock = i++;
300 state.opIds.xWrite = i++;
301 state.opIds.mkdir = i++;
302 state.opIds['opfs-async-metrics'] = i++;
303 state.opIds['opfs-async-shutdown'] = i++;
307 state.opIds.retry = i++;
308 state.sabOP = new SharedArrayBuffer(
317 state.sq3Codes = Object.create(null);
344 if(undefined === (state.sq3Codes[k] = capi[k])){
357 const opNdx = state.opIds[op] || toss("Invalid op ID:",op);
358 state.s11n.serialize(...args);
359 Atomics.store(state.sabOPView, state.opIds.rc, -1);
360 Atomics.store(state.sabOPView, state.opIds.whichOp, opNdx);
361 Atomics.notify(state.sabOPView, state.opIds.whichOp)
364 Atomics.wait(state.sabOPView, state.opIds.rc, -1)
367 const rc = Atomics.load(state.sabOPView, state.opIds.rc);
369 if(rc && state.asyncS11nExceptions){
370 const err = state.s11n.deserialize();
438 if(state.s11n) return state.s11n;
441 viewU8 = new Uint8Array(state.sabIO, state.sabS11nOffset, state.sabS11nSize),
442 viewDV = new DataView(state.sabIO, state.sabS11nOffset, state.sabS11nSize);
443 state.s11n = Object.create(null);
474 state.s11n.deserialize = function(clear=false){
488 v = viewDV[t.getter](offset, state.littleEndian);
491 n = viewDV.getInt32(offset, state.littleEndian);
517 state.s11n.serialize = function(...args){
536 viewDV[t.setter](offset, args[i], state.littleEndian);
540 viewDV.setInt32(offset, s.byteLength, state.littleEndian);
552 return state.s11n;
710 const sz = state.s11n.deserialize()[0];
846 fh.sab = new SharedArrayBuffer(state.fileBufferSize);
856 fh.sabView = state.sabFileBufView;
884 Atomics.wait(state.sabOPView, state.opIds.xSleep, 0, ms);
1185 state.s11n.serialize("This is ä string.");
1186 rc = state.s11n.deserialize();
1195 state.sabOPView[state.opIds.xOpen]);
1225 log("xClose rc =",rc,"sabOPView =",state.sabOPView);
1244 W.postMessage({type: 'opfs-async-init',args: state});
1259 state.sabOPView = new Int32Array(state.sabOP);
1260 state.sabFileBufView = new Uint8Array(state.sabIO, 0, state.fileBufferSize);
1261 … state.sabS11nView = new Uint8Array(state.sabIO, state.sabS11nOffset, state.sabS11nSize);