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

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

Issue 912053003: Fix append_fallback_font_families_for_locale. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Full test and address comments. Created 5 years, 10 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 | resources/android_fonts/v17/fallback_fonts-ja.xml » ('j') | 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 Call a function when this goes out of scope. The template uses two 100 Call a function when this goes out of scope. The template uses two
101 parameters, the object, and a function that is to be called in the destructor. 101 parameters, the object, and a function that is to be called in the destructor.
102 If detach() is called, the object reference is set to null. If the object 102 If detach() is called, the object reference is set to null. If the object
103 reference is null when the destructor is called, we do not call the 103 reference is null when the destructor is called, we do not call the
104 function. 104 function.
105 */ 105 */
106 template <typename T, int (*P)(T*)> class SkAutoTCallIProc : SkNoncopyable { 106 template <typename T, int (*P)(T*)> class SkAutoTCallIProc : SkNoncopyable {
107 public: 107 public:
108 SkAutoTCallIProc(T* obj): fObj(obj) {} 108 SkAutoTCallIProc(T* obj): fObj(obj) {}
109 ~SkAutoTCallIProc() { if (fObj) P(fObj); } 109 ~SkAutoTCallIProc() { if (fObj) P(fObj); }
110
111 operator T*() const { return fObj; }
112 T* operator->() const { SkASSERT(fObj); return fObj; }
113
110 T* detach() { T* obj = fObj; fObj = NULL; return obj; } 114 T* detach() { T* obj = fObj; fObj = NULL; return obj; }
111 private: 115 private:
112 T* fObj; 116 T* fObj;
113 }; 117 };
114 118
115 /** \class SkAutoTDelete 119 /** \class SkAutoTDelete
116 An SkAutoTDelete<T> is like a T*, except that the destructor of SkAutoTDelete< T> 120 An SkAutoTDelete<T> is like a T*, except that the destructor of SkAutoTDelete< T>
117 automatically deletes the pointer it holds (if any). That is, SkAutoTDelete<T > 121 automatically deletes the pointer it holds (if any). That is, SkAutoTDelete<T >
118 owns the T object that it points to. Like a T*, an SkAutoTDelete<T> may hold 122 owns the T object that it points to. Like a T*, an SkAutoTDelete<T> may hold
119 either NULL or a pointer to a T object. Also like T*, SkAutoTDelete<T> is 123 either NULL or a pointer to a T object. Also like T*, SkAutoTDelete<T> is
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 /** 494 /**
491 * Returns void* because this object does not initialize the 495 * Returns void* because this object does not initialize the
492 * memory. Use placement new for types that require a cons. 496 * memory. Use placement new for types that require a cons.
493 */ 497 */
494 void* get() { return fStorage.get(); } 498 void* get() { return fStorage.get(); }
495 private: 499 private:
496 SkAlignedSStorage<sizeof(T)*N> fStorage; 500 SkAlignedSStorage<sizeof(T)*N> fStorage;
497 }; 501 };
498 502
499 #endif 503 #endif
OLDNEW
« no previous file with comments | « no previous file | resources/android_fonts/v17/fallback_fonts-ja.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698