From: mtklein Date: Mon, 30 Nov 2015 15:17:39 +0000 (-0800) Subject: Revert of skstd -> std for unique_ptr (patchset #16 id:300001 of https://codereview... X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~184^2~543 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e066df9673063871c478f84dd26bc3d7352819d9;p=platform%2Fupstream%2FlibSkiaSharp.git Revert of skstd -> std for unique_ptr (patchset #16 id:300001 of https://codereview.chromium.org/1436033003/ ) Reason for revert: Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Release Original issue's description: > skstd -> std for unique_ptr > > TBR=reed@google.com > No public API changes. > > BUG=skia:4564 > > Committed: https://skia.googlesource.com/skia/+/755c553c17b82bb5de3d9cc8d3b2a866ff9e9e50 > > CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot,Build-Ubuntu-GCC-x86_64-Debug-CrOS_Link-Trybot;client.skia:Perf-Mac10.9-Clang-MacMini6.2-CPU-AVX-x86_64-Release-Trybot > > Committed: https://skia.googlesource.com/skia/+/06189155d987db5c7e69015f6ea87c2168d6a065 > > Committed: https://skia.googlesource.com/skia/+/70e8dfca4a7f5bce97b8021a6e378c4828b09c8c TBR=bungeman@google.com,mtklein@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:4564 Review URL: https://codereview.chromium.org/1482343002 --- diff --git a/gyp/core.gypi b/gyp/core.gypi index c85cc0f..6446fe1 100644 --- a/gyp/core.gypi +++ b/gyp/core.gypi @@ -410,6 +410,7 @@ '<(skia_include_path)/private/SkTHash.h', '<(skia_include_path)/private/SkThreadID.h', '<(skia_include_path)/private/SkTLogic.h', + '<(skia_include_path)/private/SkUniquePtr.h', '<(skia_include_path)/private/SkUtility.h', '<(skia_include_path)/private/SkWeakRefCnt.h', diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h index 1033bcc..0e8d857 100644 --- a/include/core/SkRefCnt.h +++ b/include/core/SkRefCnt.h @@ -9,8 +9,8 @@ #define SkRefCnt_DEFINED #include "../private/SkAtomics.h" +#include "../private/SkUniquePtr.h" #include "SkTypes.h" -#include /** \class SkRefCntBase @@ -185,9 +185,9 @@ template struct SkTUnref { /** * Utility class that simply unref's its argument in the destructor. */ -template class SkAutoTUnref : public std::unique_ptr> { +template class SkAutoTUnref : public skstd::unique_ptr> { public: - explicit SkAutoTUnref(T* obj = nullptr) : std::unique_ptr>(obj) {} + explicit SkAutoTUnref(T* obj = nullptr) : skstd::unique_ptr>(obj) {} T* detach() { return this->release(); } operator T*() const { return this->get(); } diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index b3bcc19..5720c30 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -257,11 +257,7 @@ typedef uint8_t SkBool8; /** Returns 0 or 1 based on the condition */ -#if defined(_MSC_VER) - #define SkToBool(cond) (!!(cond)) // MSVC doesn't like a cast. -#else - #define SkToBool(cond) static_cast(cond) -#endif +#define SkToBool(cond) ((cond) != 0) #define SK_MaxS16 32767 #define SK_MinS16 -32767 diff --git a/include/private/SkOncePtr.h b/include/private/SkOncePtr.h index 3c1ab63..261f9a7 100644 --- a/include/private/SkOncePtr.h +++ b/include/private/SkOncePtr.h @@ -9,7 +9,7 @@ #define SkOncePtr_DEFINED #include "../private/SkAtomics.h" -#include +#include "SkUniquePtr.h" template class SkBaseOncePtr; @@ -17,7 +17,7 @@ template class SkBaseOncePtr; #define SK_DECLARE_STATIC_ONCE_PTR(type, name) namespace {} static SkBaseOncePtr name; // Use this for a local or member pointer that's initialized exactly once when you call get(). -template > +template > class SkOncePtr : SkNoncopyable { public: SkOncePtr() { sk_bzero(this, sizeof(*this)); } @@ -42,7 +42,7 @@ private: // If you ask for SkOncePtr, we'll clean up with delete[] by default. template -class SkOncePtr : public SkOncePtr> {}; +class SkOncePtr : public SkOncePtr> {}; /* TODO(mtklein): in next CL typedef SkBaseOncePtr SkOnceFlag; diff --git a/include/private/SkTemplates.h b/include/private/SkTemplates.h index db85fbc..533cb26 100644 --- a/include/private/SkTemplates.h +++ b/include/private/SkTemplates.h @@ -13,9 +13,9 @@ #include "SkMath.h" #include "SkTLogic.h" #include "SkTypes.h" +#include "SkUniquePtr.h" #include "SkUtility.h" #include -#include #include /** \file SkTemplates.h @@ -59,9 +59,9 @@ template struct SkFunctionWrapper { function. */ template class SkAutoTCallVProc - : public std::unique_ptr> { + : public skstd::unique_ptr> { public: - SkAutoTCallVProc(T* obj): std::unique_ptr>(obj) {} + SkAutoTCallVProc(T* obj): skstd::unique_ptr>(obj) {} operator T*() const { return this->get(); } T* detach() { return this->release(); } @@ -76,9 +76,9 @@ reference is null when the destructor is called, we do not call the function. */ template class SkAutoTCallIProc - : public std::unique_ptr> { + : public skstd::unique_ptr> { public: - SkAutoTCallIProc(T* obj): std::unique_ptr>(obj) {} + SkAutoTCallIProc(T* obj): skstd::unique_ptr>(obj) {} operator T*() const { return this->get(); } T* detach() { return this->release(); } @@ -94,18 +94,18 @@ public: The size of a SkAutoTDelete is small: sizeof(SkAutoTDelete) == sizeof(T*) */ -template class SkAutoTDelete : public std::unique_ptr { +template class SkAutoTDelete : public skstd::unique_ptr { public: - SkAutoTDelete(T* obj = NULL) : std::unique_ptr(obj) {} + SkAutoTDelete(T* obj = NULL) : skstd::unique_ptr(obj) {} operator T*() const { return this->get(); } void free() { this->reset(nullptr); } T* detach() { return this->release(); } }; -template class SkAutoTDeleteArray : public std::unique_ptr { +template class SkAutoTDeleteArray : public skstd::unique_ptr { public: - SkAutoTDeleteArray(T array[]) : std::unique_ptr(array) {} + SkAutoTDeleteArray(T array[]) : skstd::unique_ptr(array) {} void free() { this->reset(nullptr); } T* detach() { return this->release(); } diff --git a/include/private/SkUniquePtr.h b/include/private/SkUniquePtr.h new file mode 100644 index 0000000..5d6e722 --- /dev/null +++ b/include/private/SkUniquePtr.h @@ -0,0 +1,396 @@ +/* + * Copyright 2015 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkUniquePtr_DEFINED +#define SkUniquePtr_DEFINED + +#include "SkTLogic.h" +#include "SkUtility.h" + +namespace skstd { + +template struct default_delete { + /*constexpr*/ default_delete() /*noexcept*/ = default; + + template ::value>> + default_delete(const default_delete&) /*noexcept*/ {} + + void operator()(T* obj) const { + static_assert(sizeof(T) > 0, "Deleting pointer to incomplete type!"); + delete obj; + } +}; +template struct default_delete { + /*constexpr*/ default_delete() /*noexcept*/ = default; + + void operator()(T* obj) const { + static_assert(sizeof(T) > 0, "Deleting pointer to incomplete type!"); + delete [] obj; + } +}; + +template > class unique_ptr { + // remove_reference_t::pointer if that type exists, otherwise T*. + struct pointer_type_detector { + template static typename U::pointer detector(typename U::pointer*); + template static T* detector(...); + using type = decltype(detector>(0)); + }; + +public: + using pointer = typename pointer_type_detector::type; + using element_type = T; + using deleter_type = D; + +private: + template ::value /*&& !is_final::value*/> + struct compressed_base : private B { + /*constexpr*/ compressed_base() : B() {} + /*constexpr*/ compressed_base(const B& b) : B(b) {} + /*constexpr*/ compressed_base(const B&& b) : B(move(b)) {} + /*constexpr*/ B& get() /*noexcept*/ { return *this; } + /*constexpr*/ B const& get() const /*noexcept*/ { return *this; } + void swap(compressed_base&) /*noexcept*/ { } + }; + + template struct compressed_base { + B fb; + /*constexpr*/ compressed_base() : B() {} + /*constexpr*/ compressed_base(const B& b) : fb(b) {} + /*constexpr*/ compressed_base(const B&& b) : fb(move(b)) {} + /*constexpr*/ B& get() /*noexcept*/ { return fb; } + /*constexpr*/ B const& get() const /*noexcept*/ { return fb; } + void swap(compressed_base& that) /*noexcept*/ { SkTSwap(fb, that.fB); } + }; + + struct compressed_data : private compressed_base { + pointer fPtr; + /*constexpr*/ compressed_data() : compressed_base(), fPtr() {} + /*constexpr*/ compressed_data(const pointer& ptr, const deleter_type& d) + : compressed_base(d), fPtr(ptr) {} + template ::value && is_convertible::value + >> /*constexpr*/ compressed_data(U1&& ptr, U2&& d) + : compressed_base(skstd::forward(d)), fPtr(skstd::forward(ptr)) {} + /*constexpr*/ pointer& getPointer() /*noexcept*/ { return fPtr; } + /*constexpr*/ pointer const& getPointer() const /*noexcept*/ { return fPtr; } + /*constexpr*/ deleter_type& getDeleter() /*noexcept*/ { + return compressed_base::get(); + } + /*constexpr*/ deleter_type const& getDeleter() const /*noexcept*/ { + return compressed_base::get(); + } + void swap(compressed_data& that) /*noexcept*/ { + compressed_base::swap(static_cast>(that)); + SkTSwap(fPtr, that.fPtr); + } + }; + compressed_data data; + +public: + /*constexpr*/ unique_ptr() /*noexcept*/ : data() { + static_assert(!is_pointer::value, "Deleter is nullptr function pointer!"); + } + + /*constexpr*/ unique_ptr(skstd::nullptr_t) /*noexcept*/ : unique_ptr() { } + + explicit unique_ptr(pointer ptr) /*noexcept*/ : data(ptr, deleter_type()) { + static_assert(!is_pointer::value, "Deleter is nullptr function pointer!"); + } + + unique_ptr(pointer ptr, + conditional_t::value, deleter_type,const deleter_type&> d) + /*noexcept*/ : data(ptr, d) + {} + + unique_ptr(pointer ptr, remove_reference_t&& d) /*noexcept*/ + : data(move(ptr), move(d)) + { + static_assert(!is_reference::value, + "Binding an rvalue reference deleter as an lvalue reference deleter is not allowed."); + } + + + unique_ptr(unique_ptr&& that) /*noexcept*/ + : data(that.release(), forward(that.get_deleter())) + {} + + template ::pointer, pointer>::value && + !is_array::value && + conditional_t::value, is_same, is_convertible>::value>> + unique_ptr(unique_ptr&& that) /*noexcept*/ + : data(that.release(), forward(that.get_deleter())) + {} + + ~unique_ptr() /*noexcept*/ { + pointer& ptr = data.getPointer(); + if (ptr != nullptr) { + get_deleter()(ptr); + } + ptr = pointer(); + } + + unique_ptr& operator=(unique_ptr&& that) /*noexcept*/ { + reset(that.release()); + get_deleter() = forward(that.get_deleter()); + return *this; + } + + template enable_if_t< + is_convertible::pointer, pointer>::value && + !is_array::value, + unique_ptr&> operator=(unique_ptr&& that) /*noexcept*/ { + reset(that.release()); + get_deleter() = forward(that.get_deleter()); + return *this; + } + + unique_ptr& operator=(skstd::nullptr_t) /*noexcept*/ { + reset(); + return *this; + } + + add_lvalue_reference_t operator*() const { + SkASSERT(get() != pointer()); + return *get(); + } + + pointer operator->() const /*noexcept*/ { + SkASSERT(get() != pointer()); + return get(); + } + + pointer get() const /*noexcept*/ { + return data.getPointer(); + } + + deleter_type& get_deleter() /*noexcept*/ { + return data.getDeleter(); + } + + const deleter_type& get_deleter() const /*noexcept*/ { + return data.getDeleter(); + } + + //explicit operator bool() const noexcept { + bool is_attached() const /*noexcept*/ { + return get() == pointer() ? false : true; + } + + pointer release() /*noexcept*/ { + pointer ptr = get(); + data.getPointer() = pointer(); + return ptr; + } + + void reset(pointer ptr = pointer()) /*noexcept*/ { + SkTSwap(data.getPointer(), ptr); + if (ptr != pointer()) { + get_deleter()(ptr); + } + } + + void swap(unique_ptr& that) /*noexcept*/ { + SkTSwap(data, that.data); + } + + unique_ptr(const unique_ptr&) = delete; + unique_ptr& operator=(const unique_ptr&) = delete; +}; + +template class unique_ptr { + // remove_reference_t::pointer if that type exists, otherwise T*. + struct pointer_type_detector { + template static typename U::pointer detector(typename U::pointer*); + template static T* detector(...); + using type = decltype(detector>(0)); + }; + +public: + using pointer = typename pointer_type_detector::type; + using element_type = T; + using deleter_type = D; + +private: + template ::value /*&& !is_final::value*/> + struct compressed_base : private B { + /*constexpr*/ compressed_base() : B() {} + /*constexpr*/ compressed_base(const B& b) : B(b) {} + /*constexpr*/ compressed_base(const B&& b) : B(move(b)) {} + /*constexpr*/ B& get() /*noexcept*/ { return *this; } + /*constexpr*/ B const& get() const /*noexcept*/ { return *this; } + void swap(compressed_base&) /*noexcept*/ { } + }; + + template struct compressed_base { + B fb; + /*constexpr*/ compressed_base() : B() {} + /*constexpr*/ compressed_base(const B& b) : fb(b) {} + /*constexpr*/ compressed_base(const B&& b) : fb(move(b)) {} + /*constexpr*/ B& get() /*noexcept*/ { return fb; } + /*constexpr*/ B const& get() const /*noexcept*/ { return fb; } + void swap(compressed_base& that) /*noexcept*/ { SkTSwap(fb, that.fB); } + }; + + struct compressed_data : private compressed_base { + pointer fPtr; + /*constexpr*/ compressed_data() : compressed_base(), fPtr() {} + /*constexpr*/ compressed_data(const pointer& ptr, const deleter_type& d) + : compressed_base(d), fPtr(ptr) {} + template ::value && is_convertible::value + >> /*constexpr*/ compressed_data(U1&& ptr, U2&& d) + : compressed_base(skstd::forward(d)), fPtr(skstd::forward(ptr)) {} + /*constexpr*/ pointer& getPointer() /*noexcept*/ { return fPtr; } + /*constexpr*/ pointer const& getPointer() const /*noexcept*/ { return fPtr; } + /*constexpr*/ deleter_type& getDeleter() /*noexcept*/ { + return compressed_base::get(); + } + /*constexpr*/ deleter_type const& getDeleter() const /*noexcept*/ { + return compressed_base::get(); + } + void swap(compressed_data& that) /*noexcept*/ { + compressed_base::swap(static_cast>(that)); + SkTSwap(fPtr, that.fPtr); + } + }; + compressed_data data; + +public: + /*constexpr*/ unique_ptr() /*noexcept*/ : data() { + static_assert(!is_pointer::value, "Deleter is nullptr function pointer!"); + } + + /*constexpr*/ unique_ptr(skstd::nullptr_t) /*noexcept*/ : unique_ptr() { } + + explicit unique_ptr(pointer ptr) /*noexcept*/ : data(ptr, deleter_type()) { + static_assert(!is_pointer::value, "Deleter is nullptr function pointer!"); + } + + unique_ptr(pointer ptr, + conditional_t::value, deleter_type,const deleter_type&> d) + /*noexcept*/ : data(ptr, d) + {} + + unique_ptr(pointer ptr, remove_reference_t&& d) /*noexcept*/ + : data(move(ptr), move(d)) + { + static_assert(!is_reference::value, + "Binding an rvalue reference deleter as an lvalue reference deleter is not allowed."); + } + + unique_ptr(unique_ptr&& that) /*noexcept*/ + : data(that.release(), forward(that.get_deleter())) + {} + + ~unique_ptr() { + pointer& ptr = data.getPointer(); + if (ptr != nullptr) { + get_deleter()(ptr); + } + ptr = pointer(); + } + + unique_ptr& operator=(unique_ptr&& that) /*noexcept*/ { + reset(that.release()); + get_deleter() = forward(that.get_deleter()); + return *this; + } + + unique_ptr& operator=(skstd::nullptr_t) /*noexcept*/ { + reset(); + return *this; + } + + add_lvalue_reference_t operator[](size_t i) const { + SkASSERT(get() != pointer()); + return get()[i]; + } + + pointer get() const /*noexcept*/ { + return data.getPointer(); + } + + deleter_type& get_deleter() /*noexcept*/ { + return data.getDeleter(); + } + + const deleter_type& get_deleter() const /*noexcept*/ { + return data.getDeleter(); + } + + //explicit operator bool() const noexcept { + bool is_attached() const /*noexcept*/ { + return get() == pointer() ? false : true; + } + + pointer release() /*noexcept*/ { + pointer ptr = get(); + data.getPointer() = pointer(); + return ptr; + } + + void reset(pointer ptr = pointer()) /*noexcept*/ { + SkTSwap(data.getPointer(), ptr); + if (ptr != pointer()) { + get_deleter()(ptr); + } + } + + template void reset(U*) = delete; + + void swap(unique_ptr& that) /*noexcept*/ { + data.swap(that.data); + } + + unique_ptr(const unique_ptr&) = delete; + unique_ptr& operator=(const unique_ptr&) = delete; +}; + +template +inline void swap(unique_ptr& a, unique_ptr& b) /*noexcept*/ { + a.swap(b); +} + +template +inline bool operator==(const unique_ptr& a, const unique_ptr& b) { + return a.get() == b.get(); +} + +template +inline bool operator==(const unique_ptr& a, skstd::nullptr_t) /*noexcept*/ { + //return !a; + return !a.is_attached(); +} + +template +inline bool operator==(skstd::nullptr_t, const unique_ptr& b) /*noexcept*/ { + //return !b; + return !b.is_attached(); +} + +template +inline bool operator!=(const unique_ptr& a, const unique_ptr& b) { + return a.get() != b.get(); +} + +template +inline bool operator!=(const unique_ptr& a, skstd::nullptr_t) /*noexcept*/ { + //return (bool)a; + return a.is_attached(); +} + +template +inline bool operator!=(skstd::nullptr_t, const unique_ptr& b) /*noexcept*/ { + //return (bool)b; + return b.is_attached(); +} + +} // namespace skstd + +#endif diff --git a/src/android/SkBitmapRegionDecoder.cpp b/src/android/SkBitmapRegionDecoder.cpp index f11bf40..a153282 100644 --- a/src/android/SkBitmapRegionDecoder.cpp +++ b/src/android/SkBitmapRegionDecoder.cpp @@ -54,7 +54,7 @@ SkBitmapRegionDecoder* SkBitmapRegionDecoder::Create( SkAndroidCodec::NewFromStream(streamDeleter.detach()); if (nullptr == codec) { SkCodecPrintf("Error: Failed to create codec.\n"); - return nullptr; + return NULL; } SkEncodedFormat format = codec->getEncodedFormat(); diff --git a/src/core/SkSharedMutex.h b/src/core/SkSharedMutex.h index 21c9f46..840c2d3 100644 --- a/src/core/SkSharedMutex.h +++ b/src/core/SkSharedMutex.h @@ -14,7 +14,7 @@ #ifdef SK_DEBUG #include "SkMutex.h" - #include + #include "SkUniquePtr.h" #endif // SK_DEBUG // There are two shared lock implementations one debug the other is high performance. They implement @@ -50,9 +50,9 @@ public: private: #ifdef SK_DEBUG class ThreadIDSet; - std::unique_ptr fCurrentShared; - std::unique_ptr fWaitingExclusive; - std::unique_ptr fWaitingShared; + skstd::unique_ptr fCurrentShared; + skstd::unique_ptr fWaitingExclusive; + skstd::unique_ptr fWaitingShared; int fSharedQueueSelect{0}; mutable SkMutex fMu; SkSemaphore fSharedQueue[2]; diff --git a/tests/CPlusPlusEleven.cpp b/tests/CPlusPlusEleven.cpp index f7d194a..5c2123d 100644 --- a/tests/CPlusPlusEleven.cpp +++ b/tests/CPlusPlusEleven.cpp @@ -27,3 +27,72 @@ DEF_TEST(CPlusPlusEleven_RvalueAndMove, r) { Moveable src1; Moveable dst1(skstd::move(src1)); Moveable src2, dst2; dst2 = skstd::move(src2); } + +#define TOO_BIG "The unique_ptr was bigger than expected." +#define WEIRD_SIZE "The unique_ptr was a different size than expected." + +DEF_TEST(CPlusPlusEleven_UniquePtr, r) { + struct SmallUniquePtr { + Moveable* p; + }; + struct BigUniquePtr { + void(*d)(Moveable*); + Moveable* p; + }; + + static_assert(sizeof(skstd::unique_ptr) == sizeof(SmallUniquePtr), TOO_BIG); + static_assert(sizeof(skstd::unique_ptr) == sizeof(SmallUniquePtr), TOO_BIG); + + using proc = void(*)(Moveable*); + static_assert(sizeof(skstd::unique_ptr) == sizeof(BigUniquePtr), WEIRD_SIZE); + static_assert(sizeof(skstd::unique_ptr) == sizeof(BigUniquePtr), WEIRD_SIZE); + + { + skstd::unique_ptr u(nullptr, deleter); + static_assert(sizeof(u) == sizeof(BigUniquePtr), WEIRD_SIZE); + + auto u2 = skstd::move(u); + static_assert(sizeof(u2) == sizeof(BigUniquePtr), WEIRD_SIZE); + } + + { + skstd::unique_ptr u(nullptr, [](Moveable* m){ deleter(m); }); + static_assert(sizeof(u) == sizeof(BigUniquePtr), WEIRD_SIZE); + + auto u2 = skstd::move(u); + static_assert(sizeof(u2) == sizeof(BigUniquePtr), WEIRD_SIZE); + } + + { + auto d = [](Moveable* m){ deleter(m); }; + skstd::unique_ptr u(nullptr, d); + static_assert(sizeof(u) == sizeof(SmallUniquePtr), TOO_BIG); + + auto u2 = skstd::move(u); + static_assert(sizeof(u2) == sizeof(SmallUniquePtr), TOO_BIG); + } + + { + skstd::unique_ptr> u(nullptr, Deleter()); + static_assert(sizeof(u) == sizeof(SmallUniquePtr), TOO_BIG); + + auto u2 = skstd::move(u); + static_assert(sizeof(u2) == sizeof(SmallUniquePtr), TOO_BIG); + } + + { + skstd::unique_ptr> u(new Moveable(), Deleter()); + static_assert(sizeof(u) == sizeof(SmallUniquePtr), TOO_BIG); + + auto u2 = skstd::move(u); + static_assert(sizeof(u2) == sizeof(SmallUniquePtr), TOO_BIG); + } + + { + skstd::unique_ptr> u(new Moveable(), Deleter()); + static_assert(sizeof(u) == sizeof(SmallUniquePtr), TOO_BIG); + + auto u2 = skstd::move(u); + static_assert(sizeof(u2) == sizeof(SmallUniquePtr), TOO_BIG); + } +} diff --git a/tools/BUILD.public.expected b/tools/BUILD.public.expected index a23db4b..950f148 100644 --- a/tools/BUILD.public.expected +++ b/tools/BUILD.public.expected @@ -290,6 +290,7 @@ BASE_SRCS = ['include/private/SkAtomics.h', 'include/private/SkTLogic.h', 'include/private/SkTemplates.h', 'include/private/SkThreadID.h', + 'include/private/SkUniquePtr.h', 'include/private/SkUtility.h', 'include/private/SkWeakRefCnt.h', 'src/android/SkBitmapRegionCanvas.cpp',