[FCP++] Replace priority queue with ordered set

In our current design of ImagePaintTiming, we use priority queue to sort the
records. The priority queue provides O(1) operation to find the largest and
last image in records. However, the current usage of priority queue has a design
problem. Priority queue depends on a comparison function to rank the entries.
The comparison function has an assumption that the properties involving
comparison remain constant during the whole life cycle. The current design has
violated this assumption.

In order to fix this issue, we use ordered set to replace priority queue.
Ordered set allows us to iterate on entries by order of size or time, whereas
priority queue doesn't allow iteration unless popping up the head entry.

The new design also has a detached_ids to record the nodes that are detached
from the DOM node. While looking up the largest and last image, the detached
image will be ignored until it's reattached.

Bug: 914933
Change-Id: I3728a375b4d622a8fa62911285e6b162504611e5
Reviewed-on: https://chromium-review.googlesource.com/c/1377726
Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616984}
3 files changed