| 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 <objbase.h> | 8 #include <objbase.h> |
| 9 #include <unknwn.h> | 9 #include <unknwn.h> |
| 10 | 10 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 bool operator!=(const U* rhs) const { | 207 bool operator!=(const U* rhs) const { |
| 208 return ptr_ != rhs; | 208 return ptr_ != rhs; |
| 209 } | 209 } |
| 210 | 210 |
| 211 void swap(ScopedComPtr<Interface, interface_id>& r) { | 211 void swap(ScopedComPtr<Interface, interface_id>& r) { |
| 212 Interface* tmp = ptr_; | 212 Interface* tmp = ptr_; |
| 213 ptr_ = r.ptr_; | 213 ptr_ = r.ptr_; |
| 214 r.ptr_ = tmp; | 214 r.ptr_ = tmp; |
| 215 } | 215 } |
| 216 | 216 |
| 217 // static methods | |
| 218 static const IID& iid() { | |
| 219 return *interface_id; | |
| 220 } | |
| 221 | |
| 222 private: | 217 private: |
| 223 Interface* ptr_ = nullptr; | 218 Interface* ptr_ = nullptr; |
| 224 }; | 219 }; |
| 225 | 220 |
| 226 template <typename T, typename U> | 221 template <typename T, typename U> |
| 227 bool operator==(const T* lhs, const ScopedComPtr<U>& rhs) { | 222 bool operator==(const T* lhs, const ScopedComPtr<U>& rhs) { |
| 228 return lhs == rhs.get(); | 223 return lhs == rhs.get(); |
| 229 } | 224 } |
| 230 | 225 |
| 231 template <typename T> | 226 template <typename T> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 261 // Helper to make IID_PPV_ARGS work with ScopedComPtr. | 256 // Helper to make IID_PPV_ARGS work with ScopedComPtr. |
| 262 template <typename T> | 257 template <typename T> |
| 263 void** IID_PPV_ARGS_Helper(base::win::ScopedComPtr<T>* pp) throw() { | 258 void** IID_PPV_ARGS_Helper(base::win::ScopedComPtr<T>* pp) throw() { |
| 264 return pp->ReceiveVoid(); | 259 return pp->ReceiveVoid(); |
| 265 } | 260 } |
| 266 | 261 |
| 267 } // namespace win | 262 } // namespace win |
| 268 } // namespace base | 263 } // namespace base |
| 269 | 264 |
| 270 #endif // BASE_WIN_SCOPED_COMPTR_H_ | 265 #endif // BASE_WIN_SCOPED_COMPTR_H_ |
| OLD | NEW |