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

Side by Side Diff: include/private/SkTemplates.h

Issue 1811483004: Add back SkAutoTDelete::detach() for Android temporarily. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkTemplates_DEFINED 10 #ifndef SkTemplates_DEFINED
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 The size of a SkAutoTDelete is small: sizeof(SkAutoTDelete<T>) == sizeof(T*) 92 The size of a SkAutoTDelete is small: sizeof(SkAutoTDelete<T>) == sizeof(T*)
93 */ 93 */
94 template <typename T> class SkAutoTDelete : public std::unique_ptr<T> { 94 template <typename T> class SkAutoTDelete : public std::unique_ptr<T> {
95 public: 95 public:
96 SkAutoTDelete(T* obj = NULL) : std::unique_ptr<T>(obj) {} 96 SkAutoTDelete(T* obj = NULL) : std::unique_ptr<T>(obj) {}
97 97
98 operator T*() const { return this->get(); } 98 operator T*() const { return this->get(); }
99 void free() { this->reset(nullptr); } 99 void free() { this->reset(nullptr); }
100 100
101 #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
102 // Need to update graphics/BitmapRegionDecoder.cpp.
scroggo 2016/03/17 12:37:47 Looks like we also need to update Shader.cpp
103 T* detach() { return this->release(); }
104 #endif
105
101 // See SkAutoTUnref for why we do this. 106 // See SkAutoTUnref for why we do this.
102 explicit operator bool() const { return this->get() != nullptr; } 107 explicit operator bool() const { return this->get() != nullptr; }
103 }; 108 };
104 109
105 template <typename T> class SkAutoTDeleteArray : public std::unique_ptr<T[]> { 110 template <typename T> class SkAutoTDeleteArray : public std::unique_ptr<T[]> {
106 public: 111 public:
107 SkAutoTDeleteArray(T array[]) : std::unique_ptr<T[]>(array) {} 112 SkAutoTDeleteArray(T array[]) : std::unique_ptr<T[]>(array) {}
108 113
109 void free() { this->reset(nullptr); } 114 void free() { this->reset(nullptr); }
110 }; 115 };
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 * Returns void* because this object does not initialize the 477 * Returns void* because this object does not initialize the
473 * memory. Use placement new for types that require a cons. 478 * memory. Use placement new for types that require a cons.
474 */ 479 */
475 void* get() { return fStorage.get(); } 480 void* get() { return fStorage.get(); }
476 const void* get() const { return fStorage.get(); } 481 const void* get() const { return fStorage.get(); }
477 private: 482 private:
478 SkAlignedSStorage<sizeof(T)*N> fStorage; 483 SkAlignedSStorage<sizeof(T)*N> fStorage;
479 }; 484 };
480 485
481 #endif 486 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698