From 97bd5781a5fc580609a45d9dd947b550ed4cdb41 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Fri, 26 Feb 2016 13:29:19 -0500 Subject: [PATCH] Bug 1251718 - use UniquePtr instead of ScopedDeletePtr in WebGLElementArrayCache; r=baku UniquePtr is more standard than ScopedDeletePtr; using standard constructs whenever possible is preferable. --- dom/canvas/WebGLElementArrayCache.cpp | 10 +++++----- dom/canvas/WebGLElementArrayCache.h | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dom/canvas/WebGLElementArrayCache.cpp b/dom/canvas/WebGLElementArrayCache.cpp index 1c939a546c96..3c9365da2c6f 100644 --- a/dom/canvas/WebGLElementArrayCache.cpp +++ b/dom/canvas/WebGLElementArrayCache.cpp @@ -324,7 +324,7 @@ struct TreeForType {}; template<> struct TreeForType { - static ScopedDeletePtr>& + static UniquePtr>& Value(WebGLElementArrayCache* b) { return b->mUint8Tree; } @@ -333,7 +333,7 @@ struct TreeForType template<> struct TreeForType { - static ScopedDeletePtr>& + static UniquePtr>& Value(WebGLElementArrayCache* b) { return b->mUint16Tree; } @@ -342,7 +342,7 @@ struct TreeForType template<> struct TreeForType { - static ScopedDeletePtr>& + static UniquePtr>& Value(WebGLElementArrayCache* b) { return b->mUint32Tree; } @@ -536,9 +536,9 @@ WebGLElementArrayCache::Validate(uint32_t maxAllowed, size_t firstElement, if (!mBytes.Length() || !countElements) return true; - ScopedDeletePtr>& tree = TreeForType::Value(this); + UniquePtr>& tree = TreeForType::Value(this); if (!tree) { - tree = new WebGLElementArrayCacheTree(*this); + tree = MakeUnique>(*this); if (mBytes.Length()) { bool valid = tree->Update(0, mBytes.Length() - 1); if (!valid) { diff --git a/dom/canvas/WebGLElementArrayCache.h b/dom/canvas/WebGLElementArrayCache.h index 3ff2eac005fe..5e79faba86b5 100644 --- a/dom/canvas/WebGLElementArrayCache.h +++ b/dom/canvas/WebGLElementArrayCache.h @@ -8,7 +8,7 @@ #include "GLDefs.h" #include "mozilla/MemoryReporting.h" -#include "mozilla/Scoped.h" +#include "mozilla/UniquePtr.h" #include "nscore.h" #include "nsTArray.h" #include @@ -93,9 +93,9 @@ private: friend struct TreeForType; FallibleTArray mBytes; - ScopedDeletePtr> mUint8Tree; - ScopedDeletePtr> mUint16Tree; - ScopedDeletePtr> mUint32Tree; + UniquePtr> mUint8Tree; + UniquePtr> mUint16Tree; + UniquePtr> mUint32Tree; }; } // end namespace mozilla