Use UintToString() for unsigned values.
[chromium-blink-merge.git] / base / win / iunknown_impl.cc
blob9baa0f3d6724be75db27ee2af4b0e8e23724385a
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/win/iunknown_impl.h"
7 namespace base {
8 namespace win {
10 IUnknownImpl::IUnknownImpl()
11 : ref_count_(0) {
14 IUnknownImpl::~IUnknownImpl() {
17 ULONG STDMETHODCALLTYPE IUnknownImpl::AddRef() {
18 base::AtomicRefCountInc(&ref_count_);
19 return 1;
22 ULONG STDMETHODCALLTYPE IUnknownImpl::Release() {
23 if (!base::AtomicRefCountDec(&ref_count_)) {
24 delete this;
25 return 0;
27 return 1;
30 STDMETHODIMP IUnknownImpl::QueryInterface(REFIID riid, void** ppv) {
31 if (riid == IID_IUnknown) {
32 *ppv = static_cast<IUnknown*>(this);
33 AddRef();
34 return S_OK;
37 *ppv = NULL;
38 return E_NOINTERFACE;
41 } // namespace win
42 } // namespace base