зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1684896 - For the static NSDictionary MacSelectorMap objects, use function-local statics rather than globals. r=morgan
This means that the NSDictionaries will be constructed the first time the wrapper function is called, and not at C++ static initializer time. This avoids false positive warnings when running with the environment variables `OBJC_DEBUG_MISSING_POOLS=YES LIBDISPATCH_DEBUG_MISSING_POOLS=NO`. Differential Revision: https://phabricator.services.mozilla.com/D100976
This commit is contained in:
Родитель
49c2f4c103
Коммит
18e3c81cf5
|
@ -11,14 +11,14 @@ import re
|
|||
|
||||
def write_map(fd, name, text):
|
||||
matches = re.findall(r"^//\s(AX\w+)\n-\s?\(.*?\)([\w:]+)", text, re.MULTILINE)
|
||||
entries = [' @"%s" : @"%s"' % (a, s) for [a, s] in matches]
|
||||
|
||||
fd.write("static NSDictionary* g%s = @{\n" % name)
|
||||
fd.write(",\n".join(entries))
|
||||
fd.write("\n};\n\n")
|
||||
entries = [' @"%s" : @"%s"' % (a, s) for [a, s] in matches]
|
||||
|
||||
fd.write("NSDictionary* %s() {\n" % name)
|
||||
fd.write(" return g%s;\n" % name)
|
||||
fd.write(" // Create an autoreleased NSDictionary object once, and leak it.\n")
|
||||
fd.write(" static NSDictionary* s%s = [@{\n" % name)
|
||||
fd.write(",\n".join(entries))
|
||||
fd.write("\n } retain];\n\n")
|
||||
fd.write(" return s%s;\n" % name)
|
||||
fd.write("}\n\n")
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче