Remove a static initializer from ScopedCAPIHandle
BUG=87171 TEST=none Review URL: http://codereview.chromium.org/7776025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98923 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@ -51,12 +51,13 @@ class ScopedCAPIHandle {
|
|||||||
explicit ScopedCAPIHandle(CAPIHandle handle = NULL) : handle_(handle) {}
|
explicit ScopedCAPIHandle(CAPIHandle handle = NULL) : handle_(handle) {}
|
||||||
|
|
||||||
~ScopedCAPIHandle() {
|
~ScopedCAPIHandle() {
|
||||||
free_(handle_);
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset(CAPIHandle handle = NULL) {
|
void reset(CAPIHandle handle = NULL) {
|
||||||
if (handle_ != handle) {
|
if (handle_ != handle) {
|
||||||
free_(handle_);
|
FreeProc free_proc;
|
||||||
|
free_proc(handle_);
|
||||||
handle_ = handle;
|
handle_ = handle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,14 +92,10 @@ class ScopedCAPIHandle {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
CAPIHandle handle_;
|
CAPIHandle handle_;
|
||||||
static const FreeProc free_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(ScopedCAPIHandle);
|
DISALLOW_COPY_AND_ASSIGN(ScopedCAPIHandle);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class CH, typename FP>
|
|
||||||
const FP ScopedCAPIHandle<CH, FP>::free_ = FP();
|
|
||||||
|
|
||||||
template<class CH, typename FP> inline
|
template<class CH, typename FP> inline
|
||||||
bool operator==(CH h, const ScopedCAPIHandle<CH, FP>& b) {
|
bool operator==(CH h, const ScopedCAPIHandle<CH, FP>& b) {
|
||||||
return h == b.get();
|
return h == b.get();
|
||||||
|
Reference in New Issue
Block a user