no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / mozglue / misc / ProcessType.cpp
blob3c82d6a466373c383f63b22168ef1d02fdbc38d1
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "ProcessType.h"
9 #include <cstring>
11 #include "mozilla/Assertions.h"
13 using namespace mozilla::startup;
15 namespace mozilla {
16 namespace startup {
17 GeckoProcessType sChildProcessType = GeckoProcessType_Default;
18 GeckoChildID sGeckoChildID = 0;
19 } // namespace startup
21 void SetGeckoProcessType(const char* aProcessTypeString) {
22 if (sChildProcessType != GeckoProcessType_Default &&
23 sChildProcessType != GeckoProcessType_ForkServer) {
24 MOZ_CRASH("Cannot set GeckoProcessType multiple times.");
27 #define GECKO_PROCESS_TYPE(enum_value, enum_name, string_name, proc_typename, \
28 process_bin_type, procinfo_typename, \
29 webidl_typename, allcaps_name) \
30 if (std::strcmp(aProcessTypeString, string_name) == 0) { \
31 sChildProcessType = GeckoProcessType::GeckoProcessType_##enum_name; \
32 return; \
34 #define SKIP_PROCESS_TYPE_DEFAULT
35 #if !defined(MOZ_ENABLE_FORKSERVER)
36 # define SKIP_PROCESS_TYPE_FORKSERVER
37 #endif
38 #if !defined(ENABLE_TESTS)
39 # define SKIP_PROCESS_TYPE_IPDLUNITTEST
40 #endif
41 #include "mozilla/GeckoProcessTypes.h"
42 #undef SKIP_PROCESS_TYPE_IPDLUNITTEST
43 #undef SKIP_PROCESS_TYPE_FORKSERVER
44 #undef SKIP_PROCESS_TYPE_DEFAULT
45 #undef GECKO_PROCESS_TYPE
47 MOZ_CRASH("aProcessTypeString is not valid.");
50 void SetGeckoChildID(const char* aGeckoChildIDString) {
51 sGeckoChildID = atoi(aGeckoChildIDString);
53 if (sGeckoChildID <= 0) {
54 MOZ_CRASH("aGeckoChildIDString is not valid.");
58 } // namespace mozilla