Index: base/win/scoped_comptr.h |
diff --git a/base/win/scoped_comptr.h b/base/win/scoped_comptr.h |
index 5ce60e2b688f603b2b681e42a270e41e6156f704..ee232898c842c9cff57c03ff95a86f38af69b0a5 100644 |
--- a/base/win/scoped_comptr.h |
+++ b/base/win/scoped_comptr.h |
@@ -40,14 +40,6 @@ class ScopedComPtr : public scoped_refptr<Interface> { |
: ParentClass(p) { |
} |
- ~ScopedComPtr() { |
- // We don't want the smart pointer class to be bigger than the pointer |
- // it wraps. |
- static_assert( |
- sizeof(ScopedComPtr<Interface, interface_id>) == sizeof(Interface*), |
- "ScopedComPtrSize"); |
- } |
- |
// Explicit Release() of the held object. Useful for reuse of the |
// ScopedComPtr instance. |
// Note that this function equates to IUnknown::Release and should not |
@@ -70,6 +62,7 @@ class ScopedComPtr : public scoped_refptr<Interface> { |
// Accepts an interface pointer that has already been addref-ed. |
void Attach(Interface* p) { |
DCHECK(!this->ptr_); |
+ this->ptr_caller_ = &ParentClass::PtrCallerImpl; |
this->ptr_ = p; |
} |
@@ -79,6 +72,7 @@ class ScopedComPtr : public scoped_refptr<Interface> { |
// Usage: Foo(p.Receive()); |
Interface** Receive() { |
DCHECK(!this->ptr_) << "Object leak. Pointer must be NULL"; |
+ this->ptr_caller_ = &ParentClass::PtrCallerImpl; |
return &this->ptr_; |
} |
@@ -114,9 +108,8 @@ class ScopedComPtr : public scoped_refptr<Interface> { |
// Convenience wrapper around CoCreateInstance |
HRESULT CreateInstance(const CLSID& clsid, IUnknown* outer = NULL, |
DWORD context = CLSCTX_ALL) { |
- DCHECK(!this->ptr_); |
HRESULT hr = ::CoCreateInstance(clsid, outer, context, *interface_id, |
- reinterpret_cast<void**>(&this->ptr_)); |
+ ReceiveVoid()); |
return hr; |
} |