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

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

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments. Created 4 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
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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 sk_sp<T>& operator=(sk_sp<T>&& that) { 323 sk_sp<T>& operator=(sk_sp<T>&& that) {
324 this->reset(that.release()); 324 this->reset(that.release());
325 return *this; 325 return *this;
326 } 326 }
327 template <typename U, typename = skstd::enable_if_t<std::is_convertible<U*, T*>::value>> 327 template <typename U, typename = skstd::enable_if_t<std::is_convertible<U*, T*>::value>>
328 sk_sp<T>& operator=(sk_sp<U>&& that) { 328 sk_sp<T>& operator=(sk_sp<U>&& that) {
329 this->reset(that.release()); 329 this->reset(that.release());
330 return *this; 330 return *this;
331 } 331 }
332 332
333 T& operator*() const { 333 skstd::add_lvalue_reference_t<T> operator*() const {
reed1 2016/05/01 18:53:52 Is this change a necessary part of the "typeface"
bungeman-skia 2016/05/02 20:24:54 No, I'll stick this in another CL, it got mixed up
334 SkASSERT(this->get() != nullptr); 334 SkASSERT(this->get() != nullptr);
335 return *this->get(); 335 return *this->get();
336 } 336 }
337 337
338 // MSVC 2013 does not work correctly with explicit operator bool. 338 // MSVC 2013 does not work correctly with explicit operator bool.
339 // https://chromium-cpp.appspot.com/#core-blacklist 339 // https://chromium-cpp.appspot.com/#core-blacklist
340 // When explicit operator bool can be used, remove operator! and operator un specified_bool_type. 340 // When explicit operator bool can be used, remove operator! and operator un specified_bool_type.
341 //explicit operator bool() const { return this->get() != nullptr; } 341 //explicit operator bool() const { return this->get() != nullptr; }
342 operator unspecified_bool_type() const { return this->get() ? &sk_sp::fPtr : nullptr; } 342 operator unspecified_bool_type() const { return this->get() ? &sk_sp::fPtr : nullptr; }
343 bool operator!() const { return this->get() == nullptr; } 343 bool operator!() const { return this->get() == nullptr; }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 * 460 *
461 * This function may be helpful while we convert callers from ptr-based to sk_s p-based parameters. 461 * This function may be helpful while we convert callers from ptr-based to sk_s p-based parameters.
462 */ 462 */
463 template <typename T> sk_sp<T> sk_ref_sp(T* obj) { 463 template <typename T> sk_sp<T> sk_ref_sp(T* obj) {
464 return sk_sp<T>(SkSafeRef(obj)); 464 return sk_sp<T>(SkSafeRef(obj));
465 } 465 }
466 466
467 #endif 467 #endif
468 468
469 #endif 469 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698