forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1749385 - Generate CrashManager.jsm from template r=gsvelto,nalex…
…ander Differential Revision: https://phabricator.services.mozilla.com/D136109
- Loading branch information
Alexandre Lissy
committed
Jan 18, 2022
1 parent
f65bde9
commit f1d6617
Showing
7 changed files
with
67 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
from geckoprocesstypes import process_types | ||
|
||
|
||
def process_name(string_name): | ||
if string_name == "default": | ||
string_name = "main" | ||
if string_name == "tab": | ||
string_name = "content" | ||
return string_name | ||
|
||
|
||
def gen_process_map(): | ||
kIdentifier = "/* SUBST: CRASH_MANAGER_PROCESS_MAP */" | ||
crashManagerMap = """ | ||
processTypes: {""" | ||
|
||
for p in process_types: | ||
crashManagerMap += """ | ||
// A crash in the %(procname)s process. | ||
%(proctype)d: "%(procname)s",""" % { | ||
"proctype": p.enum_value, | ||
"procname": process_name(p.string_name), | ||
} | ||
crashManagerMap += """ | ||
},""" | ||
|
||
return (kIdentifier, crashManagerMap) | ||
|
||
|
||
def gen_process_pings(): | ||
kIdentifier = "/* SUBST: CRASH_MANAGER_PROCESS_PINGS */" | ||
crashManagerPing = """let processPings = {""" | ||
|
||
for p in process_types: | ||
crashManagerPing += """ | ||
"%(proctype)s": %(crashping)s,""" % { | ||
"proctype": process_name(p.string_name), | ||
"crashping": "true" if p.crash_ping else "false", | ||
} | ||
crashManagerPing += """ | ||
};""" | ||
|
||
return (kIdentifier, crashManagerPing) | ||
|
||
|
||
def main(o, crashManager): | ||
subst = [gen_process_map(), gen_process_pings()] | ||
with open(crashManager, "r") as src: | ||
for l in src.readlines(): | ||
for (id, value) in subst: | ||
if id in l: | ||
l = l.replace(id, value) | ||
o.write(l) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters