Closed Bug 1624726 Opened 4 years ago Closed 4 years ago

Refactor of WebGL remoting classes

Categories

(Core :: Graphics: CanvasWebGL, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: handyman, Assigned: handyman)

References

Details

Attachments

(6 files)

Clean up some ugliness. E.g.:

  • PcqParamTraits (aka QueueParamTraits) API refactor. Turn (from PcqParamTraits<WebGLActiveInfo>):
  static PcqStatus Read(ConsumerView& aConsumerView, ParamType* aArg) {
    aConsumerView.ReadParam(aArg ? &aArg->mElemCount : nullptr);
    aConsumerView.ReadParam(aArg ? &aArg->mElemType : nullptr);
    aConsumerView.ReadParam(aArg ? &aArg->mBaseUserName : nullptr);
    aConsumerView.ReadParam(aArg ? &aArg->mIsArray : nullptr);
    aConsumerView.ReadParam(aArg ? &aArg->mElemSize : nullptr);
    aConsumerView.ReadParam(aArg ? &aArg->mBaseMappedName : nullptr);
    return aConsumerView.ReadParam(aArg ? &aArg->mBaseType : nullptr);
  }

into

  static PcqStatus Read(ConsumerView& aConsumerView, ParamType* aArg) {
    return aConsumerView.ReadParam(aArg,
        &ParamType::mElemCount, &ParamType::mElemType,
        &ParamType::mBaseUserName, &ParamType::mIsArray,
        &ParamType::mElemSize, &ParamType::mBaseMappedName, 
        &ParamType::mBaseType);
  }

or go even further and macro-tize the whole class specialization (including Read, Write and MinSize) so we can write the entire PcqParamTraits<WebGLActiveInfo> impl as e.g.:

BASIC_QUEUE_PARAM_TRAITS(WebGLActiveInfo,
    mElemCount, mElemType, mBaseUserName, mIsArray, mElemSize, mBaseMappedName, mBaseType)
  • Remove peeking from ProducerConsumerQueue.
  • Use folds in ProducerConsumerQueue.
  • Remove unused TypeInfo stuff from ProducerConsumerQueue.
  • (Maybe) change IpdlQueue to send Shmems with ExchangeIpdlQueueData.

and so on.

Blocks: 1607940
Priority: P2 → P1

Type checking these queues turned out not to be useful. It added tokens to the stream that validated the type of the data in the stream against the type of the objects that it would deserialize into. However, the IPC mechanism is already completely type safe at the source code level so it was not useful in debugging.

Removing dead code, cleaning up comments, etc.

Depends on D78539

EnumSerializers allow for easy enum validation in deserialization. The implementation is taken from IPDL's EnumSerializers and uses the IPDL EnumValidator classes and is used in exactly the same way.

Depends on D78540

Peeking or pulling entries from the queue without deserializing them into an object requires making QueueParamTraits more complex. We don't currently need the functionality; the added complexity isn't worth it.

Depends on D78541

Since we are no longer peeking or removing without copying, MinSize always gets a valid object. This converts its parameter to a reference and removes extraneous null checks.

Depends on D78542

Since we are no longer peeking or removing without copying, Read always gets a valid object. This makes its parameter a reference and removes extraneous null checks.

Depends on D78543

Pushed by daparks@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cb87087c351f
Part 1 - Remove argument type checking in WebGL remoting r=jgilbert
https://hg.mozilla.org/integration/autoland/rev/d03da841a4b7
Part 2 - Clean up some WebGL QueueParamTraits code r=jgilbert
https://hg.mozilla.org/integration/autoland/rev/63837251d2bb
Part 3 - Add EnumSerializers for WebGL QueueParamTraits r=jgilbert
https://hg.mozilla.org/integration/autoland/rev/d2157c578ddd
Part 4 - Remove peeking and no-copy remove methods from ProducerConsumerQueue r=jgilbert
https://hg.mozilla.org/integration/autoland/rev/322db52810cb
Part 5 - Eliminate pointers in QueueParamTraits::MinSize r=jgilbert
https://hg.mozilla.org/integration/autoland/rev/b51802b6662b
Part 6 - Eliminate pointers from QueueParamTraits::Read r=jgilbert
You need to log in before you can comment on or make changes to this bug.