Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/xpcom/build/Services.cpp
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS GENERATED BY Services.py - DO NOT EDIT */
2
3
#include "mozilla/Likely.h"
4
#include "mozilla/Services.h"
5
#include "mozIThirdPartyUtil.h"
6
#include "nsComponentManager.h"
7
#include "nsIObserverService.h"
8
#include "nsNetCID.h"
9
#include "nsObserverService.h"
10
#include "nsXPCOMPrivate.h"
11
#include "nsIIOService.h"
12
#include "nsIDirectoryService.h"
13
#include "nsIChromeRegistry.h"
14
#include "nsIStringBundle.h"
15
#include "nsIToolkitChromeRegistry.h"
16
#include "IHistory.h"
17
#include "nsIXPConnect.h"
18
#include "nsIPermissionManager.h"
19
#include "nsIServiceWorkerManager.h"
20
#include "nsICacheStorageService.h"
21
#include "nsIStreamTransportService.h"
22
#include "nsISocketTransportService.h"
23
#include "nsIURIClassifier.h"
24
#include "nsIHttpActivityObserver.h"
25
#include "nsIAsyncShutdown.h"
26
#include "nsIUUIDGenerator.h"
27
#include "nsIGfxInfo.h"
28
29
static nsIChromeRegistry* gChromeRegistryService = nullptr;
30
31
extern "C" {
32
/**
33
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
34
 * This method is extern "C" to expose XPCOM services to rust code.
35
 * The return value is already addrefed.
36
 */
37
nsIChromeRegistry*
38
XPCOMService_GetChromeRegistryService()
39
6
{
40
6
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
41
0
    return nullptr;
42
0
  }
43
6
  if (!gChromeRegistryService) {
44
3
    nsCOMPtr<nsIChromeRegistry> os = do_GetService("@mozilla.org/chrome/chrome-registry;1");
45
3
    os.swap(gChromeRegistryService);
46
3
  }
47
6
  return do_AddRef(gChromeRegistryService).take();
48
6
}
49
} // extern "C"
50
51
static nsIToolkitChromeRegistry* gToolkitChromeRegistryService = nullptr;
52
53
extern "C" {
54
/**
55
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
56
 * This method is extern "C" to expose XPCOM services to rust code.
57
 * The return value is already addrefed.
58
 */
59
nsIToolkitChromeRegistry*
60
XPCOMService_GetToolkitChromeRegistryService()
61
0
{
62
0
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
63
0
    return nullptr;
64
0
  }
65
0
  if (!gToolkitChromeRegistryService) {
66
0
    nsCOMPtr<nsIToolkitChromeRegistry> os = do_GetService("@mozilla.org/chrome/chrome-registry;1");
67
0
    os.swap(gToolkitChromeRegistryService);
68
0
  }
69
0
  return do_AddRef(gToolkitChromeRegistryService).take();
70
0
}
71
} // extern "C"
72
73
static nsIXULChromeRegistry* gXULChromeRegistryService = nullptr;
74
75
extern "C" {
76
/**
77
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
78
 * This method is extern "C" to expose XPCOM services to rust code.
79
 * The return value is already addrefed.
80
 */
81
nsIXULChromeRegistry*
82
XPCOMService_GetXULChromeRegistryService()
83
0
{
84
0
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
85
0
    return nullptr;
86
0
  }
87
0
  if (!gXULChromeRegistryService) {
88
0
    nsCOMPtr<nsIXULChromeRegistry> os = do_GetService("@mozilla.org/chrome/chrome-registry;1");
89
0
    os.swap(gXULChromeRegistryService);
90
0
  }
91
0
  return do_AddRef(gXULChromeRegistryService).take();
92
0
}
93
} // extern "C"
94
95
static nsIIOService* gIOService = nullptr;
96
97
extern "C" {
98
/**
99
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
100
 * This method is extern "C" to expose XPCOM services to rust code.
101
 * The return value is already addrefed.
102
 */
103
nsIIOService*
104
XPCOMService_GetIOService()
105
3.06M
{
106
3.06M
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
107
0
    return nullptr;
108
0
  }
109
3.06M
  if (!gIOService) {
110
3
    nsCOMPtr<nsIIOService> os = do_GetService("@mozilla.org/network/io-service;1");
111
3
    os.swap(gIOService);
112
3
  }
113
3.06M
  return do_AddRef(gIOService).take();
114
3.06M
}
115
} // extern "C"
116
117
static nsIObserverService* gObserverService = nullptr;
118
119
extern "C" {
120
/**
121
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
122
 * This method is extern "C" to expose XPCOM services to rust code.
123
 * The return value is already addrefed.
124
 */
125
nsIObserverService*
126
XPCOMService_GetObserverService()
127
151
{
128
151
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
129
0
    return nullptr;
130
0
  }
131
151
  if (!gObserverService) {
132
3
    nsCOMPtr<nsIObserverService> os = do_GetService("@mozilla.org/observer-service;1");
133
3
    os.swap(gObserverService);
134
3
  }
135
151
  return do_AddRef(gObserverService).take();
136
151
}
137
} // extern "C"
138
139
static nsIStringBundleService* gStringBundleService = nullptr;
140
141
extern "C" {
142
/**
143
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
144
 * This method is extern "C" to expose XPCOM services to rust code.
145
 * The return value is already addrefed.
146
 */
147
nsIStringBundleService*
148
XPCOMService_GetStringBundleService()
149
0
{
150
0
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
151
0
    return nullptr;
152
0
  }
153
0
  if (!gStringBundleService) {
154
0
    nsCOMPtr<nsIStringBundleService> os = do_GetService("@mozilla.org/intl/stringbundle;1");
155
0
    os.swap(gStringBundleService);
156
0
  }
157
0
  return do_AddRef(gStringBundleService).take();
158
0
}
159
} // extern "C"
160
161
static nsIPermissionManager* gPermissionManager = nullptr;
162
163
extern "C" {
164
/**
165
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
166
 * This method is extern "C" to expose XPCOM services to rust code.
167
 * The return value is already addrefed.
168
 */
169
nsIPermissionManager*
170
XPCOMService_GetPermissionManager()
171
0
{
172
0
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
173
0
    return nullptr;
174
0
  }
175
0
  if (!gPermissionManager) {
176
0
    nsCOMPtr<nsIPermissionManager> os = do_GetService("@mozilla.org/permissionmanager;1");
177
0
    os.swap(gPermissionManager);
178
0
  }
179
0
  return do_AddRef(gPermissionManager).take();
180
0
}
181
} // extern "C"
182
183
static nsIServiceWorkerManager* gServiceWorkerManager = nullptr;
184
185
extern "C" {
186
/**
187
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
188
 * This method is extern "C" to expose XPCOM services to rust code.
189
 * The return value is already addrefed.
190
 */
191
nsIServiceWorkerManager*
192
XPCOMService_GetServiceWorkerManager()
193
0
{
194
0
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
195
0
    return nullptr;
196
0
  }
197
0
  if (!gServiceWorkerManager) {
198
0
    nsCOMPtr<nsIServiceWorkerManager> os = do_GetService("@mozilla.org/serviceworkers/manager;1");
199
0
    os.swap(gServiceWorkerManager);
200
0
  }
201
0
  return do_AddRef(gServiceWorkerManager).take();
202
0
}
203
} // extern "C"
204
205
static nsIAsyncShutdownService* gAsyncShutdown = nullptr;
206
207
extern "C" {
208
/**
209
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
210
 * This method is extern "C" to expose XPCOM services to rust code.
211
 * The return value is already addrefed.
212
 */
213
nsIAsyncShutdownService*
214
XPCOMService_GetAsyncShutdown()
215
0
{
216
0
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
217
0
    return nullptr;
218
0
  }
219
0
  if (!gAsyncShutdown) {
220
0
    nsCOMPtr<nsIAsyncShutdownService> os = do_GetService("@mozilla.org/async-shutdown-service;1");
221
0
    os.swap(gAsyncShutdown);
222
0
  }
223
0
  return do_AddRef(gAsyncShutdown).take();
224
0
}
225
} // extern "C"
226
227
static nsIUUIDGenerator* gUUIDGenerator = nullptr;
228
229
extern "C" {
230
/**
231
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
232
 * This method is extern "C" to expose XPCOM services to rust code.
233
 * The return value is already addrefed.
234
 */
235
nsIUUIDGenerator*
236
XPCOMService_GetUUIDGenerator()
237
12
{
238
12
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
239
0
    return nullptr;
240
0
  }
241
12
  if (!gUUIDGenerator) {
242
3
    nsCOMPtr<nsIUUIDGenerator> os = do_GetService("@mozilla.org/uuid-generator;1");
243
3
    os.swap(gUUIDGenerator);
244
3
  }
245
12
  return do_AddRef(gUUIDGenerator).take();
246
12
}
247
} // extern "C"
248
249
static nsIGfxInfo* gGfxInfo = nullptr;
250
251
extern "C" {
252
/**
253
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
254
 * This method is extern "C" to expose XPCOM services to rust code.
255
 * The return value is already addrefed.
256
 */
257
nsIGfxInfo*
258
XPCOMService_GetGfxInfo()
259
0
{
260
0
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
261
0
    return nullptr;
262
0
  }
263
0
  if (!gGfxInfo) {
264
0
    nsCOMPtr<nsIGfxInfo> os = do_GetService("@mozilla.org/gfx/info;1");
265
0
    os.swap(gGfxInfo);
266
0
  }
267
0
  return do_AddRef(gGfxInfo).take();
268
0
}
269
} // extern "C"
270
271
static nsISocketTransportService* gSocketTransportService = nullptr;
272
273
extern "C" {
274
/**
275
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
276
 * This method is extern "C" to expose XPCOM services to rust code.
277
 * The return value is already addrefed.
278
 */
279
nsISocketTransportService*
280
XPCOMService_GetSocketTransportService()
281
2
{
282
2
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
283
0
    return nullptr;
284
0
  }
285
2
  if (!gSocketTransportService) {
286
1
    nsCOMPtr<nsISocketTransportService> os = do_GetService("@mozilla.org/network/socket-transport-service;1");
287
1
    os.swap(gSocketTransportService);
288
1
  }
289
2
  return do_AddRef(gSocketTransportService).take();
290
2
}
291
} // extern "C"
292
293
static nsIStreamTransportService* gStreamTransportService = nullptr;
294
295
extern "C" {
296
/**
297
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
298
 * This method is extern "C" to expose XPCOM services to rust code.
299
 * The return value is already addrefed.
300
 */
301
nsIStreamTransportService*
302
XPCOMService_GetStreamTransportService()
303
0
{
304
0
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
305
0
    return nullptr;
306
0
  }
307
0
  if (!gStreamTransportService) {
308
0
    nsCOMPtr<nsIStreamTransportService> os = do_GetService("@mozilla.org/network/stream-transport-service;1");
309
0
    os.swap(gStreamTransportService);
310
0
  }
311
0
  return do_AddRef(gStreamTransportService).take();
312
0
}
313
} // extern "C"
314
315
static nsICacheStorageService* gCacheStorageService = nullptr;
316
317
extern "C" {
318
/**
319
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
320
 * This method is extern "C" to expose XPCOM services to rust code.
321
 * The return value is already addrefed.
322
 */
323
nsICacheStorageService*
324
XPCOMService_GetCacheStorageService()
325
0
{
326
0
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
327
0
    return nullptr;
328
0
  }
329
0
  if (!gCacheStorageService) {
330
0
    nsCOMPtr<nsICacheStorageService> os = do_GetService("@mozilla.org/netwerk/cache-storage-service;1");
331
0
    os.swap(gCacheStorageService);
332
0
  }
333
0
  return do_AddRef(gCacheStorageService).take();
334
0
}
335
} // extern "C"
336
337
static nsIURIClassifier* gURIClassifier = nullptr;
338
339
extern "C" {
340
/**
341
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
342
 * This method is extern "C" to expose XPCOM services to rust code.
343
 * The return value is already addrefed.
344
 */
345
nsIURIClassifier*
346
XPCOMService_GetURIClassifier()
347
0
{
348
0
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
349
0
    return nullptr;
350
0
  }
351
0
  if (!gURIClassifier) {
352
0
    nsCOMPtr<nsIURIClassifier> os = do_GetService("@mozilla.org/uriclassifierservice");
353
0
    os.swap(gURIClassifier);
354
0
  }
355
0
  return do_AddRef(gURIClassifier).take();
356
0
}
357
} // extern "C"
358
359
static nsIHttpActivityDistributor* gActivityDistributor = nullptr;
360
361
extern "C" {
362
/**
363
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
364
 * This method is extern "C" to expose XPCOM services to rust code.
365
 * The return value is already addrefed.
366
 */
367
nsIHttpActivityDistributor*
368
XPCOMService_GetActivityDistributor()
369
0
{
370
0
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
371
0
    return nullptr;
372
0
  }
373
0
  if (!gActivityDistributor) {
374
0
    nsCOMPtr<nsIHttpActivityDistributor> os = do_GetService("@mozilla.org/network/http-activity-distributor;1");
375
0
    os.swap(gActivityDistributor);
376
0
  }
377
0
  return do_AddRef(gActivityDistributor).take();
378
0
}
379
} // extern "C"
380
381
static mozilla::IHistory* gHistoryService = nullptr;
382
383
extern "C" {
384
/**
385
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
386
 * This method is extern "C" to expose XPCOM services to rust code.
387
 * The return value is already addrefed.
388
 */
389
mozilla::IHistory*
390
XPCOMService_GetHistoryService()
391
0
{
392
0
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
393
0
    return nullptr;
394
0
  }
395
0
  if (!gHistoryService) {
396
0
    nsCOMPtr<mozilla::IHistory> os = do_GetService("@mozilla.org/browser/history;1");
397
0
    os.swap(gHistoryService);
398
0
  }
399
0
  return do_AddRef(gHistoryService).take();
400
0
}
401
} // extern "C"
402
403
static mozIThirdPartyUtil* gThirdPartyUtil = nullptr;
404
405
extern "C" {
406
/**
407
 * NOTE: Don't call this method directly, instead call `mozilla::services::Get{0}`.
408
 * This method is extern "C" to expose XPCOM services to rust code.
409
 * The return value is already addrefed.
410
 */
411
mozIThirdPartyUtil*
412
XPCOMService_GetThirdPartyUtil()
413
0
{
414
0
  if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
415
0
    return nullptr;
416
0
  }
417
0
  if (!gThirdPartyUtil) {
418
0
    nsCOMPtr<mozIThirdPartyUtil> os = do_GetService("@mozilla.org/thirdpartyutil;1");
419
0
    os.swap(gThirdPartyUtil);
420
0
  }
421
0
  return do_AddRef(gThirdPartyUtil).take();
422
0
}
423
} // extern "C"
424
425
/**
426
 * Clears service cache, sets gXPCOMShuttingDown
427
 */
428
void
429
mozilla::services::Shutdown()
430
0
{
431
0
  gXPCOMShuttingDown = true;
432
0
  NS_IF_RELEASE(gChromeRegistryService);
433
0
  NS_IF_RELEASE(gToolkitChromeRegistryService);
434
0
  NS_IF_RELEASE(gXULChromeRegistryService);
435
0
  NS_IF_RELEASE(gIOService);
436
0
  NS_IF_RELEASE(gObserverService);
437
0
  NS_IF_RELEASE(gStringBundleService);
438
0
  NS_IF_RELEASE(gPermissionManager);
439
0
  NS_IF_RELEASE(gServiceWorkerManager);
440
0
  NS_IF_RELEASE(gAsyncShutdown);
441
0
  NS_IF_RELEASE(gUUIDGenerator);
442
0
  NS_IF_RELEASE(gGfxInfo);
443
0
  NS_IF_RELEASE(gSocketTransportService);
444
0
  NS_IF_RELEASE(gStreamTransportService);
445
0
  NS_IF_RELEASE(gCacheStorageService);
446
0
  NS_IF_RELEASE(gURIClassifier);
447
0
  NS_IF_RELEASE(gActivityDistributor);
448
0
  NS_IF_RELEASE(gHistoryService);
449
0
  NS_IF_RELEASE(gThirdPartyUtil);
450
0
}