Fix fragmented image signature handling

ImageDecoder::determineImageType() is currently only examining the first
buffer segment (getSomeData).  But the signature is not guaranteed to be contiguous,
nor do we ever re-consolidate the buffer after receiving more data.

As a consequence, when the signature is fragmented (e.g. due to a slow
image load), we cannot detect the image type - even after all the data is
later received.

Refactor determineImageType() to consolidate the signature when needed.


Cr-Commit-Position: refs/heads/master@{#412631}
(cherry picked from commit 1b80a74055acae8a0296afe644513f52e34dec79)

Review URL: .

Cr-Commit-Position: refs/branch-heads/2785@{#674}
Cr-Branched-From: 68623971be0cfc492a2cb0427d7f478e7b214c24-refs/heads/master@{#403382}
1 file changed