Chromium Code Reviews| Index: third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp |
| diff --git a/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp b/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp |
| index 4ef02ef74e1dbe60c1868871e3dfae3e2aab0fa7..9fc57c794207db0f0656bb22664ae52753ff4d17 100644 |
| --- a/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp |
| +++ b/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp |
| @@ -226,6 +226,7 @@ bool DecodeImageData(SharedBuffer* data, |
| RefPtr<SharedBuffer> packet_data = SharedBuffer::Create(); |
| size_t position = 0; |
| + size_t next_frame_to_decode = 0; |
| while (true) { |
| const char* packet; |
| size_t length = data->GetSomeData(packet, position); |
| @@ -235,12 +236,14 @@ bool DecodeImageData(SharedBuffer* data, |
| position += length; |
| bool all_data_received = position == data->size(); |
| - decoder->SetData(packet_data.Get(), all_data_received); |
| - |
| - int frame_count = decoder->FrameCount(); |
| - for (int i = 0; i < frame_count; ++i) { |
| - if (!decoder->FrameBufferAtIndex(i)) |
| + size_t frame_count = decoder->FrameCount(); |
| + for (; next_frame_to_decode < frame_count; ++next_frame_to_decode) { |
| + decoder->SetData(packet_data.Get(), all_data_received); |
| + ImageFrame* frame = decoder->FrameBufferAtIndex(next_frame_to_decode); |
| + if (frame->GetStatus() != ImageFrame::kFrameComplete) |
|
scroggo_chromium
2017/05/15 12:48:28
I think this belongs at the end of the loop. Notic
cblume
2017/05/15 20:55:09
This is effectively done now that the SetData rese
|
| break; |
| + decoder->SetData(PassRefPtr<SegmentReader>(nullptr), false); |
| + decoder->ClearCacheExceptFrame(next_frame_to_decode); |
|
scroggo_chromium
2017/05/15 12:48:28
I'm ambivalent about adding ClearCacheExceptFrame
cblume
2017/05/15 17:39:11
I agree with you. This runs the risk of becoming o
scroggo_chromium
2017/05/15 18:09:22
Where is the integration test?
FWIW, I added the
|
| } |
| if (all_data_received || decoder->Failed()) |