Skip to content

Commit

Permalink
Undo bad code size wins (ampproject#21276)
Browse files Browse the repository at this point in the history
These were better for the gzip size, but worse for the brotli size.
  • Loading branch information
alanorozco authored and bramanudom committed Mar 22, 2019
1 parent f0bb78a commit 2b1fd3e
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 89 deletions.
52 changes: 25 additions & 27 deletions src/service/resources-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2278,33 +2278,31 @@ export class Resources {
doPass();
};

const addTransition = vsm.addTransition.bind(vsm); // for size savings.

addTransition(prerender, prerender, doPass);
addTransition(prerender, visible, doPass);
addTransition(prerender, hidden, doPass);
addTransition(prerender, inactive, doPass);
addTransition(prerender, paused, doPass);

addTransition(visible, visible, doPass);
addTransition(visible, hidden, doPass);
addTransition(visible, inactive, unload);
addTransition(visible, paused, pause);

addTransition(hidden, visible, doPass);
addTransition(hidden, hidden, doPass);
addTransition(hidden, inactive, unload);
addTransition(hidden, paused, pause);

addTransition(inactive, visible, resume);
addTransition(inactive, hidden, resume);
addTransition(inactive, inactive, noop);
addTransition(inactive, paused, doPass);

addTransition(paused, visible, resume);
addTransition(paused, hidden, doPass);
addTransition(paused, inactive, unload);
addTransition(paused, paused, noop);
vsm.addTransition(prerender, prerender, doPass);
vsm.addTransition(prerender, visible, doPass);
vsm.addTransition(prerender, hidden, doPass);
vsm.addTransition(prerender, inactive, doPass);
vsm.addTransition(prerender, paused, doPass);

vsm.addTransition(visible, visible, doPass);
vsm.addTransition(visible, hidden, doPass);
vsm.addTransition(visible, inactive, unload);
vsm.addTransition(visible, paused, pause);

vsm.addTransition(hidden, visible, doPass);
vsm.addTransition(hidden, hidden, doPass);
vsm.addTransition(hidden, inactive, unload);
vsm.addTransition(hidden, paused, pause);

vsm.addTransition(inactive, visible, resume);
vsm.addTransition(inactive, hidden, resume);
vsm.addTransition(inactive, inactive, noop);
vsm.addTransition(inactive, paused, doPass);

vsm.addTransition(paused, visible, resume);
vsm.addTransition(paused, hidden, doPass);
vsm.addTransition(paused, inactive, unload);
vsm.addTransition(paused, paused, noop);
}

/**
Expand Down
Loading

0 comments on commit 2b1fd3e

Please sign in to comment.