| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef LIBRARIES_SDK_UTIL_SCOPED_REF_H_ | 5 #ifndef LIBRARIES_SDK_UTIL_SCOPED_REF_H_ |
| 6 #define LIBRARIES_SDK_UTIL_SCOPED_REF_H_ | 6 #define LIBRARIES_SDK_UTIL_SCOPED_REF_H_ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include "sdk_util/macros.h" | 10 #include "sdk_util/macros.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 private: | 74 private: |
| 75 typedef void (ScopedRef::*bool_as_func_ptr)() const; | 75 typedef void (ScopedRef::*bool_as_func_ptr)() const; |
| 76 void bool_as_func_impl() const {}; | 76 void bool_as_func_impl() const {}; |
| 77 | 77 |
| 78 public: | 78 public: |
| 79 operator bool_as_func_ptr() const { | 79 operator bool_as_func_ptr() const { |
| 80 return (ptr_ != NULL) ? &ScopedRef::bool_as_func_impl : 0; | 80 return (ptr_ != NULL) ? &ScopedRef::bool_as_func_impl : 0; |
| 81 } | 81 } |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 template <typename U, typename T> |
| 85 ScopedRef<U> static_scoped_ref_cast(const ScopedRef<T>& ptr) { |
| 86 return ScopedRef<U>(static_cast<U*>(ptr.get())); |
| 87 } |
| 88 |
| 84 } // namespace sdk_util | 89 } // namespace sdk_util |
| 85 | 90 |
| 86 #endif // LIBRARIES_SDK_UTIL_SCOPED_REF_H_ | 91 #endif // LIBRARIES_SDK_UTIL_SCOPED_REF_H_ |
| OLD | NEW |