diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 21:49:48 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 21:49:48 +0000 |
commit | eee8cf2ca4a672e682d28a81af736fc34b48f13f (patch) | |
tree | d157a6ab8c0f8c605b6a4aec5a1b3283288ee95a | |
parent | ae376ecbf0ff71046478481163cb77140e5026e9 (diff) | |
download | chromium_src-eee8cf2ca4a672e682d28a81af736fc34b48f13f.zip chromium_src-eee8cf2ca4a672e682d28a81af736fc34b48f13f.tar.gz chromium_src-eee8cf2ca4a672e682d28a81af736fc34b48f13f.tar.bz2 |
Remove unused class (classfactory) from common project.
BUG=None
TEST=None
Patch contributed by thiago.farina@gmail.com
Review: http://codereview.chromium.org/343079
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31133 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | chrome/chrome.gyp | 3 | ||||
-rw-r--r-- | chrome/common/classfactory.cc | 54 | ||||
-rw-r--r-- | chrome/common/classfactory.h | 70 |
3 files changed, 0 insertions, 127 deletions
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index aa8d6d1..7860605 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -597,8 +597,6 @@ 'common/chrome_plugin_lib.h', 'common/chrome_plugin_util.cc', 'common/chrome_plugin_util.h', - 'common/classfactory.cc', - 'common/classfactory.h', 'common/common_glue.cc', 'common/common_param_traits.cc', 'common/common_param_traits.h', @@ -760,7 +758,6 @@ ], }, { # else: OS != "win" 'sources!': [ - 'common/classfactory.cc', 'common/temp_scaffolding_stubs.h', ], }], diff --git a/chrome/common/classfactory.cc b/chrome/common/classfactory.cc deleted file mode 100644 index e03a0d7..0000000 --- a/chrome/common/classfactory.cc +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "classfactory.h" - - -GenericClassFactory::GenericClassFactory() : - reference_count_(1) -{ - InterlockedIncrement(&object_count_); -} - - -GenericClassFactory::~GenericClassFactory() { - InterlockedDecrement(&object_count_); -} - - -LONG GenericClassFactory::object_count_ = 0; - - -STDMETHODIMP GenericClassFactory::QueryInterface(REFIID riid, - LPVOID* ppobject) { - *ppobject = NULL; - - if (IsEqualIID(riid, IID_IUnknown) || - IsEqualIID(riid, IID_IClassFactory)) - *ppobject = static_cast<IClassFactory*>(this); - else - return E_NOINTERFACE; - - this->AddRef(); - return S_OK; -} - - -STDMETHODIMP_(ULONG) GenericClassFactory::AddRef() { - return InterlockedIncrement(&reference_count_); -} - - -STDMETHODIMP_(ULONG) GenericClassFactory::Release() { - if(0 == InterlockedDecrement(&reference_count_)) { - delete this; - return 0; - } - return reference_count_; -} - - -STDMETHODIMP GenericClassFactory::LockServer(BOOL) { - return E_NOTIMPL; -} diff --git a/chrome/common/classfactory.h b/chrome/common/classfactory.h deleted file mode 100644 index df1ff74..0000000 --- a/chrome/common/classfactory.h +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// ClassFactory<class> -// is a simple class factory object for the parameterized class. -// -#ifndef CHROME_COMMON_CLASSFACTORY_H_ -#define CHROME_COMMON_CLASSFACTORY_H_ - -#include <unknwn.h> - -// GenericClassFactory -// provides the basic COM plumbing to implement IClassFactory, and -// maintains a static count on the number of these objects in existence. -// It remains for subclasses to implement CreateInstance. -class GenericClassFactory : public IClassFactory { - public: - GenericClassFactory(); - ~GenericClassFactory(); - - // IUnknown methods - STDMETHOD(QueryInterface)(REFIID iid, LPVOID* ppvObject); - STDMETHOD_(ULONG, AddRef)(); - STDMETHOD_(ULONG, Release)(); - - // IClassFactory methods - STDMETHOD(CreateInstance)(LPUNKNOWN pUnkOuter, REFIID riid, - LPVOID* ppvObject) = 0; - STDMETHOD(LockServer)(BOOL fLock); - - // generally handy for DllUnloadNow -- count of existing descendant objects - static LONG GetObjectCount() { return object_count_; } - - protected: - LONG reference_count_; // mind the reference counting for this object - static LONG object_count_; // count of all these objects -}; - - -// OneClassFactory<T> -// Knows how to be a factory for T's -template <class T> -class OneClassFactory : public GenericClassFactory { - public: - // IClassFactory methods - STDMETHOD(CreateInstance)(LPUNKNOWN pUnkOuter, REFIID riid, void** ppvObject); -}; - - -template <class T> -STDMETHODIMP OneClassFactory<T>::CreateInstance(LPUNKNOWN pUnkOuter, - REFIID riid, void** result) { - *result = NULL; - - if (pUnkOuter != NULL) - return CLASS_E_NOAGGREGATION; - - T* const obj = new T(); - if (!obj) - return E_OUTOFMEMORY; - - obj->AddRef(); - HRESULT const hr = obj->QueryInterface(riid, result); - obj->Release(); - - return hr; -} - -#endif // CHROME_COMMON_CLASSFACTORY_H_ |