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

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

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 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 | « include/pipe/SkGPipe.h ('k') | include/views/SkView.h » ('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 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 SkTScopedComPtr_DEFINED 9 #ifndef SkTScopedComPtr_DEFINED
10 #define SkTScopedComPtr_DEFINED 10 #define SkTScopedComPtr_DEFINED
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 /** 48 /**
49 * Returns the address of the underlying pointer. 49 * Returns the address of the underlying pointer.
50 * This is dangerous -- it breaks encapsulation and the reference escapes. 50 * This is dangerous -- it breaks encapsulation and the reference escapes.
51 * Must only be used on instances currently pointing to NULL, 51 * Must only be used on instances currently pointing to NULL,
52 * and only to initialize the instance. 52 * and only to initialize the instance.
53 */ 53 */
54 T **operator&() { SkASSERT(fPtr == NULL); return &fPtr; } 54 T **operator&() { SkASSERT(fPtr == NULL); return &fPtr; }
55 T *get() const { return fPtr; } 55 T *get() const { return fPtr; }
56 void reset() { 56 void reset() {
57 if (NULL != this->fPtr) { 57 if (this->fPtr) {
58 this->fPtr->Release(); 58 this->fPtr->Release();
59 this->fPtr = NULL; 59 this->fPtr = NULL;
60 } 60 }
61 } 61 }
62 62
63 void swap(SkTScopedComPtr<T>& that) { 63 void swap(SkTScopedComPtr<T>& that) {
64 T* temp = this->fPtr; 64 T* temp = this->fPtr;
65 this->fPtr = that.fPtr; 65 this->fPtr = that.fPtr;
66 that.fPtr = temp; 66 that.fPtr = temp;
67 } 67 }
68 68
69 T* release() { 69 T* release() {
70 T* temp = this->fPtr; 70 T* temp = this->fPtr;
71 this->fPtr = NULL; 71 this->fPtr = NULL;
72 return temp; 72 return temp;
73 } 73 }
74 }; 74 };
75 75
76 #endif 76 #endif
OLDNEW
« no previous file with comments | « include/pipe/SkGPipe.h ('k') | include/views/SkView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698