|
1 /* |
|
2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
|
3 * |
|
4 * Redistribution and use in source and binary forms, with or without |
|
5 * modification, are permitted provided that the following conditions |
|
6 * are met: |
|
7 * |
|
8 * 1. Redistributions of source code must retain the above copyright |
|
9 * notice, this list of conditions and the following disclaimer. |
|
10 * 2. Redistributions in binary form must reproduce the above copyright |
|
11 * notice, this list of conditions and the following disclaimer in the |
|
12 * documentation and/or other materials provided with the distribution. |
|
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of |
|
14 * its contributors may be used to endorse or promote products derived |
|
15 * from this software without specific prior written permission. |
|
16 * |
|
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
|
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
|
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
|
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
27 */ |
|
28 |
|
29 #include "config.h" |
|
30 #include "WebKitDLL.h" |
|
31 #include "WebKitStatistics.h" |
|
32 |
|
33 #include "WebKitStatisticsPrivate.h" |
|
34 |
|
35 int WebViewCount; |
|
36 int WebDataSourceCount; |
|
37 int WebFrameCount; |
|
38 int WebHTMLRepresentationCount; |
|
39 int WebFrameViewCount; |
|
40 |
|
41 // WebKitStatistics --------------------------------------------------------------------------- |
|
42 |
|
43 WebKitStatistics::WebKitStatistics() |
|
44 : m_refCount(0) |
|
45 { |
|
46 gClassCount++; |
|
47 } |
|
48 |
|
49 WebKitStatistics::~WebKitStatistics() |
|
50 { |
|
51 gClassCount--; |
|
52 } |
|
53 |
|
54 WebKitStatistics* WebKitStatistics::createInstance() |
|
55 { |
|
56 WebKitStatistics* instance = new WebKitStatistics(); |
|
57 instance->AddRef(); |
|
58 return instance; |
|
59 } |
|
60 |
|
61 // IUnknown ------------------------------------------------------------------- |
|
62 |
|
63 HRESULT STDMETHODCALLTYPE WebKitStatistics::QueryInterface(REFIID riid, void** ppvObject) |
|
64 { |
|
65 *ppvObject = 0; |
|
66 if (IsEqualGUID(riid, IID_IUnknown)) |
|
67 *ppvObject = static_cast<WebKitStatistics*>(this); |
|
68 else if (IsEqualGUID(riid, IID_IWebKitStatistics)) |
|
69 *ppvObject = static_cast<WebKitStatistics*>(this); |
|
70 else |
|
71 return E_NOINTERFACE; |
|
72 |
|
73 AddRef(); |
|
74 return S_OK; |
|
75 } |
|
76 |
|
77 ULONG STDMETHODCALLTYPE WebKitStatistics::AddRef(void) |
|
78 { |
|
79 return ++m_refCount; |
|
80 } |
|
81 |
|
82 ULONG STDMETHODCALLTYPE WebKitStatistics::Release(void) |
|
83 { |
|
84 ULONG newRef = --m_refCount; |
|
85 if (!newRef) |
|
86 delete(this); |
|
87 |
|
88 return newRef; |
|
89 } |
|
90 |
|
91 // IWebKitStatistics ------------------------------------------------------------------------------ |
|
92 |
|
93 HRESULT STDMETHODCALLTYPE WebKitStatistics::webViewCount( |
|
94 /* [retval][out] */ int *count) |
|
95 { |
|
96 *count = WebViewCount; |
|
97 return S_OK; |
|
98 } |
|
99 |
|
100 HRESULT STDMETHODCALLTYPE WebKitStatistics::frameCount( |
|
101 /* [retval][out] */ int *count) |
|
102 { |
|
103 *count = WebFrameCount; |
|
104 return S_OK; |
|
105 } |
|
106 |
|
107 HRESULT STDMETHODCALLTYPE WebKitStatistics::dataSourceCount( |
|
108 /* [retval][out] */ int *count) |
|
109 { |
|
110 *count = WebDataSourceCount; |
|
111 return S_OK; |
|
112 } |
|
113 |
|
114 HRESULT STDMETHODCALLTYPE WebKitStatistics::viewCount( |
|
115 /* [retval][out] */ int *count) |
|
116 { |
|
117 *count = WebFrameViewCount; |
|
118 return S_OK; |
|
119 } |
|
120 |
|
121 HRESULT STDMETHODCALLTYPE WebKitStatistics::HTMLRepresentationCount( |
|
122 /* [retval][out] */ int *count) |
|
123 { |
|
124 *count = WebHTMLRepresentationCount; |
|
125 return S_OK; |
|
126 } |
|
127 |
|
128 HRESULT STDMETHODCALLTYPE WebKitStatistics::comClassCount( |
|
129 /* [retval][out] */ int *classCount) |
|
130 { |
|
131 *classCount = gClassCount; |
|
132 return S_OK; |
|
133 } |