| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 BASE_WIN_SCOPED_COMPTR_H_ | 5 #ifndef BASE_WIN_SCOPED_COMPTR_H_ |
| 6 #define BASE_WIN_SCOPED_COMPTR_H_ | 6 #define BASE_WIN_SCOPED_COMPTR_H_ |
| 7 | 7 |
| 8 #include <unknwn.h> | 8 #include <unknwn.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 template <typename U> | 175 template <typename U> |
| 176 bool operator!=(const U* rhs) const { | 176 bool operator!=(const U* rhs) const { |
| 177 return ptr_ != rhs; | 177 return ptr_ != rhs; |
| 178 } | 178 } |
| 179 | 179 |
| 180 details::ScopedComPtrRef<ScopedComPtr<Interface>> operator&() { | 180 details::ScopedComPtrRef<ScopedComPtr<Interface>> operator&() { |
| 181 return details::ScopedComPtrRef<ScopedComPtr<Interface>>(this); | 181 return details::ScopedComPtrRef<ScopedComPtr<Interface>>(this); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void swap(ScopedComPtr<Interface>& r) { | 184 void Swap(ScopedComPtr<Interface>& r) { |
| 185 Interface* tmp = ptr_; | 185 Interface* tmp = ptr_; |
| 186 ptr_ = r.ptr_; | 186 ptr_ = r.ptr_; |
| 187 r.ptr_ = tmp; | 187 r.ptr_ = tmp; |
| 188 } | 188 } |
| 189 | 189 |
| 190 private: | 190 private: |
| 191 Interface* ptr_ = nullptr; | 191 Interface* ptr_ = nullptr; |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 namespace details { | 194 namespace details { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 // Helper to make IID_PPV_ARGS work with ScopedComPtr. | 256 // Helper to make IID_PPV_ARGS work with ScopedComPtr. |
| 257 template <typename T> | 257 template <typename T> |
| 258 void** IID_PPV_ARGS_Helper(base::win::details::ScopedComPtrRef<T> pp) throw() { | 258 void** IID_PPV_ARGS_Helper(base::win::details::ScopedComPtrRef<T> pp) throw() { |
| 259 return pp; | 259 return pp; |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace win | 262 } // namespace win |
| 263 } // namespace base | 263 } // namespace base |
| 264 | 264 |
| 265 #endif // BASE_WIN_SCOPED_COMPTR_H_ | 265 #endif // BASE_WIN_SCOPED_COMPTR_H_ |
| OLD | NEW |