Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1997)

Unified Diff: base/win/scoped_comptr.h

Issue 3781009: Move the windows-specific scoped_* stuff from base to base/win and in the bas... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698