Revert of Do not consolidate data in BMPImageDecoder (patchset #9 id:160001 of https://codereview.chromium.org/1259083003/ )

Reason for revert:
crbug.com/530279

This comment [1] describes what needs to be done to reland.

[1] https://code.google.com/p/chromium/issues/detail?id=530279#c1

Original issue's description:
> Do not consolidate data in BMPImageDecoder
> 
> In BMPImageDecoder, never call SharedBuffer::data(), which potentially
> copies all the data. Instead, do the following:
> 
> - Read directly from the SharedBuffer when it is safe to do so. e.g.
>   when only one byte is needed. We already know there is enough data,
>   and getSomeData will return at least a byte if there is enough data.
> - Use a FastSharedBufferReader when we may be on a segment boundary.
> 
> As a result, we make fewer copies when decoding BMPs. We never call
> SharedBuffer::data(), which copies up to the entire encoded data
> received so far. Occasionally we will make small copies when a two or
> four byte number is on a segment boundary.
> 
> Add a setter to FastSharedBufferReader to update its SharedBuffer, so the
> BMPImageReader can have one as a member, which it will reuse across calls.
> 
> Remove BIG_ENDIAN, and eliminate another memcpy that was there to support
> it.
> 
> Using my modified version of ImageDecodeBench (see crrev.com/1145373003),
> I see a slight speedup as compared to the old version which relied on
> SharedBuffer::data(). (My data can be found here: [1].) This matches my
> expectations, since the new version is copying less data.
> 
> Using a version of ImageDecodeBench with a premerged buffer (see
> crrev.com/1318713005), I still see a speed improvement, although it is
> very small. (See sheet 2 of the above spreadsheet).
> 
> [1] https://docs.google.com/a/google.com/spreadsheets/d/1GN2FDytKvkdZzV-WF4IEQaYQF65wa4bRxG67bNgpjAE/edit?usp=sharing
> 
> BUG=467772
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=201811

TBR=noel@chromium.org,pkasting@chromium.org,fmalita@chromium.org,scroggo@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=467772

Review URL: https://codereview.chromium.org/1337263003

git-svn-id: svn://svn.chromium.org/blink/trunk@202201 bbb929c8-8fbe-4397-9dbb-9b2b20218538
7 files changed
tree: c1500bfd4a122b508edb32dd6660154ba5e92229
  1. third_party/