Closed Bug 1872951 Opened 1 year ago Closed 1 year ago

DecoderTemplate cleanup

Categories

(Core :: Audio/Video: Web Codecs, task, P1)

task

Tracking

()

RESOLVED FIXED
123 Branch
Tracking Status
firefox123 --- fixed

People

(Reporter: chunmin, Assigned: chunmin)

References

Details

Attachments

(5 files)

There are some unused code, unnecessary comments, and wrong names of something in the DecoderTemplate.

ScheduleReportError and ErrorRunnable are unused in the code.

Some names of the runnables dispatched by QueueATask are not being
described correctly.

Depends on D197630

Depends on D197631

The pattern below in DecoderTemplate.cpp

a = A();
b = a && B();
c = a && b && C()
if (!a || !b || !c) {
  if (!a) {
    err_msg = "...";
  } else if (!b) {
    err_msg = "...";
  } else if (!c) {
    err_msg = "...";
  }
  log(err_msg);
  // other error handling ...
}

can be simplified into

err_msg = ""; // empty string
if (!A()) {
  err_msg = "...";
} else if (!B()) {
  err_msg = "...";
} else if (!C()) {
  err_msg = "...";
}
if (!err_msg.is_empty()) {
  log(err_msg);
  // other error handling ...
}

so there is no boolean dependencies among a, b, and c, and makes
the code more maintainable.

Depends on D197632

This patch minimizes MOZ_CAN_RUN_SCRIPT* annotations.

Depends on D197633

Pushed by cchang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1dc05423a75d Remove unused ErrorRunnable r=media-playback-reviewers,karlt https://hg.mozilla.org/integration/autoland/rev/feca1fd6db8e Correct QueueATask's runnable names r=media-playback-reviewers,karlt https://hg.mozilla.org/integration/autoland/rev/e48fdcb19862 Remove unnecessary comment r=media-playback-reviewers,karlt https://hg.mozilla.org/integration/autoland/rev/9073381a5e74 Untangle unnecessary boolean dependencies r=media-playback-reviewers,karlt https://hg.mozilla.org/integration/autoland/rev/c4d0e3a2fb08 Remove unnecessary MOZ_CAN_RUN_SCRIPT* r=media-playback-reviewers,alwu
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: