OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
4 * | 3 * |
5 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 #ifndef SkTScopedComPtr_DEFINED | 8 #ifndef SkTScopedComPtr_DEFINED |
10 #define SkTScopedComPtr_DEFINED | 9 #define SkTScopedComPtr_DEFINED |
11 | 10 |
12 #include "SkTypes.h" | 11 #include "SkTypes.h" |
13 #include "SkTemplates.h" | |
14 | 12 |
15 template<typename T> | 13 template<typename T> |
16 class SkBlockComRef : public T { | 14 class SkBlockComRef : public T { |
17 private: | 15 private: |
18 virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0; | 16 virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0; |
19 virtual ULONG STDMETHODCALLTYPE Release(void) = 0; | 17 virtual ULONG STDMETHODCALLTYPE Release(void) = 0; |
20 }; | 18 }; |
21 | 19 |
22 template<typename T> T* SkRefComPtr(T* ptr) { | 20 template<typename T> T* SkRefComPtr(T* ptr) { |
23 ptr->AddRef(); | 21 ptr->AddRef(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 65 } |
68 | 66 |
69 T* release() { | 67 T* release() { |
70 T* temp = this->fPtr; | 68 T* temp = this->fPtr; |
71 this->fPtr = NULL; | 69 this->fPtr = NULL; |
72 return temp; | 70 return temp; |
73 } | 71 } |
74 }; | 72 }; |
75 | 73 |
76 #endif | 74 #endif |
OLD | NEW |