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"
11 #include "mozilla/Assertions.h"
13 using namespace mozilla::startup
;
17 GeckoProcessType sChildProcessType
= GeckoProcessType_Default
;
18 } // namespace startup
20 void SetGeckoProcessType(const char* aProcessTypeString
) {
22 // If not a DEBUG build then just return if sChildProcessType has already been
23 // set and is not fork server. In DEBUG builds we will check that process type
24 // matches the one already set if it is not fork server.
25 if (sChildProcessType
!= GeckoProcessType_Default
&&
26 sChildProcessType
!= GeckoProcessType_ForkServer
) {
31 #define GECKO_PROCESS_TYPE(enum_value, enum_name, string_name, proc_typename, \
32 process_bin_type, procinfo_typename, \
33 webidl_typename, allcaps_name) \
34 if (std::strcmp(aProcessTypeString, string_name) == 0) { \
36 sChildProcessType != GeckoProcessType_Default && \
37 sChildProcessType != GeckoProcessType_ForkServer, \
38 sChildProcessType == GeckoProcessType::GeckoProcessType_##enum_name); \
39 sChildProcessType = GeckoProcessType::GeckoProcessType_##enum_name; \
42 #define SKIP_PROCESS_TYPE_DEFAULT
43 #if !defined(MOZ_ENABLE_FORKSERVER)
44 # define SKIP_PROCESS_TYPE_FORKSERVER
46 #if !defined(ENABLE_TESTS)
47 # define SKIP_PROCESS_TYPE_IPDLUNITTEST
49 #include "mozilla/GeckoProcessTypes.h"
50 #undef SKIP_PROCESS_TYPE_IPDLUNITTEST
51 #undef SKIP_PROCESS_TYPE_FORKSERVER
52 #undef SKIP_PROCESS_TYPE_DEFAULT
53 #undef GECKO_PROCESS_TYPE
55 MOZ_CRASH("aProcessTypeString is not valid.");
58 } // namespace mozilla