OLD | NEW |
1 // | 1 // |
2 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include "classfactory.h" | 6 #include "classfactory.h" |
7 | 7 |
8 | 8 |
9 GenericClassFactory::GenericClassFactory() : | 9 GenericClassFactory::GenericClassFactory() : |
10 reference_count_(1) | 10 reference_count_(1) |
11 { | 11 { |
12 InterlockedIncrement(&object_count_); | 12 InterlockedIncrement(&object_count_); |
13 } | 13 } |
14 | 14 |
15 | 15 |
16 GenericClassFactory::~GenericClassFactory() { | 16 GenericClassFactory::~GenericClassFactory() { |
17 InterlockedDecrement(&object_count_); | 17 InterlockedDecrement(&object_count_); |
18 } | 18 } |
19 | 19 |
20 | 20 |
21 LONG GenericClassFactory::object_count_ = 0; | 21 LONG GenericClassFactory::object_count_ = 0; |
22 | 22 |
23 | 23 |
24 STDMETHODIMP GenericClassFactory::QueryInterface(REFIID riid, LPVOID* ppobject)
{ | 24 STDMETHODIMP GenericClassFactory::QueryInterface(REFIID riid, |
| 25 LPVOID* ppobject) { |
25 *ppobject = NULL; | 26 *ppobject = NULL; |
26 | 27 |
27 if (IsEqualIID(riid, IID_IUnknown) || | 28 if (IsEqualIID(riid, IID_IUnknown) || |
28 IsEqualIID(riid, IID_IClassFactory)) | 29 IsEqualIID(riid, IID_IClassFactory)) |
29 *ppobject = static_cast<IClassFactory*>(this); | 30 *ppobject = static_cast<IClassFactory*>(this); |
30 else | 31 else |
31 return E_NOINTERFACE; | 32 return E_NOINTERFACE; |
32 | 33 |
33 this->AddRef(); | 34 this->AddRef(); |
34 return S_OK; | 35 return S_OK; |
(...skipping 11 matching lines...) Expand all Loading... |
46 return 0; | 47 return 0; |
47 } | 48 } |
48 return reference_count_; | 49 return reference_count_; |
49 } | 50 } |
50 | 51 |
51 | 52 |
52 STDMETHODIMP GenericClassFactory::LockServer(BOOL) { | 53 STDMETHODIMP GenericClassFactory::LockServer(BOOL) { |
53 return E_NOTIMPL; | 54 return E_NOTIMPL; |
54 } | 55 } |
55 | 56 |
OLD | NEW |