Chromium Code Reviews| Index: base/win/scoped_comptr.h |
| =================================================================== |
| --- base/win/scoped_comptr.h (revision 62694) |
| +++ base/win/scoped_comptr.h (working copy) |
| @@ -2,8 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef BASE_SCOPED_COMPTR_WIN_H_ |
| -#define BASE_SCOPED_COMPTR_WIN_H_ |
| +#ifndef BASE_WIN_SCOPED_COMPTR_H_ |
| +#define BASE_WIN_SCOPED_COMPTR_H_ |
| #pragma once |
| #include <unknwn.h> |
| @@ -11,15 +11,8 @@ |
| #include "base/logging.h" |
| #include "base/ref_counted.h" |
| -// Utility template to prevent users of ScopedComPtr from calling AddRef and/or |
| -// Release() without going through the ScopedComPtr class. |
| -template <class Interface> |
| -class BlockIUnknownMethods : public Interface { |
| - private: |
| - STDMETHOD(QueryInterface)(REFIID iid, void** object) = 0; |
| - STDMETHOD_(ULONG, AddRef)() = 0; |
| - STDMETHOD_(ULONG, Release)() = 0; |
| -}; |
| +namespace base { |
| +namespace win { |
| // A fairly minimalistic smart class for COM interface pointers. |
| // Uses scoped_refptr for the basic smart pointer functionality |
| @@ -27,6 +20,16 @@ |
| template <class Interface, const IID* interface_id = &__uuidof(Interface)> |
| class ScopedComPtr : public scoped_refptr<Interface> { |
| public: |
| + // Utility template to prevent users of ScopedComPtr from calling AddRef |
| + // and/or Release() without going through the ScopedComPtr class. |
| + template <class Interface> |
|
darin (slow to review)
2010/10/15 05:58:11
this does not need the template prefix since it is
|
| + class BlockIUnknownMethods : public Interface { |
| + private: |
| + STDMETHOD(QueryInterface)(REFIID iid, void** object) = 0; |
| + STDMETHOD_(ULONG, AddRef)() = 0; |
| + STDMETHOD_(ULONG, Release)() = 0; |
| + }; |
| + |
| typedef scoped_refptr<Interface> ParentClass; |
| ScopedComPtr() { |
| @@ -156,4 +159,7 @@ |
| } |
| }; |
| -#endif // BASE_SCOPED_COMPTR_WIN_H_ |
| +} // namespace win |
| +} // namespace base |
| + |
| +#endif // BASE_WIN_SCOPED_COMPTR_H_ |