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

Side by Side Diff: include/utils/win/SkTScopedComPtr.h

Issue 14314008: Add FontMgr to DirectWrite. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Add matcher, fix GrGLCaps. Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 #ifndef SkSkTScopedPtr_DEFINED 9 #ifndef SkSkTScopedPtr_DEFINED
10 #define SkSkTScopedPtr_DEFINED 10 #define SkSkTScopedPtr_DEFINED
11 11
12 #include "SkTypes.h" 12 #include "SkTypes.h"
13 #include "SkTemplates.h" 13 #include "SkTemplates.h"
14 14
15 template<typename T> 15 template<typename T>
16 class SkBlockComRef : public T { 16 class SkBlockComRef : public T {
17 private: 17 private:
18 virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0; 18 virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0;
19 virtual ULONG STDMETHODCALLTYPE Release(void) = 0; 19 virtual ULONG STDMETHODCALLTYPE Release(void) = 0;
20 }; 20 };
21 21
22 template<typename T> T* SkRefComPtr(T* ptr) {
23 ptr->AddRef();
24 return ptr;
25 }
26
22 template<typename T> 27 template<typename T>
23 class SkTScopedComPtr : SkNoncopyable { 28 class SkTScopedComPtr : SkNoncopyable {
24 private: 29 private:
25 T *fPtr; 30 T *fPtr;
26 31
27 public: 32 public:
28 explicit SkTScopedComPtr(T *ptr = NULL) : fPtr(ptr) { } 33 explicit SkTScopedComPtr(T *ptr = NULL) : fPtr(ptr) { }
29 ~SkTScopedComPtr() { 34 ~SkTScopedComPtr() {
30 this->reset(); 35 this->reset();
31 } 36 }
(...skipping 23 matching lines...) Expand all
55 } 60 }
56 61
57 T* release() { 62 T* release() {
58 T* temp = this->fPtr; 63 T* temp = this->fPtr;
59 this->fPtr = NULL; 64 this->fPtr = NULL;
60 return temp; 65 return temp;
61 } 66 }
62 }; 67 };
63 68
64 #endif 69 #endif
OLDNEW
« no previous file with comments | « include/core/SkTemplates.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | src/gpu/gl/GrGLCaps.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698