X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fbase%2Fmemory%2Fref_counted_memory.h;h=15a43077b4a6a085921ff45db1a6665b39de0382;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=d2987c5d21bd3d1cb1c6ebd6bf3c7f827b341491;hpb=7338fba38ba696536d1cc9d389afd716a6ab2fe6;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/base/memory/ref_counted_memory.h b/src/base/memory/ref_counted_memory.h index d2987c5..15a4307 100644 --- a/src/base/memory/ref_counted_memory.h +++ b/src/base/memory/ref_counted_memory.h @@ -30,6 +30,11 @@ class BASE_EXPORT RefCountedMemory // Returns true if |other| is byte for byte equal. bool Equals(const scoped_refptr& other) const; + // Handy method to simplify calling front() with a reinterpret_cast. + template const T* front_as() const { + return reinterpret_cast(front()); + } + protected: friend class base::RefCountedThreadSafe; RefCountedMemory(); @@ -42,8 +47,9 @@ class BASE_EXPORT RefCountedStaticMemory : public RefCountedMemory { public: RefCountedStaticMemory() : data_(NULL), length_(0) {} - RefCountedStaticMemory(const unsigned char* data, size_t length) - : data_(length ? data : NULL), length_(length) {} + RefCountedStaticMemory(const void* data, size_t length) + : data_(static_cast(length ? data : NULL)), + length_(length) {} // Overridden from RefCountedMemory: virtual const unsigned char* front() const OVERRIDE;