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

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

Issue 1757593005: sk_sp: remove explicit operator bool() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: operator!() 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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * 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
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkRefCnt_DEFINED 8 #ifndef SkRefCnt_DEFINED
9 #define SkRefCnt_DEFINED 9 #define SkRefCnt_DEFINED
10 10
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 this->reset(that.release()); 288 this->reset(that.release());
289 return *this; 289 return *this;
290 } 290 }
291 291
292 bool operator==(std::nullptr_t) const { return this->get() == nullptr; } 292 bool operator==(std::nullptr_t) const { return this->get() == nullptr; }
293 bool operator!=(std::nullptr_t) const { return this->get() != nullptr; } 293 bool operator!=(std::nullptr_t) const { return this->get() != nullptr; }
294 294
295 bool operator==(const sk_sp<T>& that) const { return this->get() == that.get (); } 295 bool operator==(const sk_sp<T>& that) const { return this->get() == that.get (); }
296 bool operator!=(const sk_sp<T>& that) const { return this->get() != that.get (); } 296 bool operator!=(const sk_sp<T>& that) const { return this->get() != that.get (); }
297 297
298 explicit operator bool() const { return this->get() != nullptr; } 298 // MSVC 2013 does not work correctly with explicit operator bool.
299 // https://chromium-cpp.appspot.com/#core-blacklist
300 //explicit operator bool() const { return this->get() != nullptr; }
301
302 bool operator!() const { return this->get() == nullptr; }
299 303
300 T* get() const { return fPtr; } 304 T* get() const { return fPtr; }
301 T* operator->() const { return fPtr; } 305 T* operator->() const { return fPtr; }
302 306
303 /** 307 /**
304 * Adopt the new bare pointer, and call unref() on any previously held obje ct (if not null). 308 * Adopt the new bare pointer, and call unref() on any previously held obje ct (if not null).
305 * No call to ref() will be made. 309 * No call to ref() will be made.
306 */ 310 */
307 void reset(T* ptr = nullptr) { 311 void reset(T* ptr = nullptr) {
308 if (fPtr != ptr) { 312 if (fPtr != ptr) {
(...skipping 11 matching lines...) Expand all
320 T* ptr = fPtr; 324 T* ptr = fPtr;
321 fPtr = nullptr; 325 fPtr = nullptr;
322 return ptr; 326 return ptr;
323 } 327 }
324 328
325 private: 329 private:
326 T* fPtr; 330 T* fPtr;
327 }; 331 };
328 332
329 #endif 333 #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