Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp

Issue 2173873003: Cancel image loads if decoding failed (attempt #2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix UAF Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 , m_uniqueID(DecodingImageGenerator::kNeedNewImageUniqueID) 50 , m_uniqueID(DecodingImageGenerator::kNeedNewImageUniqueID)
51 {} 51 {}
52 52
53 ImageOrientation m_orientation; 53 ImageOrientation m_orientation;
54 float m_duration; 54 float m_duration;
55 bool m_isComplete; 55 bool m_isComplete;
56 size_t m_frameBytes; 56 size_t m_frameBytes;
57 uint32_t m_uniqueID; 57 uint32_t m_uniqueID;
58 }; 58 };
59 59
60 std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::create(const SharedB uffer& data, ImageDecoder::AlphaOption alphaOption, ImageDecoder::GammaAndColorP rofileOption colorOptions) 60 std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::create(ImageDecoder: :SniffResult sniffResult, ImageDecoder::AlphaOption alphaOption, ImageDecoder::G ammaAndColorProfileOption colorOptions)
61 { 61 {
62 std::unique_ptr<ImageDecoder> actualDecoder = ImageDecoder::create(data, alp haOption, colorOptions); 62 std::unique_ptr<ImageDecoder> actualDecoder = ImageDecoder::create(sniffResu lt, alphaOption, colorOptions);
63 63
64 if (!actualDecoder) 64 if (!actualDecoder)
65 return nullptr; 65 return nullptr;
66 66
67 return wrapUnique(new DeferredImageDecoder(std::move(actualDecoder))); 67 return wrapUnique(new DeferredImageDecoder(std::move(actualDecoder)));
68 } 68 }
69 69
70 std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::createForTesting(std ::unique_ptr<ImageDecoder> actualDecoder) 70 std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::createForTesting(std ::unique_ptr<ImageDecoder> actualDecoder)
71 { 71 {
72 return wrapUnique(new DeferredImageDecoder(std::move(actualDecoder))); 72 return wrapUnique(new DeferredImageDecoder(std::move(actualDecoder)));
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 340
341 } // namespace blink 341 } // namespace blink
342 342
343 namespace WTF { 343 namespace WTF {
344 template<> struct VectorTraits<blink::DeferredFrameData> : public SimpleClassVec torTraits<blink::DeferredFrameData> { 344 template<> struct VectorTraits<blink::DeferredFrameData> : public SimpleClassVec torTraits<blink::DeferredFrameData> {
345 STATIC_ONLY(VectorTraits); 345 STATIC_ONLY(VectorTraits);
346 static const bool canInitializeWithMemset = false; // Not all DeferredFrameD ata members initialize to 0. 346 static const bool canInitializeWithMemset = false; // Not all DeferredFrameD ata members initialize to 0.
347 }; 347 };
348 } 348 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698