diff options
Diffstat (limited to 'base/scoped_comptr_win.h')
-rw-r--r-- | base/scoped_comptr_win.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/base/scoped_comptr_win.h b/base/scoped_comptr_win.h index 8f677a0..d627223 100644 --- a/base/scoped_comptr_win.h +++ b/base/scoped_comptr_win.h @@ -12,13 +12,13 @@ // 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:
+template <class Interface> +class BlockIUnknownMethods : public Interface { + private: STDMETHOD(QueryInterface)(REFIID iid, void** object) = 0; - STDMETHOD_(ULONG, AddRef)() = 0;
- STDMETHOD_(ULONG, Release)() = 0;
-};
+ STDMETHOD_(ULONG, AddRef)() = 0; + STDMETHOD_(ULONG, Release)() = 0; +}; // A fairly minimalistic smart class for COM interface pointers. // Uses scoped_refptr for the basic smart pointer functionality @@ -109,18 +109,18 @@ class ScopedComPtr : public scoped_refptr<Interface> { bool IsSameObject(IUnknown* other) { if (!other && !ptr_) return true; -
- if (!other || !ptr_)
- return false;
-
- ScopedComPtr<IUnknown> my_identity;
- QueryInterface(my_identity.Receive());
-
- ScopedComPtr<IUnknown> other_identity;
- other->QueryInterface(other_identity.Receive());
-
- return static_cast<IUnknown*>(my_identity) ==
- static_cast<IUnknown*>(other_identity);
+ + if (!other || !ptr_) + return false; + + ScopedComPtr<IUnknown> my_identity; + QueryInterface(my_identity.Receive()); + + ScopedComPtr<IUnknown> other_identity; + other->QueryInterface(other_identity.Receive()); + + return static_cast<IUnknown*>(my_identity) == + static_cast<IUnknown*>(other_identity); } // Provides direct access to the interface. |