diff options
-rw-r--r-- | webkit/port/platform/image-decoders/ImageDecoder.h | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/webkit/port/platform/image-decoders/ImageDecoder.h b/webkit/port/platform/image-decoders/ImageDecoder.h index 5d05e25..619f236 100644 --- a/webkit/port/platform/image-decoders/ImageDecoder.h +++ b/webkit/port/platform/image-decoders/ImageDecoder.h @@ -31,25 +31,28 @@ #include "ImageSource.h" #include "NativeImageSkia.h" #include "SharedBuffer.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> #include <wtf/Vector.h> #undef LOG -#include "base/basictypes.h" -#include "base/ref_counted.h" #include "SkBitmap.h" namespace WebCore { -class RefCountedNativeImageSkia - : public base::RefCounted<RefCountedNativeImageSkia> { +class RefCountedNativeImageSkia : public RefCounted<RefCountedNativeImageSkia> { public: - RefCountedNativeImageSkia() {} + static PassRefPtr<RefCountedNativeImageSkia> create() { + return adoptRef(new RefCountedNativeImageSkia); + } - const NativeImageSkia& bitmap() const { return bitmap_; } - NativeImageSkia& bitmap() { return bitmap_; } + const NativeImageSkia& bitmap() const { return m_bitmap; } + NativeImageSkia& bitmap() { return m_bitmap; } private: - NativeImageSkia bitmap_; + RefCountedNativeImageSkia() {} + NativeImageSkia m_bitmap; }; // The RGBA32Buffer object represents the decoded image data in RGBA32 format. @@ -83,15 +86,14 @@ public: RGBA32Buffer() : m_status(FrameEmpty), m_duration(0), - m_disposalMethod(DisposeNotSpecified) - { - m_bitmapRef = new RefCountedNativeImageSkia(); + m_disposalMethod(DisposeNotSpecified) { + m_bitmapRef = RefCountedNativeImageSkia::create(); } // This constructor doesn't create a new copy of the image data, it only // increases the ref count of the existing bitmap. RGBA32Buffer(const RGBA32Buffer& other) { - m_bitmapRef = new RefCountedNativeImageSkia(); + m_bitmapRef = RefCountedNativeImageSkia::create(); operator=(other); } @@ -123,7 +125,7 @@ public: if (this == &other) return; - m_bitmapRef = new RefCountedNativeImageSkia(); + m_bitmapRef = RefCountedNativeImageSkia::create(); SkBitmap& bmp = bitmap(); const SkBitmap& otherBmp = other.bitmap(); bmp.setConfig(SkBitmap::kARGB_8888_Config, other.width(), @@ -200,7 +202,7 @@ public: } private: - scoped_refptr<RefCountedNativeImageSkia> m_bitmapRef; + RefPtr<RefCountedNativeImageSkia> m_bitmapRef; IntRect m_rect; // The rect of the original specified frame within the overall buffer. // This will always just be the entire buffer except for GIF frames // whose original rect was smaller than the overall image size. @@ -285,10 +287,11 @@ private: // based on the width and height. Because of this, our total computed image // byte size must never overflow an int. static bool isOverSize(unsigned width, unsigned height) { - uint64 total_size = static_cast<uint64>(width) * static_cast<uint64>(height); - if (total_size > 32 * 1024 * 1024) // 32M = 128MB memory total (32 bpp). - return true; - return false; + unsigned long long total_size = static_cast<unsigned long long>(width) * + static_cast<unsigned long long>(height); + if (total_size > 32 * 1024 * 1024) // 32M = 128MB memory total (32 bpp). + return true; + return false; } IntSize m_size; |