import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1147951, part 2 - Remove unused JAVASCRIPT definition from nsJSEnvironment.cpp. r=baku (607909217)
- Bug 1147951, part 1 - Remove uses of JAVASCRIPT2 from Console.cpp. r=baku (46cde7cfa)
- pointer style (5504c22d4)
- Bug 1165384 - Add a typedef for the statistics phase table; r=sfink (484a24237)
- Bug 1165385 - Remove the rarely used !fullFormat mode of MOZ_GCTIMER; r=sfink (ab8b17eb1)
- Bug 1165390 - Make the detailed statistics formatting methods have consistent names; r=sfink (55c5db543)
- Bug 1165410 - Reimplement GC statistics JSON output formatter; r=sfink (04c13c874)
- Bug 1166789 - Cleanup javascript.options.mem.log formatting; r=sfink, r=mccr8 (f23b455b4)
- Bug 1171451 - Use the correct type for the argv argument to NS_CreateJSArgv and the nsJSArgArray constructor; r=jst (edfa21a59)
- Bug 886459, part 1 - Remove unused includes of nsIJSRuntimeService.h. r=bholley (bbc277ac1)
- Bug 886459, part 2 - Remove context callbacks from XPCJSRuntime. r=bholley (2c3c8515a)
- Bug 886459, part 3 - Remove simple uses of nsIJSRuntimeService to get the JSRuntime. r=bholley (ff5bfe304)
- pointer style (2ea264afd)
- Bug 1169457 - Add null check in OnWrapperDestroy. r=jimm (741739513)
-  Bug 886459, part 4 - Remove nsIJSRuntimeService. r=bholley,aklotz (61563f53b)
- Bug 1176642 - Use absolute_import in mach_commands.py files; r=glandium (a9fcb3b3f)
- Bug 1176642 - Defer import of autotry and pprint; r=chmanchester (de40855cb)
- Bug 1178772 - Add check_macroassembler_style.py: Verify that each MacroAssembler declaration maps to all its definitions. r=h4writer (fd406593a)
- Bug 1152556 - Add moz.build bugzilla metadata in dom/media. r=kinetik (fa2ffa121)
- Bug 1152556 - Add moz.build bugzilla metadata in dom/media webrtc. r=abr (d208b839a)
- re-enable peerconnection (42e8c412b)
- Bug 1152538 - Enable WebRTC identity, r=jesup (13a47adcb)
- Bug 1231123 - Simplify LaunchApp on BSDs by dropping fork/exec version. r=jld (c35e6e36f)
- bug 1171120 - Fix mtransport+signalling to build on iOS. r=ekr (7034b20ab)
- Bug 1150609 Patch 1 WebRTC SDP - add tmmbr to offer. r=jesup (52ca72d09)
- Bug 1150609 Patch 2 - WebRTC enable tmmbr r=jesup (d59c6adb9)
- Bug 1150609 Patch 3 - WebRTC enable tmmbr unittest changes. r=jesup (eeffed826)
- Bug 1087161 - Upgrading B2G toolchain to gcc-4.9 (851194ca0)
This commit is contained in:
2020-12-01 21:03:44 +08:00
parent b383d6bc2f
commit 538b35a4ee
87 changed files with 1256 additions and 831 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
# 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 __future__ import print_function, unicode_literals
from __future__ import absolute_import, print_function, unicode_literals
import os
import subprocess
-1
View File
@@ -11,7 +11,6 @@
#include "plstr.h"
#include "nsXPIDLString.h"
#include "nsCOMPtr.h"
#include "nsIJSRuntimeService.h"
#include "nsIServiceManager.h"
#include "nsMemory.h"
#include "nsStringBuffer.h"
+1 -3
View File
@@ -45,7 +45,6 @@
#include "nsIPrompt.h"
#include "nsIWindowWatcher.h"
#include "nsIConsoleService.h"
#include "nsIJSRuntimeService.h"
#include "nsIObserverService.h"
#include "nsIContent.h"
#include "nsAutoPtr.h"
@@ -1300,8 +1299,7 @@ nsresult nsScriptSecurityManager::Init()
//-- Register security check callback in the JS engine
// Currently this is used to control access to function.caller
rv = nsXPConnect::XPConnect()->GetRuntime(&sRuntime);
NS_ENSURE_SUCCESS(rv, rv);
sRuntime = xpc::GetJSRuntime();
static const JSSecurityCallbacks securityCallbacks = {
ContentSecurityPolicyPermitsJSAction,
+264
View File
@@ -0,0 +1,264 @@
# vim: set ts=8 sts=4 et sw=4 tw=99:
# 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/.
#----------------------------------------------------------------------------
# This script checks that SpiderMonkey MacroAssembler methods are properly
# annotated.
#
# The MacroAssembler has one interface for all platforms, but it might have one
# definition per platform. The code of the MacroAssembler use a macro to
# annotate the method declarations, in order to delete the function if it is not
# present on the current platform, and also to locate the files in which the
# methods are defined.
#
# This script scans the MacroAssembler.h header, for method declarations.
# It also scans MacroAssembler-/arch/.cpp, MacroAssembler-/arch/-inl.h, and
# MacroAssembler-inl.h for method definitions. The result of both scans are
# uniformized, and compared, to determine if the MacroAssembler.h header as
# proper methods annotations.
#----------------------------------------------------------------------------
from __future__ import print_function
import difflib
import os
import re
import subprocess
import sys
from check_utils import get_all_toplevel_filenames
architecture_independent = set([ 'generic' ])
all_architecture_names = set([ 'x86', 'x64', 'arm', 'arm64', 'mips' ])
all_shared_architecture_names = set([ 'x86_shared', 'arm', 'arm64', 'mips' ])
def get_normalized_signatures(signature, fileAnnot = None):
# Remove semicolon.
signature = signature.replace(';', ' ')
# Normalize spaces.
signature = re.sub(r'\s+', ' ', signature).strip()
# Remove argument names.
signature = re.sub(r'(?P<type>(?:[(]|,\s)[\w\s:*&]+)(?P<name>\s\w+)(?=[,)])', '\g<type>', signature)
# Remove class name
signature = signature.replace('MacroAssembler::', '')
# Extract list of architectures
archs = ['generic']
if fileAnnot:
archs = [fileAnnot['arch']]
if 'DEFINED_ON(' in signature:
archs = re.sub(r'.*DEFINED_ON\((?P<archs>[^()]*)\).*', '\g<archs>', signature).split(',')
archs = [a.strip() for a in archs]
signature = re.sub(r'\s+DEFINED_ON\([^()]*\)', '', signature)
elif 'PER_ARCH' in signature:
archs = all_architecture_names
signature = re.sub(r'\s+PER_ARCH', '', signature)
elif 'PER_SHARED_ARCH' in signature:
archs = all_shared_architecture_names
signature = re.sub(r'\s+PER_SHARED_ARCH', '', signature)
else:
# No signature annotation, the list of architectures remains unchanged.
pass
# Extract inline annotation
inline = False
if fileAnnot:
inline = fileAnnot['inline']
if 'inline ' in signature:
signature = re.sub(r'inline\s+', '', signature)
inline = True
return [
{ 'arch': a, 'sig': 'inline ' + signature }
for a in archs
]
file_suffixes = set([
a.replace('_', '-') for a in
all_architecture_names.union(all_shared_architecture_names)
])
def get_file_annotation(filename):
origFilename = filename
filename = filename.split('/')[-1]
inline = False
if filename.endswith('.cpp'):
filename = filename[:-len('.cpp')]
elif filename.endswith('-inl.h'):
inline = True
filename = filename[:-len('-inl.h')]
else:
raise Exception('unknown file name', origFilename)
arch = 'generic'
for suffix in file_suffixes:
if filename == 'MacroAssembler-' + suffix:
arch = suffix
break
return {
'inline': inline,
'arch': arch.replace('-', '_')
}
def get_macroassembler_definitions(filename):
try:
fileAnnot = get_file_annotation(filename)
except:
return []
style_section = False
code_section = False
lines = ''
signatures = []
with open(os.path.join('../..', filename)) as f:
for line in f:
if '//{{{ check_macroassembler_style' in line:
style_section = True
elif '//}}} check_macroassembler_style' in line:
style_section = False
if not style_section:
continue
line = re.sub(r'//.*', '', line)
if line.startswith('{'):
if 'MacroAssembler::' in lines:
signatures.extend(get_normalized_signatures(lines, fileAnnot))
code_section = True
continue
if line.startswith('}'):
code_section = False
lines = ''
continue
if code_section:
continue
if len(line.strip()) == 0:
lines = ''
continue
lines = lines + line
# Continue until we have a complete declaration
if '{' not in lines:
continue
# Skip variable declarations
if ')' not in lines:
lines = ''
continue
return signatures
def get_macroassembler_declaration(filename):
style_section = False
lines = ''
signatures = []
with open(os.path.join('../..', filename)) as f:
for line in f:
if '//{{{ check_macroassembler_style' in line:
style_section = True
elif '//}}} check_macroassembler_style' in line:
style_section = False
if not style_section:
continue
line = re.sub(r'//.*', '', line)
if len(line.strip()) == 0:
lines = ''
continue
lines = lines + line
# Continue until we have a complete declaration
if ';' not in lines:
continue
# Skip variable declarations
if ')' not in lines:
lines = ''
continue
signatures.extend(get_normalized_signatures(lines))
lines = ''
return signatures
def append_signatures(d, sigs):
for s in sigs:
if s['sig'] not in d:
d[s['sig']] = []
d[s['sig']].append(s['arch']);
return d
def generate_file_content(signatures):
output = []
for s in sorted(signatures.keys()):
archs = set(signatures[s])
if len(archs.symmetric_difference(architecture_independent)) == 0:
output.append(s + ';\n')
if s.startswith('inline'):
output.append(' is defined in MacroAssembler-inl.h\n')
else:
output.append(' is defined in MacroAssembler.cpp\n')
else:
if len(archs.symmetric_difference(all_architecture_names)) == 0:
output.append(s + ' PER_ARCH;\n')
elif len(archs.symmetric_difference(all_shared_architecture_names)) == 0:
output.append(s + ' PER_SHARED_ARCH;\n')
else:
output.append(s + ' DEFINED_ON(' + ', '.join(archs) + ');\n')
for a in archs:
a = a.replace('_', '-')
masm = '%s/MacroAssembler-%s' % (a, a)
if s.startswith('inline'):
output.append(' is defined in %s-inl.h\n' % masm)
else:
output.append(' is defined in %s.cpp\n' % masm)
return output
def check_style():
# We read from the header file the signature of each function.
decls = dict() # type: dict(signature => ['x86', 'x64'])
# We infer from each file the signature of each MacroAssembler function.
defs = dict() # type: dict(signature => ['x86', 'x64'])
# Select the appropriate files.
for filename in get_all_toplevel_filenames():
if not filename.startswith('js/src/jit/'):
continue
if 'MacroAssembler' not in filename:
continue
if filename.endswith('MacroAssembler.h'):
decls = append_signatures(decls, get_macroassembler_declaration(filename))
else:
defs = append_signatures(defs, get_macroassembler_definitions(filename))
# Compare declarations and definitions output.
difflines = difflib.unified_diff(generate_file_content(decls),
generate_file_content(defs),
fromfile='check_macroassembler_style.py declared syntax',
tofile='check_macroassembler_style.py found definitions')
ok = True
for diffline in difflines:
ok = False
print(diffline, end='')
return ok
def main():
ok = check_style()
if ok:
print('TEST-PASS | check_macroassembler_style.py | ok')
else:
print('TEST-UNEXPECTED-FAIL | check_macroassembler_style.py | actual output does not match expected output; diff is above')
sys.exit(0 if ok else 1)
if __name__ == '__main__':
main()
+2 -15
View File
@@ -43,6 +43,7 @@ import re
import subprocess
import sys
import traceback
from check_utils import get_all_toplevel_filenames
# We don't bother checking files in these directories, because they're (a) auxiliary or (b)
# imported code that doesn't follow our coding style.
@@ -217,20 +218,6 @@ class FileKind(object):
error(filename, None, 'unknown file kind')
def get_all_filenames():
'''Get a list of all the files in the (Mercurial or Git) repository.'''
cmds = [['hg', 'manifest', '-q'], ['git', 'ls-files', '--full-name', '../..']]
for cmd in cmds:
try:
all_filenames = subprocess.check_output(cmd, universal_newlines=True,
stderr=subprocess.PIPE).split('\n')
return all_filenames
except:
continue
else:
raise Exception('failed to run any of the repo manifest commands', cmds)
def check_style():
# We deal with two kinds of name.
# - A "filename" is a full path to a file from the repository root.
@@ -246,7 +233,7 @@ def check_style():
js_names = dict() # type: dict(filename, inclname)
# Select the appropriate files.
for filename in get_all_filenames():
for filename in get_all_toplevel_filenames():
if filename.startswith('mfbt/') and filename.endswith('.h'):
inclname = 'mozilla/' + filename.split('/')[-1]
mfbt_inclnames.add(inclname)
+30
View File
@@ -0,0 +1,30 @@
# vim: set ts=8 sts=4 et sw=4 tw=99:
# 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/.
import subprocess
def get_all_toplevel_filenames():
'''Get a list of all the files in the (Mercurial or Git) repository.'''
try:
cmd = ['hg', 'manifest', '-q']
all_filenames = subprocess.check_output(cmd, universal_newlines=True,
stderr=subprocess.PIPE).split('\n')
return all_filenames
except:
pass
try:
# Get the relative path to the top-level directory.
cmd = ['git', 'rev-parse', '--show-cdup']
top_level = subprocess.check_output(cmd, universal_newlines=True,
stderr=subprocess.PIPE).split('\n')[0]
cmd = ['git', 'ls-files', '--full-name', top_level]
all_filenames = subprocess.check_output(cmd, universal_newlines=True,
stderr=subprocess.PIPE).split('\n')
return all_filenames
except:
pass
raise Exception('failed to run any of the repo manifest commands', cmds)
+2 -4
View File
@@ -924,8 +924,7 @@ ReifyStack(nsIStackFrame* aStack, nsTArray<ConsoleStackEntry>& aRefiedStack)
nsresult rv = stack->GetLanguage(&language);
NS_ENSURE_SUCCESS(rv, rv);
if (language == nsIProgrammingLanguage::JAVASCRIPT ||
language == nsIProgrammingLanguage::JAVASCRIPT2) {
if (language == nsIProgrammingLanguage::JAVASCRIPT) {
ConsoleStackEntry& data = *aRefiedStack.AppendElement();
rv = StackFrameToStackEntry(stack, data, language);
NS_ENSURE_SUCCESS(rv, rv);
@@ -1036,8 +1035,7 @@ Console::Method(JSContext* aCx, MethodName aMethodName,
return;
}
if (language == nsIProgrammingLanguage::JAVASCRIPT ||
language == nsIProgrammingLanguage::JAVASCRIPT2) {
if (language == nsIProgrammingLanguage::JAVASCRIPT) {
callData->mTopStackFrame.emplace();
nsresult rv = StackFrameToStackEntry(stack,
*callData->mTopStackFrame,
-1
View File
@@ -129,7 +129,6 @@
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIIOService.h"
#include "nsIJSRuntimeService.h"
#include "nsILineBreaker.h"
#include "nsILoadContext.h"
#include "nsILoadGroup.h"
+2 -5
View File
@@ -34,15 +34,12 @@ JSObject* GetDefaultScopeFromJSContext(JSContext *cx);
// A factory function for turning a JS::Value argv into an nsIArray
// but also supports an effecient way of extracting the original argv.
// Bug 312003 describes why this must be "void *", but argv will be cast to
// JS::Value* and the args are found at:
// ((JS::Value*)aArgv)[0], ..., ((JS::Value*)aArgv)[aArgc - 1]
// The resulting object will take a copy of the array, and ensure each
// element is rooted.
// Optionally, aArgv may be nullptr, in which case the array is allocated and
// rooted, but all items remain nullptr. This presumably means the caller
// will then QI us for nsIJSArgArray, and set our array elements.
nsresult NS_CreateJSArgv(JSContext *aContext, uint32_t aArgc, void *aArgv,
nsIJSArgArray **aArray);
nsresult NS_CreateJSArgv(JSContext *aContext, uint32_t aArgc,
const JS::Value* aArgv, nsIJSArgArray **aArray);
#endif // nsDOMJSUtils_h__
-10
View File
@@ -26,7 +26,6 @@
#include "nsIMemoryReporter.h"
#include "nsIProtocolHandler.h"
#include "nsIScriptSecurityManager.h"
#include "nsIJSRuntimeService.h"
#include "nsIDOMClassInfo.h"
#include "xpcpublic.h"
#include "mozilla/CycleCollectedJSRuntime.h"
@@ -1813,15 +1812,6 @@ nsMessageManagerScriptExecutor::InitChildGlobalInternal(
nsISupports* aScope,
const nsACString& aID)
{
nsCOMPtr<nsIJSRuntimeService> runtimeSvc =
do_GetService("@mozilla.org/js/xpc/RuntimeService;1");
NS_ENSURE_TRUE(runtimeSvc, false);
JSRuntime* rt = nullptr;
runtimeSvc->GetRuntime(&rt);
NS_ENSURE_TRUE(rt, false);
AutoSafeJSContext cx;
nsContentUtils::GetSecurityManager()->GetSystemPrincipal(getter_AddRefs(mPrincipal));
+1 -1
View File
@@ -7890,7 +7890,7 @@ nsGlobalWindow::OpenDialog(JSContext* aCx, const nsAString& aUrl,
nsCOMPtr<nsIJSArgArray> argvArray;
aError = NS_CreateJSArgv(aCx, aExtraArgument.Length(),
const_cast<JS::Value*>(aExtraArgument.Elements()),
aExtraArgument.Elements(),
getter_AddRefs(argvArray));
if (aError.Failed()) {
return nullptr;
-1
View File
@@ -10,7 +10,6 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIJSRuntimeService.h"
#include "nsComponentManagerUtils.h"
#include "nsNetUtil.h"
#include "nsScriptLoader.h"
+23 -33
View File
@@ -14,7 +14,6 @@
#include "nsDOMCID.h"
#include "nsIServiceManager.h"
#include "nsIXPConnect.h"
#include "nsIJSRuntimeService.h"
#include "nsCOMPtr.h"
#include "nsISupportsPrimitives.h"
#include "nsReadableUtils.h"
@@ -150,8 +149,6 @@ static const uint32_t kMaxICCDuration = 2000; // ms
// Trigger a CC if the purple buffer exceeds this size when we check it.
#define NS_CC_PURPLE_LIMIT 200
#define JAVASCRIPT nsIProgrammingLanguage::JAVASCRIPT
// Large value used to specify that a script should run essentially forever
#define NS_UNLIMITED_SCRIPT_RUNTIME (0x40000000LL << 32)
@@ -203,11 +200,6 @@ static bool sDidPaintAfterPreviousICCSlice = false;
static nsScriptNameSpaceManager *gNameSpaceManager;
static nsIJSRuntimeService *sRuntimeService;
static const char kJSRuntimeServiceContractID[] =
"@mozilla.org/js/xpc/RuntimeService;1";
static PRTime sFirstCollectionTime;
static JSRuntime *sRuntime;
@@ -657,10 +649,8 @@ nsJSContext::~nsJSContext()
if (!sContextCount && sDidShutdown) {
// The last context is being deleted, and we're already in the
// process of shutting down, release the JS runtime service, and
// the security manager.
// process of shutting down, release the security manager.
NS_IF_RELEASE(sRuntimeService);
NS_IF_RELEASE(sSecurityManager);
}
}
@@ -2234,7 +2224,7 @@ DOMGCSliceCallback(JSRuntime *aRt, JS::GCProgress aProgress, const JS::GCDescrip
if (sPostGCEventsToConsole) {
NS_NAMED_LITERAL_STRING(kFmt, "GC(T+%.1f) ");
nsString prefix, gcstats;
gcstats.Adopt(aDesc.formatMessage(aRt));
gcstats.Adopt(aDesc.formatSummaryMessage(aRt));
prefix.Adopt(nsTextFormatter::smprintf(kFmt.get(),
double(delta) / PR_USEC_PER_SEC));
nsString msg = prefix + gcstats;
@@ -2310,6 +2300,15 @@ DOMGCSliceCallback(JSRuntime *aRt, JS::GCProgress aProgress, const JS::GCDescrip
nsCycleCollector_dispatchDeferredDeletion();
}
if (sPostGCEventsToConsole) {
nsString gcstats;
gcstats.Adopt(aDesc.formatSliceMessage(aRt));
nsCOMPtr<nsIConsoleService> cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (cs) {
cs->LogStringMessage(gcstats.get());
}
}
break;
default:
@@ -2369,7 +2368,6 @@ mozilla::dom::StartupJSEnvironment()
sNeedsFullCC = false;
sNeedsGCAfterCC = false;
gNameSpaceManager = nullptr;
sRuntimeService = nullptr;
sRuntime = nullptr;
sIsInitialized = false;
sDidShutdown = false;
@@ -2704,13 +2702,8 @@ nsJSContext::EnsureStatics()
MOZ_CRASH();
}
rv = CallGetService(kJSRuntimeServiceContractID, &sRuntimeService);
if (NS_FAILED(rv)) {
MOZ_CRASH();
}
rv = sRuntimeService->GetRuntime(&sRuntime);
if (NS_FAILED(rv)) {
sRuntime = xpc::GetJSRuntime();
if (!sRuntime) {
MOZ_CRASH();
}
@@ -2884,9 +2877,7 @@ mozilla::dom::ShutdownJSEnvironment()
if (!sContextCount) {
// We're being shutdown, and there are no more contexts
// alive, release the JS runtime service and the security manager.
NS_IF_RELEASE(sRuntimeService);
// alive, release the security manager.
NS_IF_RELEASE(sSecurityManager);
}
@@ -2902,7 +2893,7 @@ mozilla::dom::ShutdownJSEnvironment()
// on-the-fly.
class nsJSArgArray final : public nsIJSArgArray {
public:
nsJSArgArray(JSContext *aContext, uint32_t argc, JS::Value *argv,
nsJSArgArray(JSContext *aContext, uint32_t argc, const JS::Value* argv,
nsresult *prv);
// nsISupports
@@ -2925,11 +2916,11 @@ protected:
uint32_t mArgc;
};
nsJSArgArray::nsJSArgArray(JSContext *aContext, uint32_t argc, JS::Value *argv,
nsresult *prv) :
mContext(aContext),
mArgv(nullptr),
mArgc(argc)
nsJSArgArray::nsJSArgArray(JSContext *aContext, uint32_t argc,
const JS::Value* argv, nsresult *prv)
: mContext(aContext)
, mArgv(nullptr)
, mArgc(argc)
{
// copy the array - we don't know its lifetime, and ours is tied to xpcom
// refcounting.
@@ -3044,12 +3035,11 @@ NS_IMETHODIMP nsJSArgArray::Enumerate(nsISimpleEnumerator **_retval)
}
// The factory function
nsresult NS_CreateJSArgv(JSContext *aContext, uint32_t argc, void *argv,
nsIJSArgArray **aArray)
nsresult NS_CreateJSArgv(JSContext *aContext, uint32_t argc,
const JS::Value* argv, nsIJSArgArray **aArray)
{
nsresult rv;
nsCOMPtr<nsIJSArgArray> ret = new nsJSArgArray(aContext, argc,
static_cast<JS::Value *>(argv), &rv);
nsCOMPtr<nsIJSArgArray> ret = new nsJSArgArray(aContext, argc, argv, &rv);
if (NS_FAILED(rv)) {
return rv;
}
+2 -7
View File
@@ -12,6 +12,7 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "xpcpublic.h"
#include "nsIUnicodeDecoder.h"
#include "nsIContent.h"
#include "nsJSUtils.h"
@@ -19,7 +20,6 @@
#include "mozilla/dom/Element.h"
#include "nsGkAtoms.h"
#include "nsNetUtil.h"
#include "nsIJSRuntimeService.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h"
#include "nsIScriptSecurityManager.h"
@@ -866,12 +866,7 @@ NotifyOffThreadScriptLoadCompletedRunnable::Run()
// The result of the off thread parse was not actually needed to process
// the request (disappearing window, some other error, ...). Finish the
// request to avoid leaks in the JS engine.
nsCOMPtr<nsIJSRuntimeService> svc = do_GetService("@mozilla.org/js/xpc/RuntimeService;1");
NS_ENSURE_TRUE(svc, NS_ERROR_FAILURE);
JSRuntime *rt;
svc->GetRuntime(&rt);
NS_ENSURE_TRUE(rt, NS_ERROR_FAILURE);
JS::FinishOffThreadScript(nullptr, rt, mToken);
JS::FinishOffThreadScript(nullptr, xpc::GetJSRuntime(), mToken);
}
return rv;
+1 -1
View File
@@ -2,7 +2,7 @@
# 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 __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
import os
import sys
+2 -2
View File
@@ -63,7 +63,7 @@ public:
}
nsresult rv = NS_DispatchToMainThread(runnable);
if (NS_FAILED(rv)) {
BT_LOGR("NS_DispatchToMainThread failed: %X", rv);
BT_LOGR("NS_DispatchToMainThread failed: %X", unsigned(rv));
}
}
@@ -122,7 +122,7 @@ public:
}
nsresult rv = NS_DispatchToMainThread(runnable);
if (NS_FAILED(rv)) {
BT_LOGR("NS_DispatchToMainThread failed: %X", rv);
BT_LOGR("NS_DispatchToMainThread failed: %X", unsigned(rv));
}
}
-1
View File
@@ -92,7 +92,6 @@
#include "nsDebugImpl.h"
#include "nsHashPropertyBag.h"
#include "nsLayoutStylesheetCache.h"
#include "nsIJSRuntimeService.h"
#include "nsThreadManager.h"
#include "nsAnonymousTemporaryFile.h"
#include "nsISpellChecker.h"
-1
View File
@@ -118,7 +118,6 @@
#include "nsIFormProcessor.h"
#include "nsIGfxInfo.h"
#include "nsIIdleService.h"
#include "nsIJSRuntimeService.h"
#include "nsIMemoryInfoDumper.h"
#include "nsIMemoryReporter.h"
#include "nsIMozBrowserFrame.h"
+2 -9
View File
@@ -15,8 +15,8 @@
#include "mozilla/dom/ipc/BlobChild.h"
#include "mozilla/ipc/InputStreamUtils.h"
#include "nsIJSRuntimeService.h"
#include "nsPrintfCString.h"
#include "xpcpublic.h"
using namespace mozilla::ipc;
using namespace mozilla::jsipc;
@@ -27,14 +27,7 @@ namespace dom {
PJavaScriptChild*
nsIContentChild::AllocPJavaScriptChild()
{
nsCOMPtr<nsIJSRuntimeService> svc = do_GetService("@mozilla.org/js/xpc/RuntimeService;1");
NS_ENSURE_TRUE(svc, nullptr);
JSRuntime *rt;
svc->GetRuntime(&rt);
NS_ENSURE_TRUE(svc, nullptr);
return NewJavaScriptChild(rt);
return NewJavaScriptChild(xpc::GetJSRuntime());
}
bool
+2 -10
View File
@@ -19,8 +19,8 @@
#include "mozilla/unused.h"
#include "nsFrameMessageManager.h"
#include "nsIJSRuntimeService.h"
#include "nsPrintfCString.h"
#include "xpcpublic.h"
using namespace mozilla::jsipc;
@@ -49,15 +49,7 @@ nsIContentParent::AsContentParent()
PJavaScriptParent*
nsIContentParent::AllocPJavaScriptParent()
{
nsCOMPtr<nsIJSRuntimeService> svc =
do_GetService("@mozilla.org/js/xpc/RuntimeService;1");
NS_ENSURE_TRUE(svc, nullptr);
JSRuntime *rt;
svc->GetRuntime(&rt);
NS_ENSURE_TRUE(svc, nullptr);
return NewJavaScriptParent(rt);
return NewJavaScriptParent(xpc::GetJSRuntime());
}
bool
+3
View File
@@ -4,6 +4,9 @@
# 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/.
with Files('*'):
BUG_COMPONENT = ('Core', 'Video/Audio: Recording')
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
DIRS += ['fmp4_muxer']
+15
View File
@@ -4,6 +4,21 @@
# 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/.
with Files('*'):
BUG_COMPONENT = ('Core', 'Video/Audio')
component_signaling = ('Core', 'WebRTC: Signaling')
with Files('IdpSandbox.jsm'):
BUG_COMPONENT = component_signaling
with Files('PeerConnection*'):
BUG_COMPONENT = component_signaling
with Files('RTC*'):
BUG_COMPONENT = component_signaling
component_av = ('Core', 'WebRTC: Audio/Video')
with Files('GetUserMedia*'):
BUG_COMPONENT = component_av
DIRS += [
'encoder',
'gmp',
@@ -172,7 +172,7 @@ GonkMediaDataDecoder::ProcessDecode(MediaRawData* aSample)
nsresult rv = mManager->Input(aSample);
if (rv != NS_OK) {
NS_WARNING("GonkMediaDataDecoder failed to input data");
GMDD_LOG("Failed to input data err: %d",rv);
GMDD_LOG("Failed to input data err: %d",int(rv));
mCallback->Error();
return;
}
+6
View File
@@ -4,6 +4,12 @@
# 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/.
with Files('*'):
BUG_COMPONENT = ('Core', 'WebRTC: Audio/Video')
with Files('PeerIdentity.*'):
BUG_COMPONENT = ('Core', 'WebRTC: Signaling')
XPIDL_MODULE = 'content_webrtc'
EXPORTS += [
+158 -167
View File
@@ -18,8 +18,8 @@
#include "nsDOMJSUtils.h"
#include "nsJSUtils.h"
#include "nsIDocument.h"
#include "nsIJSRuntimeService.h"
#include "nsIXPConnect.h"
#include "xpcpublic.h"
#include "nsIDOMElement.h"
#include "prmem.h"
#include "nsIContent.h"
@@ -90,8 +90,7 @@ static PLDHashTable sNPObjWrappers;
// wrappers and we can kill off hash tables etc.
static int32_t sWrapperCount;
// The runtime service used to register/unregister GC callbacks.
nsCOMPtr<nsIJSRuntimeService> sCallbackRuntime;
static bool sCallbackIsRegistered = false;
static nsTArray<NPObject*>* sDelayedReleases;
@@ -321,18 +320,11 @@ DelayedReleaseGCCallback(JSGCStatus status)
static bool
RegisterGCCallbacks()
{
if (sCallbackRuntime) {
if (sCallbackIsRegistered) {
return true;
}
static const char rtsvc_id[] = "@mozilla.org/js/xpc/RuntimeService;1";
nsCOMPtr<nsIJSRuntimeService> rtsvc(do_GetService(rtsvc_id));
if (!rtsvc) {
return false;
}
JSRuntime *jsRuntime = nullptr;
rtsvc->GetRuntime(&jsRuntime);
JSRuntime* jsRuntime = xpc::GetJSRuntime();
MOZ_ASSERT(jsRuntime != nullptr);
// Register a callback to trace wrapped JSObjects.
@@ -342,30 +334,29 @@ RegisterGCCallbacks()
// Register our GC callback to perform delayed destruction of finalized
// NPObjects.
rtsvc->RegisterGCCallback(DelayedReleaseGCCallback);
xpc::AddGCCallback(DelayedReleaseGCCallback);
sCallbackIsRegistered = true;
// Set runtime pointer to indicate that callbacks have been registered.
sCallbackRuntime = rtsvc;
return true;
}
static void
UnregisterGCCallbacks()
{
MOZ_ASSERT(sCallbackRuntime);
MOZ_ASSERT(sCallbackIsRegistered);
JSRuntime *jsRuntime = nullptr;
sCallbackRuntime->GetRuntime(&jsRuntime);
JSRuntime* jsRuntime = xpc::GetJSRuntime();
MOZ_ASSERT(jsRuntime != nullptr);
// Remove tracing callback.
JS_RemoveExtraGCRootsTracer(jsRuntime, TraceJSObjWrappers, nullptr);
// Remove delayed destruction callback.
sCallbackRuntime->UnregisterGCCallback(DelayedReleaseGCCallback);
// Unset runtime pointer to indicate callbacks are no longer registered.
sCallbackRuntime = nullptr;
if (sCallbackIsRegistered) {
xpc::RemoveGCCallback(DelayedReleaseGCCallback);
sCallbackIsRegistered = false;
}
}
static bool
@@ -457,7 +448,7 @@ GetGlobalObject(NPP npp)
{
NS_ENSURE_TRUE(npp, nullptr);
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)npp->ndata;
nsNPAPIPluginInstance* inst = (nsNPAPIPluginInstance*)npp->ndata;
NS_ENSURE_TRUE(inst, nullptr);
nsRefPtr<nsPluginInstanceOwner> owner = inst->GetOwner();
@@ -470,13 +461,13 @@ GetGlobalObject(NPP npp)
return doc->GetScopeObject();
}
JSContext *
JSContext*
GetJSContext(NPP npp)
{
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(GetGlobalObject(npp));
NS_ENSURE_TRUE(sgo, nullptr);
nsIScriptContext *scx = sgo->GetContext();
nsIScriptContext* scx = sgo->GetContext();
NS_ENSURE_TRUE(scx, nullptr);
return scx->GetNativeContext();
@@ -487,11 +478,11 @@ GetJSContext(NPP npp)
} // namespace mozilla
static NPP
LookupNPP(NPObject *npobj);
LookupNPP(NPObject* npobj);
static JS::Value
NPVariantToJSVal(NPP npp, JSContext *cx, const NPVariant *variant)
NPVariantToJSVal(NPP npp, JSContext* cx, const NPVariant* variant)
{
switch (variant->type) {
case NPVariantType_Void :
@@ -512,10 +503,10 @@ NPVariantToJSVal(NPP npp, JSContext *cx, const NPVariant *variant)
}
case NPVariantType_String :
{
const NPString *s = &NPVARIANT_TO_STRING(*variant);
const NPString* s = &NPVARIANT_TO_STRING(*variant);
NS_ConvertUTF8toUTF16 utf16String(s->UTF8Characters, s->UTF8Length);
JSString *str =
JSString* str =
::JS_NewUCStringCopyN(cx, utf16String.get(), utf16String.Length());
if (str) {
@@ -527,7 +518,7 @@ NPVariantToJSVal(NPP npp, JSContext *cx, const NPVariant *variant)
case NPVariantType_Object:
{
if (npp) {
JSObject *obj =
JSObject* obj =
nsNPObjWrapper::GetNewOrUsed(npp, cx, NPVARIANT_TO_OBJECT(*variant));
if (obj) {
@@ -549,7 +540,7 @@ NPVariantToJSVal(NPP npp, JSContext *cx, const NPVariant *variant)
}
bool
JSValToNPVariant(NPP npp, JSContext *cx, JS::Value val, NPVariant *variant)
JSValToNPVariant(NPP npp, JSContext* cx, JS::Value val, NPVariant* variant)
{
NS_ASSERTION(npp, "Must have an NPP to wrap a jsval!");
@@ -571,7 +562,7 @@ JSValToNPVariant(NPP npp, JSContext *cx, JS::Value val, NPVariant *variant)
DOUBLE_TO_NPVARIANT(d, *variant);
}
} else if (val.isString()) {
JSString *jsstr = val.toString();
JSString* jsstr = val.toString();
nsAutoJSString str;
if (!str.init(cx, jsstr)) {
@@ -579,7 +570,7 @@ JSValToNPVariant(NPP npp, JSContext *cx, JS::Value val, NPVariant *variant)
}
uint32_t len;
char *p = ToNewUTF8String(str, &len);
char* p = ToNewUTF8String(str, &len);
if (!p) {
return false;
@@ -608,7 +599,7 @@ JSValToNPVariant(NPP npp, JSContext *cx, JS::Value val, NPVariant *variant)
obj = val.toObjectOrNull();
}
NPObject *npobj = nsJSObjWrapper::GetNewOrUsed(npp, cx, obj);
NPObject* npobj = nsJSObjWrapper::GetNewOrUsed(npp, cx, obj);
if (!npobj) {
return false;
}
@@ -620,9 +611,9 @@ JSValToNPVariant(NPP npp, JSContext *cx, JS::Value val, NPVariant *variant)
}
static void
ThrowJSException(JSContext *cx, const char *message)
ThrowJSException(JSContext* cx, const char* message)
{
const char *ex = PeekException();
const char* ex = PeekException();
if (ex) {
nsAutoString ucex;
@@ -639,7 +630,7 @@ ThrowJSException(JSContext *cx, const char *message)
AppendASCIItoUTF16("].", ucex);
}
JSString *str = ::JS_NewUCStringCopyN(cx, ucex.get(), ucex.Length());
JSString* str = ::JS_NewUCStringCopyN(cx, ucex.get(), ucex.Length());
if (str) {
JS::Rooted<JS::Value> exn(cx, JS::StringValue(str));
@@ -653,9 +644,9 @@ ThrowJSException(JSContext *cx, const char *message)
}
static bool
ReportExceptionIfPending(JSContext *cx)
ReportExceptionIfPending(JSContext* cx)
{
const char *ex = PeekException();
const char* ex = PeekException();
if (!ex) {
return true;
@@ -684,8 +675,8 @@ nsJSObjWrapper::~nsJSObjWrapper()
}
// static
NPObject *
nsJSObjWrapper::NP_Allocate(NPP npp, NPClass *aClass)
NPObject*
nsJSObjWrapper::NP_Allocate(NPP npp, NPClass* aClass)
{
NS_ASSERTION(aClass == &sJSObjWrapperNPClass,
"Huh, wrong class passed to NP_Allocate()!!!");
@@ -695,17 +686,17 @@ nsJSObjWrapper::NP_Allocate(NPP npp, NPClass *aClass)
// static
void
nsJSObjWrapper::NP_Deallocate(NPObject *npobj)
nsJSObjWrapper::NP_Deallocate(NPObject* npobj)
{
// nsJSObjWrapper::~nsJSObjWrapper() will call NP_Invalidate().
delete (nsJSObjWrapper *)npobj;
delete (nsJSObjWrapper*)npobj;
}
// static
void
nsJSObjWrapper::NP_Invalidate(NPObject *npobj)
nsJSObjWrapper::NP_Invalidate(NPObject* npobj)
{
nsJSObjWrapper *jsnpobj = (nsJSObjWrapper *)npobj;
nsJSObjWrapper* jsnpobj = (nsJSObjWrapper*)npobj;
if (jsnpobj && jsnpobj->mJSObj) {
@@ -723,25 +714,25 @@ nsJSObjWrapper::NP_Invalidate(NPObject *npobj)
}
static bool
GetProperty(JSContext *cx, JSObject *objArg, NPIdentifier npid, JS::MutableHandle<JS::Value> rval)
GetProperty(JSContext* cx, JSObject* objArg, NPIdentifier npid, JS::MutableHandle<JS::Value> rval)
{
NS_ASSERTION(NPIdentifierIsInt(npid) || NPIdentifierIsString(npid),
"id must be either string or int!\n");
JS::Rooted<JSObject *> obj(cx, objArg);
JS::Rooted<JSObject*> obj(cx, objArg);
JS::Rooted<jsid> id(cx, NPIdentifierToJSId(npid));
return ::JS_GetPropertyById(cx, obj, id, rval);
}
// static
bool
nsJSObjWrapper::NP_HasMethod(NPObject *npobj, NPIdentifier id)
nsJSObjWrapper::NP_HasMethod(NPObject* npobj, NPIdentifier id)
{
NPP npp = NPPStack::Peek();
dom::AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(GetGlobalObject(npp)))) {
return false;
}
JSContext *cx = jsapi.cx();
JSContext* cx = jsapi.cx();
if (!npobj) {
ThrowJSException(cx,
@@ -750,7 +741,7 @@ nsJSObjWrapper::NP_HasMethod(NPObject *npobj, NPIdentifier id)
return false;
}
nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
nsJSObjWrapper* npjsobj = (nsJSObjWrapper*)npobj;
JSAutoCompartment ac(cx, npjsobj->mJSObj);
@@ -764,8 +755,8 @@ nsJSObjWrapper::NP_HasMethod(NPObject *npobj, NPIdentifier id)
}
static bool
doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args,
uint32_t argCount, bool ctorCall, NPVariant *result)
doInvoke(NPObject* npobj, NPIdentifier method, const NPVariant* args,
uint32_t argCount, bool ctorCall, NPVariant* result)
{
NPP npp = NPPStack::Peek();
@@ -777,7 +768,7 @@ doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args,
// We're about to run script via JS_CallFunctionValue, so we need an
// AutoEntryScript. NPAPI plugins are Gecko-specific and not in any spec.
dom::AutoEntryScript aes(globalObject, "NPAPI doInvoke");
JSContext *cx = aes.cx();
JSContext* cx = aes.cx();
if (!npobj || !result) {
ThrowJSException(cx, "Null npobj, or result in doInvoke!");
@@ -788,7 +779,7 @@ doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args,
// Initialize *result
VOID_TO_NPVARIANT(*result);
nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
nsJSObjWrapper* npjsobj = (nsJSObjWrapper*)npobj;
JS::Rooted<JSObject*> jsobj(cx, npjsobj->mJSObj);
JSAutoCompartment ac(cx, jsobj);
@@ -819,7 +810,7 @@ doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args,
bool ok = false;
if (ctorCall) {
JSObject *newObj =
JSObject* newObj =
::JS_New(cx, jsobj, jsargs);
if (newObj) {
@@ -838,9 +829,9 @@ doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args,
// static
bool
nsJSObjWrapper::NP_Invoke(NPObject *npobj, NPIdentifier method,
const NPVariant *args, uint32_t argCount,
NPVariant *result)
nsJSObjWrapper::NP_Invoke(NPObject* npobj, NPIdentifier method,
const NPVariant* args, uint32_t argCount,
NPVariant* result)
{
if (method == NPIdentifier_VOID) {
return false;
@@ -851,8 +842,8 @@ nsJSObjWrapper::NP_Invoke(NPObject *npobj, NPIdentifier method,
// static
bool
nsJSObjWrapper::NP_InvokeDefault(NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result)
nsJSObjWrapper::NP_InvokeDefault(NPObject* npobj, const NPVariant* args,
uint32_t argCount, NPVariant* result)
{
return doInvoke(npobj, NPIdentifier_VOID, args, argCount, false,
result);
@@ -860,14 +851,14 @@ nsJSObjWrapper::NP_InvokeDefault(NPObject *npobj, const NPVariant *args,
// static
bool
nsJSObjWrapper::NP_HasProperty(NPObject *npobj, NPIdentifier npid)
nsJSObjWrapper::NP_HasProperty(NPObject* npobj, NPIdentifier npid)
{
NPP npp = NPPStack::Peek();
dom::AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(GetGlobalObject(npp)))) {
return false;
}
JSContext *cx = jsapi.cx();
JSContext* cx = jsapi.cx();
if (!npobj) {
ThrowJSException(cx,
@@ -876,7 +867,7 @@ nsJSObjWrapper::NP_HasProperty(NPObject *npobj, NPIdentifier npid)
return false;
}
nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
nsJSObjWrapper* npjsobj = (nsJSObjWrapper*)npobj;
bool found, ok = false;
AutoJSExceptionReporter reporter(jsapi, npjsobj);
@@ -892,8 +883,8 @@ nsJSObjWrapper::NP_HasProperty(NPObject *npobj, NPIdentifier npid)
// static
bool
nsJSObjWrapper::NP_GetProperty(NPObject *npobj, NPIdentifier id,
NPVariant *result)
nsJSObjWrapper::NP_GetProperty(NPObject* npobj, NPIdentifier id,
NPVariant* result)
{
NPP npp = NPPStack::Peek();
@@ -905,7 +896,7 @@ nsJSObjWrapper::NP_GetProperty(NPObject *npobj, NPIdentifier id,
// We're about to run script via JS_CallFunctionValue, so we need an
// AutoEntryScript. NPAPI plugins are Gecko-specific and not in any spec.
dom::AutoEntryScript aes(globalObject, "NPAPI get");
JSContext *cx = aes.cx();
JSContext* cx = aes.cx();
if (!npobj) {
ThrowJSException(cx,
@@ -914,7 +905,7 @@ nsJSObjWrapper::NP_GetProperty(NPObject *npobj, NPIdentifier id,
return false;
}
nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
nsJSObjWrapper* npjsobj = (nsJSObjWrapper*)npobj;
AutoJSExceptionReporter reporter(aes, npjsobj);
JSAutoCompartment ac(cx, npjsobj->mJSObj);
@@ -926,8 +917,8 @@ nsJSObjWrapper::NP_GetProperty(NPObject *npobj, NPIdentifier id,
// static
bool
nsJSObjWrapper::NP_SetProperty(NPObject *npobj, NPIdentifier npid,
const NPVariant *value)
nsJSObjWrapper::NP_SetProperty(NPObject* npobj, NPIdentifier npid,
const NPVariant* value)
{
NPP npp = NPPStack::Peek();
@@ -939,7 +930,7 @@ nsJSObjWrapper::NP_SetProperty(NPObject *npobj, NPIdentifier npid,
// We're about to run script via JS_CallFunctionValue, so we need an
// AutoEntryScript. NPAPI plugins are Gecko-specific and not in any spec.
dom::AutoEntryScript aes(globalObject, "NPAPI set");
JSContext *cx = aes.cx();
JSContext* cx = aes.cx();
if (!npobj) {
ThrowJSException(cx,
@@ -948,7 +939,7 @@ nsJSObjWrapper::NP_SetProperty(NPObject *npobj, NPIdentifier npid,
return false;
}
nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
nsJSObjWrapper* npjsobj = (nsJSObjWrapper*)npobj;
bool ok = false;
AutoJSExceptionReporter reporter(aes, npjsobj);
@@ -967,14 +958,14 @@ nsJSObjWrapper::NP_SetProperty(NPObject *npobj, NPIdentifier npid,
// static
bool
nsJSObjWrapper::NP_RemoveProperty(NPObject *npobj, NPIdentifier npid)
nsJSObjWrapper::NP_RemoveProperty(NPObject* npobj, NPIdentifier npid)
{
NPP npp = NPPStack::Peek();
dom::AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(GetGlobalObject(npp)))) {
return false;
}
JSContext *cx = jsapi.cx();
JSContext* cx = jsapi.cx();
if (!npobj) {
ThrowJSException(cx,
@@ -983,7 +974,7 @@ nsJSObjWrapper::NP_RemoveProperty(NPObject *npobj, NPIdentifier npid)
return false;
}
nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
nsJSObjWrapper* npjsobj = (nsJSObjWrapper*)npobj;
AutoJSExceptionReporter reporter(jsapi, npjsobj);
JS::ObjectOpResult result;
@@ -1015,15 +1006,15 @@ nsJSObjWrapper::NP_RemoveProperty(NPObject *npobj, NPIdentifier npid)
//static
bool
nsJSObjWrapper::NP_Enumerate(NPObject *npobj, NPIdentifier **idarray,
uint32_t *count)
nsJSObjWrapper::NP_Enumerate(NPObject* npobj, NPIdentifier** idarray,
uint32_t* count)
{
NPP npp = NPPStack::Peek();
dom::AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(GetGlobalObject(npp)))) {
return false;
}
JSContext *cx = jsapi.cx();
JSContext* cx = jsapi.cx();
*idarray = 0;
*count = 0;
@@ -1035,7 +1026,7 @@ nsJSObjWrapper::NP_Enumerate(NPObject *npobj, NPIdentifier **idarray,
return false;
}
nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
nsJSObjWrapper* npjsobj = (nsJSObjWrapper*)npobj;
AutoJSExceptionReporter reporter(jsapi, npjsobj);
JS::Rooted<JSObject*> jsobj(cx, npjsobj->mJSObj);
@@ -1047,7 +1038,7 @@ nsJSObjWrapper::NP_Enumerate(NPObject *npobj, NPIdentifier **idarray,
}
*count = ida.length();
*idarray = (NPIdentifier *)PR_Malloc(*count * sizeof(NPIdentifier));
*idarray = (NPIdentifier*)PR_Malloc(*count * sizeof(NPIdentifier));
if (!*idarray) {
ThrowJSException(cx, "Memory allocation failed for NPIdentifier!");
return false;
@@ -1083,8 +1074,8 @@ nsJSObjWrapper::NP_Enumerate(NPObject *npobj, NPIdentifier **idarray,
//static
bool
nsJSObjWrapper::NP_Construct(NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result)
nsJSObjWrapper::NP_Construct(NPObject* npobj, const NPVariant* args,
uint32_t argCount, NPVariant* result)
{
return doInvoke(npobj, NPIdentifier_VOID, args, argCount, true, result);
}
@@ -1099,13 +1090,13 @@ nsJSObjWrapper::NP_Construct(NPObject *npobj, const NPVariant *args,
* been finalized if all wrappers have died.
*/
static void
JSObjWrapperKeyMarkCallback(JSTracer *trc, JSObject *obj, void *data) {
JSObjWrapperKeyMarkCallback(JSTracer* trc, JSObject* obj, void* data) {
NPP npp = static_cast<NPP>(data);
MOZ_ASSERT(sJSObjWrappersAccessible);
if (!sJSObjWrappers.initialized())
return;
JSObject *prior = obj;
JSObject* prior = obj;
nsJSObjWrapperKey oldKey(prior, npp);
JSObjWrapperTable::Ptr p = sJSObjWrappers.lookup(oldKey);
if (!p)
@@ -1119,8 +1110,8 @@ JSObjWrapperKeyMarkCallback(JSTracer *trc, JSObject *obj, void *data) {
// Look up or create an NPObject that wraps the JSObject obj.
// static
NPObject *
nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JS::Handle<JSObject*> obj)
NPObject*
nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext* cx, JS::Handle<JSObject*> obj)
{
if (!npp) {
NS_ERROR("Null NPP passed to nsJSObjWrapper::GetNewOrUsed()!");
@@ -1157,7 +1148,7 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JS::Handle<JSObject*> obj)
// obj is one of our own, its private data is the NPObject we're
// looking for.
NPObject *npobj = (NPObject *)::JS_GetPrivate(obj);
NPObject* npobj = (NPObject*)::JS_GetPrivate(obj);
// If the private is null, that means that the object has already been torn
// down, possible because the owning plugin was destroyed (there can be
@@ -1189,8 +1180,8 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JS::Handle<JSObject*> obj)
// No existing nsJSObjWrapper, create one.
nsJSObjWrapper *wrapper =
(nsJSObjWrapper *)_createobject(npp, &sJSObjWrapperNPClass);
nsJSObjWrapper* wrapper =
(nsJSObjWrapper*)_createobject(npp, &sJSObjWrapperNPClass);
if (!wrapper) {
// Out of memory, entry not yet added to table.
@@ -1220,8 +1211,8 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JS::Handle<JSObject*> obj)
// Because this function unwraps, its return value must be wrapped for the cx
// compartment for callers that plan to hold onto the result or do anything
// substantial with it.
static JSObject *
GetNPObjectWrapper(JSContext *cx, JS::Handle<JSObject*> aObj, bool wrapResult = true)
static JSObject*
GetNPObjectWrapper(JSContext* cx, JS::Handle<JSObject*> aObj, bool wrapResult = true)
{
JS::Rooted<JSObject*> obj(cx, aObj);
while (obj && (obj = js::CheckedUnwrap(obj))) {
@@ -1240,8 +1231,8 @@ GetNPObjectWrapper(JSContext *cx, JS::Handle<JSObject*> aObj, bool wrapResult =
return nullptr;
}
static NPObject *
GetNPObject(JSContext *cx, JS::Handle<JSObject*> aObj)
static NPObject*
GetNPObject(JSContext* cx, JS::Handle<JSObject*> aObj)
{
JS::Rooted<JSObject*> obj(cx, aObj);
obj = GetNPObjectWrapper(cx, obj, /* wrapResult = */ false);
@@ -1249,16 +1240,16 @@ GetNPObject(JSContext *cx, JS::Handle<JSObject*> aObj)
return nullptr;
}
return (NPObject *)::JS_GetPrivate(obj);
return (NPObject*)::JS_GetPrivate(obj);
}
// Does not actually add a property because this is always followed by a
// SetProperty call.
static bool
NPObjWrapper_AddProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> v)
NPObjWrapper_AddProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> v)
{
NPObject *npobj = GetNPObject(cx, obj);
NPObject* npobj = GetNPObject(cx, obj);
if (!npobj || !npobj->_class || !npobj->_class->hasProperty ||
!npobj->_class->hasMethod) {
@@ -1297,10 +1288,10 @@ NPObjWrapper_AddProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<js
}
static bool
NPObjWrapper_DelProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
NPObjWrapper_DelProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
JS::ObjectOpResult &result)
{
NPObject *npobj = GetNPObject(cx, obj);
NPObject* npobj = GetNPObject(cx, obj);
if (!npobj || !npobj->_class || !npobj->_class->hasProperty ||
!npobj->_class->removeProperty) {
@@ -1333,10 +1324,10 @@ NPObjWrapper_DelProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<js
}
static bool
NPObjWrapper_SetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
NPObjWrapper_SetProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
JS::MutableHandle<JS::Value> vp, JS::ObjectOpResult &result)
{
NPObject *npobj = GetNPObject(cx, obj);
NPObject* npobj = GetNPObject(cx, obj);
if (!npobj || !npobj->_class || !npobj->_class->hasProperty ||
!npobj->_class->setProperty) {
@@ -1393,9 +1384,9 @@ NPObjWrapper_SetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<js
}
static bool
NPObjWrapper_GetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp)
NPObjWrapper_GetProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp)
{
NPObject *npobj = GetNPObject(cx, obj);
NPObject* npobj = GetNPObject(cx, obj);
if (!npobj || !npobj->_class || !npobj->_class->hasProperty ||
!npobj->_class->hasMethod || !npobj->_class->getProperty) {
@@ -1488,10 +1479,10 @@ NPObjWrapper_GetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<js
}
static bool
CallNPMethodInternal(JSContext *cx, JS::Handle<JSObject*> obj, unsigned argc,
JS::Value *argv, JS::Value *rval, bool ctorCall)
CallNPMethodInternal(JSContext* cx, JS::Handle<JSObject*> obj, unsigned argc,
JS::Value* argv, JS::Value* rval, bool ctorCall)
{
NPObject *npobj = GetNPObject(cx, obj);
NPObject* npobj = GetNPObject(cx, obj);
if (!npobj || !npobj->_class) {
ThrowJSException(cx, "Bad NPObject as private data!");
@@ -1512,12 +1503,12 @@ CallNPMethodInternal(JSContext *cx, JS::Handle<JSObject*> obj, unsigned argc,
PluginDestructionGuard pdg(npp);
NPVariant npargs_buf[8];
NPVariant *npargs = npargs_buf;
NPVariant* npargs = npargs_buf;
if (argc > (sizeof(npargs_buf) / sizeof(NPVariant))) {
// Our stack buffer isn't large enough to hold all arguments,
// malloc a buffer.
npargs = (NPVariant *)PR_Malloc(argc * sizeof(NPVariant));
npargs = (NPVariant*)PR_Malloc(argc * sizeof(NPVariant));
if (!npargs) {
ThrowJSException(cx, "Out of memory!");
@@ -1543,9 +1534,9 @@ CallNPMethodInternal(JSContext *cx, JS::Handle<JSObject*> obj, unsigned argc,
NPVariant v;
VOID_TO_NPVARIANT(v);
JSObject *funobj = argv[-2].toObjectOrNull();
JSObject* funobj = argv[-2].toObjectOrNull();
bool ok;
const char *msg = "Error calling method on NPObject!";
const char* msg = "Error calling method on NPObject!";
if (ctorCall) {
// construct a new NPObject based on the NPClass in npobj. Fail if
@@ -1564,9 +1555,9 @@ CallNPMethodInternal(JSContext *cx, JS::Handle<JSObject*> obj, unsigned argc,
// the function object.
if (npobj->_class->invoke) {
JSFunction *fun = ::JS_GetObjectFunction(funobj);
JSFunction* fun = ::JS_GetObjectFunction(funobj);
JS::Rooted<JSString*> funId(cx, ::JS_GetFunctionId(fun));
JSString *name = ::JS_InternJSString(cx, funId);
JSString* name = ::JS_InternJSString(cx, funId);
NPIdentifier id = StringToNPIdentifier(cx, name);
ok = npobj->_class->invoke(npobj, id, npargs, argc, &v);
@@ -1616,7 +1607,7 @@ CallNPMethodInternal(JSContext *cx, JS::Handle<JSObject*> obj, unsigned argc,
}
static bool
CallNPMethod(JSContext *cx, unsigned argc, JS::Value *vp)
CallNPMethod(JSContext* cx, unsigned argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, JS_THIS_OBJECT(cx, vp));
@@ -1627,10 +1618,10 @@ CallNPMethod(JSContext *cx, unsigned argc, JS::Value *vp)
}
static bool
NPObjWrapper_Enumerate(JSContext *cx, JS::Handle<JSObject*> obj,
NPObjWrapper_Enumerate(JSContext* cx, JS::Handle<JSObject*> obj,
JS::AutoIdVector &properties, bool enumerableOnly)
{
NPObject *npobj = GetNPObject(cx, obj);
NPObject* npobj = GetNPObject(cx, obj);
if (!npobj || !npobj->_class) {
ThrowJSException(cx, "Bad NPObject as private data!");
return false;
@@ -1643,7 +1634,7 @@ NPObjWrapper_Enumerate(JSContext *cx, JS::Handle<JSObject*> obj,
return true;
}
NPIdentifier *identifiers;
NPIdentifier* identifiers;
uint32_t length;
if (!npobj->_class->enumerate(npobj, &identifiers, &length)) {
if (ReportExceptionIfPending(cx)) {
@@ -1669,13 +1660,13 @@ NPObjWrapper_Enumerate(JSContext *cx, JS::Handle<JSObject*> obj,
}
static bool
NPObjWrapper_Resolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
bool *resolvedp)
NPObjWrapper_Resolve(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
bool* resolvedp)
{
if (JSID_IS_SYMBOL(id))
return true;
NPObject *npobj = GetNPObject(cx, obj);
NPObject* npobj = GetNPObject(cx, obj);
if (!npobj || !npobj->_class || !npobj->_class->hasProperty ||
!npobj->_class->hasMethod) {
@@ -1713,7 +1704,7 @@ NPObjWrapper_Resolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid>
NS_ASSERTION(JSID_IS_STRING(id) || JSID_IS_INT(id),
"id must be either string or int!\n");
JSFunction *fnc = ::JS_DefineFunctionById(cx, obj, id, CallNPMethod, 0,
JSFunction* fnc = ::JS_DefineFunctionById(cx, obj, id, CallNPMethod, 0,
JSPROP_ENUMERATE);
*resolvedp = true;
@@ -1726,7 +1717,7 @@ NPObjWrapper_Resolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid>
}
static bool
NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint, JS::MutableHandle<JS::Value> vp)
NPObjWrapper_Convert(JSContext* cx, JS::Handle<JSObject*> obj, JSType hint, JS::MutableHandle<JS::Value> vp)
{
MOZ_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID);
@@ -1762,9 +1753,9 @@ NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint, JS::
}
static void
NPObjWrapper_Finalize(js::FreeOp *fop, JSObject *obj)
NPObjWrapper_Finalize(js::FreeOp* fop, JSObject* obj)
{
NPObject *npobj = (NPObject *)::JS_GetPrivate(obj);
NPObject* npobj = (NPObject*)::JS_GetPrivate(obj);
if (npobj) {
if (sNPObjWrappers.IsInitialized()) {
PL_DHashTableRemove(&sNPObjWrappers, npobj);
@@ -1777,7 +1768,7 @@ NPObjWrapper_Finalize(js::FreeOp *fop, JSObject *obj)
}
static void
NPObjWrapper_ObjectMoved(JSObject *obj, const JSObject *old)
NPObjWrapper_ObjectMoved(JSObject* obj, const JSObject* old)
{
// The wrapper JSObject has been moved, so we need to update the entry in the
// sNPObjWrappers hash table, if present.
@@ -1786,7 +1777,7 @@ NPObjWrapper_ObjectMoved(JSObject *obj, const JSObject *old)
return;
}
NPObject *npobj = (NPObject *)::JS_GetPrivate(obj);
NPObject* npobj = (NPObject*)::JS_GetPrivate(obj);
if (!npobj) {
return;
}
@@ -1794,7 +1785,7 @@ NPObjWrapper_ObjectMoved(JSObject *obj, const JSObject *old)
// Calling PL_DHashTableSearch() will not result in GC.
JS::AutoSuppressGCAnalysis nogc;
NPObjWrapperHashEntry *entry = static_cast<NPObjWrapperHashEntry *>
NPObjWrapperHashEntry* entry = static_cast<NPObjWrapperHashEntry*>
(PL_DHashTableSearch(&sNPObjWrappers, npobj));
MOZ_ASSERT(entry && entry->mJSObj);
MOZ_ASSERT(entry->mJSObj == old);
@@ -1802,7 +1793,7 @@ NPObjWrapper_ObjectMoved(JSObject *obj, const JSObject *old)
}
static bool
NPObjWrapper_Call(JSContext *cx, unsigned argc, JS::Value *vp)
NPObjWrapper_Call(JSContext* cx, unsigned argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, &args.callee());
@@ -1810,7 +1801,7 @@ NPObjWrapper_Call(JSContext *cx, unsigned argc, JS::Value *vp)
}
static bool
NPObjWrapper_Construct(JSContext *cx, unsigned argc, JS::Value *vp)
NPObjWrapper_Construct(JSContext* cx, unsigned argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, &args.callee());
@@ -1818,7 +1809,7 @@ NPObjWrapper_Construct(JSContext *cx, unsigned argc, JS::Value *vp)
}
bool
nsNPObjWrapper::IsWrapper(JSObject *obj)
nsNPObjWrapper::IsWrapper(JSObject* obj)
{
return js::GetObjectClass(obj) == &sNPObjectJSWrapperClass;
}
@@ -1829,7 +1820,7 @@ nsNPObjWrapper::IsWrapper(JSObject *obj)
// static
void
nsNPObjWrapper::OnDestroy(NPObject *npobj)
nsNPObjWrapper::OnDestroy(NPObject* npobj)
{
if (!npobj) {
return;
@@ -1847,7 +1838,7 @@ nsNPObjWrapper::OnDestroy(NPObject *npobj)
return;
}
NPObjWrapperHashEntry *entry = static_cast<NPObjWrapperHashEntry *>
NPObjWrapperHashEntry* entry = static_cast<NPObjWrapperHashEntry*>
(PL_DHashTableSearch(&sNPObjWrappers, npobj));
if (entry && entry->mJSObj) {
@@ -1866,8 +1857,8 @@ nsNPObjWrapper::OnDestroy(NPObject *npobj)
// Look up or create a JSObject that wraps the NPObject npobj.
// static
JSObject *
nsNPObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj)
JSObject*
nsNPObjWrapper::GetNewOrUsed(NPP npp, JSContext* cx, NPObject* npobj)
{
if (!npobj) {
NS_ERROR("Null NPObject passed to nsNPObjWrapper::GetNewOrUsed()!");
@@ -1878,7 +1869,7 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj)
if (npobj->_class == &nsJSObjWrapper::sJSObjWrapperNPClass) {
// npobj is one of our own, return its existing JSObject.
JS::Rooted<JSObject*> obj(cx, ((nsJSObjWrapper *)npobj)->mJSObj);
JS::Rooted<JSObject*> obj(cx, ((nsJSObjWrapper*)npobj)->mJSObj);
if (!JS_WrapObject(cx, &obj)) {
return nullptr;
}
@@ -1898,7 +1889,7 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj)
}
}
NPObjWrapperHashEntry *entry = static_cast<NPObjWrapperHashEntry *>
NPObjWrapperHashEntry* entry = static_cast<NPObjWrapperHashEntry*>
(PL_DHashTableAdd(&sNPObjWrappers, npobj, fallible));
if (!entry) {
@@ -1962,23 +1953,23 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj)
struct NppAndCx
{
NPP npp;
JSContext *cx;
JSContext* cx;
};
static PLDHashOperator
NPObjWrapperPluginDestroyedCallback(PLDHashTable *table, PLDHashEntryHdr *hdr,
uint32_t number, void *arg)
NPObjWrapperPluginDestroyedCallback(PLDHashTable* table, PLDHashEntryHdr* hdr,
uint32_t number, void* arg)
{
NPObjWrapperHashEntry *entry = (NPObjWrapperHashEntry *)hdr;
NppAndCx *nppcx = reinterpret_cast<NppAndCx *>(arg);
NPObjWrapperHashEntry* entry = (NPObjWrapperHashEntry*)hdr;
NppAndCx* nppcx = reinterpret_cast<NppAndCx*>(arg);
if (entry->mNpp == nppcx->npp) {
// Prevent invalidate() and deallocate() from touching the hash
// we're enumerating.
const PLDHashTableOps *ops = table->Ops();
const PLDHashTableOps* ops = table->Ops();
table->SetOps(nullptr);
NPObject *npobj = entry->mNPObj;
NPObject* npobj = entry->mNPObj;
if (npobj->_class && npobj->_class->invalidate) {
npobj->_class->invalidate(npobj);
@@ -2026,7 +2017,7 @@ nsJSNPRuntime::OnPluginDestroy(NPP npp)
sJSObjWrappersAccessible = false;
for (JSObjWrapperTable::Enum e(sJSObjWrappers); !e.empty(); e.popFront()) {
nsJSObjWrapper *npobj = e.front().value();
nsJSObjWrapper* npobj = e.front().value();
MOZ_ASSERT(npobj->_class == &nsJSObjWrapper::sJSObjWrapperNPClass);
if (npobj->mNpp == npp) {
if (npobj->_class && npobj->_class->invalidate) {
@@ -2060,7 +2051,7 @@ nsJSNPRuntime::OnPluginDestroyPending(NPP npp)
// Prevent modification of sJSObjWrappers table if we go reentrant.
sJSObjWrappersAccessible = false;
for (JSObjWrapperTable::Enum e(sJSObjWrappers); !e.empty(); e.popFront()) {
nsJSObjWrapper *npobj = e.front().value();
nsJSObjWrapper* npobj = e.front().value();
MOZ_ASSERT(npobj->_class == &nsJSObjWrapper::sJSObjWrapperNPClass);
if (npobj->mNpp == npp) {
npobj->mDestroyPending = true;
@@ -2072,14 +2063,14 @@ nsJSNPRuntime::OnPluginDestroyPending(NPP npp)
// Find the NPP for a NPObject.
static NPP
LookupNPP(NPObject *npobj)
LookupNPP(NPObject* npobj)
{
if (npobj->_class == &nsJSObjWrapper::sJSObjWrapperNPClass) {
nsJSObjWrapper* o = static_cast<nsJSObjWrapper*>(npobj);
return o->mNpp;
}
NPObjWrapperHashEntry *entry = static_cast<NPObjWrapperHashEntry *>
NPObjWrapperHashEntry* entry = static_cast<NPObjWrapperHashEntry*>
(PL_DHashTableAdd(&sNPObjWrappers, npobj, fallible));
if (!entry) {
@@ -2092,7 +2083,7 @@ LookupNPP(NPObject *npobj)
}
static bool
CreateNPObjectMember(NPP npp, JSContext *cx,
CreateNPObjectMember(NPP npp, JSContext* cx,
JS::Handle<JSObject*> aObj, NPObject* npobj,
JS::Handle<jsid> id, NPVariant* getPropertyResult,
JS::MutableHandle<JS::Value> vp)
@@ -2104,8 +2095,8 @@ CreateNPObjectMember(NPP npp, JSContext *cx,
return false;
}
NPObjectMemberPrivate *memberPrivate =
(NPObjectMemberPrivate *)PR_Malloc(sizeof(NPObjectMemberPrivate));
NPObjectMemberPrivate* memberPrivate =
(NPObjectMemberPrivate*)PR_Malloc(sizeof(NPObjectMemberPrivate));
if (!memberPrivate)
return false;
@@ -2115,7 +2106,7 @@ CreateNPObjectMember(NPP npp, JSContext *cx,
JS::Rooted<JSObject*> obj(cx, aObj);
JSObject *memobj = ::JS_NewObject(cx, &sNPObjectMemberClass);
JSObject* memobj = ::JS_NewObject(cx, &sNPObjectMemberClass);
if (!memobj) {
PR_Free(memberPrivate);
return false;
@@ -2123,7 +2114,7 @@ CreateNPObjectMember(NPP npp, JSContext *cx,
vp.setObject(*memobj);
::JS_SetPrivate(memobj, (void *)memberPrivate);
::JS_SetPrivate(memobj, (void*)memberPrivate);
NPIdentifier identifier = JSIdToNPIdentifier(id);
@@ -2161,10 +2152,10 @@ CreateNPObjectMember(NPP npp, JSContext *cx,
}
static bool
NPObjectMember_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType type, JS::MutableHandle<JS::Value> vp)
NPObjectMember_Convert(JSContext* cx, JS::Handle<JSObject*> obj, JSType type, JS::MutableHandle<JS::Value> vp)
{
NPObjectMemberPrivate *memberPrivate =
(NPObjectMemberPrivate *)::JS_GetInstancePrivate(cx, obj,
NPObjectMemberPrivate* memberPrivate =
(NPObjectMemberPrivate*)::JS_GetInstancePrivate(cx, obj,
&sNPObjectMemberClass,
nullptr);
if (!memberPrivate) {
@@ -2196,11 +2187,11 @@ NPObjectMember_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType type, JS
}
static void
NPObjectMember_Finalize(JSFreeOp *fop, JSObject *obj)
NPObjectMember_Finalize(JSFreeOp* fop, JSObject* obj)
{
NPObjectMemberPrivate *memberPrivate;
NPObjectMemberPrivate* memberPrivate;
memberPrivate = (NPObjectMemberPrivate *)::JS_GetPrivate(obj);
memberPrivate = (NPObjectMemberPrivate*)::JS_GetPrivate(obj);
if (!memberPrivate)
return;
@@ -2208,21 +2199,21 @@ NPObjectMember_Finalize(JSFreeOp *fop, JSObject *obj)
}
static bool
NPObjectMember_Call(JSContext *cx, unsigned argc, JS::Value *vp)
NPObjectMember_Call(JSContext* cx, unsigned argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> memobj(cx, &args.callee());
NS_ENSURE_TRUE(memobj, false);
NPObjectMemberPrivate *memberPrivate =
(NPObjectMemberPrivate *)::JS_GetInstancePrivate(cx, memobj,
NPObjectMemberPrivate* memberPrivate =
(NPObjectMemberPrivate*)::JS_GetInstancePrivate(cx, memobj,
&sNPObjectMemberClass,
&args);
if (!memberPrivate || !memberPrivate->npobjWrapper)
return false;
JS::Rooted<JSObject*> objWrapper(cx, memberPrivate->npobjWrapper);
NPObject *npobj = GetNPObject(cx, objWrapper);
NPObject* npobj = GetNPObject(cx, objWrapper);
if (!npobj) {
ThrowJSException(cx, "Call on invalid member object");
@@ -2230,12 +2221,12 @@ NPObjectMember_Call(JSContext *cx, unsigned argc, JS::Value *vp)
}
NPVariant npargs_buf[8];
NPVariant *npargs = npargs_buf;
NPVariant* npargs = npargs_buf;
if (args.length() > (sizeof(npargs_buf) / sizeof(NPVariant))) {
// Our stack buffer isn't large enough to hold all arguments,
// malloc a buffer.
npargs = (NPVariant *)PR_Malloc(args.length() * sizeof(NPVariant));
npargs = (NPVariant*)PR_Malloc(args.length() * sizeof(NPVariant));
if (!npargs) {
ThrowJSException(cx, "Out of memory!");
@@ -2290,10 +2281,10 @@ NPObjectMember_Call(JSContext *cx, unsigned argc, JS::Value *vp)
}
static void
NPObjectMember_Trace(JSTracer *trc, JSObject *obj)
NPObjectMember_Trace(JSTracer* trc, JSObject* obj)
{
NPObjectMemberPrivate *memberPrivate =
(NPObjectMemberPrivate *)::JS_GetPrivate(obj);
NPObjectMemberPrivate* memberPrivate =
(NPObjectMemberPrivate*)::JS_GetPrivate(obj);
if (!memberPrivate)
return;
@@ -2316,14 +2307,14 @@ NPObjectMember_Trace(JSTracer *trc, JSObject *obj)
// static
bool
nsJSObjWrapper::HasOwnProperty(NPObject *npobj, NPIdentifier npid)
nsJSObjWrapper::HasOwnProperty(NPObject* npobj, NPIdentifier npid)
{
NPP npp = NPPStack::Peek();
dom::AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(GetGlobalObject(npp)))) {
return false;
}
JSContext *cx = jsapi.cx();
JSContext* cx = jsapi.cx();
if (!npobj) {
ThrowJSException(cx,
@@ -2332,7 +2323,7 @@ nsJSObjWrapper::HasOwnProperty(NPObject *npobj, NPIdentifier npid)
return false;
}
nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
nsJSObjWrapper* npjsobj = (nsJSObjWrapper*)npobj;
bool found, ok = false;
AutoJSExceptionReporter reporter(jsapi, npjsobj);
-4
View File
@@ -39,7 +39,6 @@
#include "mozilla/EventStates.h"
#include "nsFocusManager.h"
#include "nsHTMLStyleSheet.h"
#include "nsIJSRuntimeService.h"
#include "nsNameSpaceManager.h"
#include "nsIObjectInputStream.h"
#include "nsIObjectOutputStream.h"
@@ -2762,9 +2761,6 @@ NotifyOffThreadScriptCompletedRunnable::Run()
// Note: this unroots mScript so that it is available to be collected by the
// JS GC. The receiver needs to root the script before performing a call that
// could GC.
nsCOMPtr<nsIJSRuntimeService> svc = do_GetService("@mozilla.org/js/xpc/RuntimeService;1");
NS_ENSURE_TRUE(svc, NS_ERROR_FAILURE);
JSScript *script;
{
AutoSafeJSContext cx;
@@ -5,7 +5,6 @@
#include "jsapi.h"
#include "nsIXPConnect.h"
#include "nsIJSRuntimeService.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
+4 -155
View File
@@ -2,70 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// derived from process_util_linux.cc and process_util_mac.cc
// derived from process_util_mac.cc
#include "base/process_util.h"
#include <sys/wait.h>
#include <fcntl.h>
#include <unistd.h>
#include <spawn.h>
#include <sys/wait.h>
#include <string>
#include "base/eintr_wrapper.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/string_tokenizer.h"
#include "base/string_util.h"
#include "mozilla/UniquePtr.h"
#if defined(_POSIX_SPAWN) && _POSIX_SPAWN > 0
#define HAVE_POSIX_SPAWN 1
#endif
/*
* On platforms that are not gonk based, we fall back to an arbitrary
* UID. This is generally the UID for user `nobody', albeit it is not
* always the case.
*/
#if defined(OS_NETBSD) || defined(OS_OPENBSD)
# define CHILD_UNPRIVILEGED_UID 32767
# define CHILD_UNPRIVILEGED_GID 32767
#else
# define CHILD_UNPRIVILEGED_UID 65534
# define CHILD_UNPRIVILEGED_GID 65534
#endif
#ifndef __dso_public
# ifdef __exported
# define __dso_public __exported
# else
# define __dso_public __attribute__((__visibility__("default")))
# endif
#endif
#ifdef HAVE_POSIX_SPAWN
#include <spawn.h>
extern "C" char **environ __dso_public;
#endif
namespace {
enum ParsingState {
KEY_NAME,
KEY_VALUE
};
static mozilla::EnvironmentLog gProcessLog("MOZ_PROCESS_LOG");
} // namespace
extern "C" char **environ __attribute__((__visibility__("default")));
namespace base {
#ifdef HAVE_POSIX_SPAWN
void FreeEnvVarsArray(char* array[], int length)
{
for (int i = 0; i < length; i++) {
@@ -201,107 +153,4 @@ void SetCurrentProcessPrivileges(ChildPrivileges privs) {
}
#else // no posix_spawn, use fork/exec
bool LaunchApp(const std::vector<std::string>& argv,
const file_handle_mapping_vector& fds_to_remap,
bool wait, ProcessHandle* process_handle) {
return LaunchApp(argv, fds_to_remap, environment_map(),
wait, process_handle);
}
bool LaunchApp(const std::vector<std::string>& argv,
const file_handle_mapping_vector& fds_to_remap,
const environment_map& env_vars_to_set,
bool wait, ProcessHandle* process_handle,
ProcessArchitecture arch) {
return LaunchApp(argv, fds_to_remap, env_vars_to_set,
PRIVILEGES_INHERIT,
wait, process_handle);
}
bool LaunchApp(const std::vector<std::string>& argv,
const file_handle_mapping_vector& fds_to_remap,
const environment_map& env_vars_to_set,
ChildPrivileges privs,
bool wait, ProcessHandle* process_handle,
ProcessArchitecture arch) {
mozilla::UniquePtr<char*[]> argv_cstr(new char*[argv.size() + 1]);
// Illegal to allocate memory after fork and before execvp
InjectiveMultimap fd_shuffle1, fd_shuffle2;
fd_shuffle1.reserve(fds_to_remap.size());
fd_shuffle2.reserve(fds_to_remap.size());
pid_t pid = fork();
if (pid < 0)
return false;
if (pid == 0) {
for (file_handle_mapping_vector::const_iterator
it = fds_to_remap.begin(); it != fds_to_remap.end(); ++it) {
fd_shuffle1.push_back(InjectionArc(it->first, it->second, false));
fd_shuffle2.push_back(InjectionArc(it->first, it->second, false));
}
if (!ShuffleFileDescriptors(&fd_shuffle1))
_exit(127);
CloseSuperfluousFds(fd_shuffle2);
for (size_t i = 0; i < argv.size(); i++)
argv_cstr[i] = const_cast<char*>(argv[i].c_str());
argv_cstr[argv.size()] = NULL;
SetCurrentProcessPrivileges(privs);
for (environment_map::const_iterator it = env_vars_to_set.begin();
it != env_vars_to_set.end(); ++it) {
if (setenv(it->first.c_str(), it->second.c_str(), 1/*overwrite*/))
_exit(127);
}
execv(argv_cstr[0], argv_cstr.get());
// if we get here, we're in serious trouble and should complain loudly
DLOG(ERROR) << "FAILED TO exec() CHILD PROCESS, path: " << argv_cstr[0];
_exit(127);
} else {
gProcessLog.print("==> process %d launched child process %d\n",
GetCurrentProcId(), pid);
if (wait)
HANDLE_EINTR(waitpid(pid, 0, 0));
if (process_handle)
*process_handle = pid;
}
return true;
}
bool LaunchApp(const CommandLine& cl,
bool wait, bool start_hidden,
ProcessHandle* process_handle) {
file_handle_mapping_vector no_files;
return LaunchApp(cl.argv(), no_files, wait, process_handle);
}
void SetCurrentProcessPrivileges(ChildPrivileges privs) {
if (privs == PRIVILEGES_INHERIT) {
return;
}
gid_t gid = CHILD_UNPRIVILEGED_GID;
uid_t uid = CHILD_UNPRIVILEGED_UID;
if (setgid(gid) != 0) {
DLOG(ERROR) << "FAILED TO setgid() CHILD PROCESS";
_exit(127);
}
if (setuid(uid) != 0) {
DLOG(ERROR) << "FAILED TO setuid() CHILD PROCESS";
_exit(127);
}
if (chdir("/") != 0)
gProcessLog.print("==> could not chdir()\n");
}
#endif
} // namespace base
+2 -10
View File
@@ -26,7 +26,6 @@
#include "nsIChannel.h"
#include "nsIClassInfo.h"
#include "nsIDirectoryService.h"
#include "nsIJSRuntimeService.h"
#include "nsIPrincipal.h"
#include "nsIScriptSecurityManager.h"
#include "nsIURI.h"
@@ -486,15 +485,8 @@ XPCShellEnvironment::Init()
// is unbuffered by default
setbuf(stdout, 0);
nsCOMPtr<nsIJSRuntimeService> rtsvc =
do_GetService("@mozilla.org/js/xpc/RuntimeService;1");
if (!rtsvc) {
NS_ERROR("failed to get nsJSRuntimeService!");
return false;
}
JSRuntime *rt;
if (NS_FAILED(rtsvc->GetRuntime(&rt)) || !rt) {
JSRuntime *rt = xpc::GetJSRuntime();
if (!rt) {
NS_ERROR("failed to get JSRuntime from nsJSRuntimeService!");
return false;
}
+2 -1
View File
@@ -328,7 +328,8 @@ struct JS_PUBLIC_API(GCDescription) {
GCDescription(bool isCompartment, JSGCInvocationKind kind)
: isCompartment_(isCompartment), invocationKind_(kind) {}
char16_t* formatMessage(JSRuntime* rt) const;
char16_t* formatSliceMessage(JSRuntime* rt) const;
char16_t* formatSummaryMessage(JSRuntime* rt) const;
char16_t* formatJSON(JSRuntime* rt, uint64_t timestamp) const;
JS::dbg::GarbageCollectionEvent::Ptr toGCEvent(JSRuntime* rt) const;
+4 -1
View File
@@ -129,6 +129,9 @@ endif
check-style::
(cd $(srcdir) && $(PYTHON) $(topsrcdir)/config/check_spidermonkey_style.py);
check-masm::
(cd $(srcdir) && $(PYTHON) $(topsrcdir)/config/check_macroassembler_style.py);
check-jit-test::
$(JITTEST_ASAN_ENV) $(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/jit-test/jit_test.py \
--no-slow --no-progress --format=automation --jitflags=all \
@@ -136,7 +139,7 @@ check-jit-test::
$(JITTEST_EXTRA_ARGS) \
$(DIST)/bin/$(JS_SHELL_NAME)$(BIN_SUFFIX)
check:: check-style
check:: check-style check-masm
check-jstests:
$(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/tests/jstests.py \
+357 -120
View File
@@ -86,7 +86,7 @@ class gcstats::StatisticsSerializer
if (d < 0)
d = 0;
if (asJSON_)
appendNumber(name, "%d.%d", units, (int)d, (int)(d * 10.) % 10);
appendNumber(name, "%d.%03d", units, int(d), int(d * 1000.) % 1000);
else
appendNumber(name, "%.1f", units, d);
}
@@ -390,7 +390,7 @@ struct AllPhaseIterator {
size_t activeSlot;
mozilla::Vector<Phase>::Range descendants;
explicit AllPhaseIterator(int64_t (*table)[PHASE_LIMIT])
explicit AllPhaseIterator(Statistics::PhaseTimeTable table)
: current(0)
, baseLevel(0)
, activeSlot(PHASE_DAG_NONE)
@@ -437,7 +437,7 @@ struct AllPhaseIterator {
};
static void
FormatPhaseTimes(StatisticsSerializer& ss, const char* name, int64_t (*times)[PHASE_LIMIT])
FormatPhaseTimes(StatisticsSerializer& ss, const char* name, Statistics::PhaseTimeTable times)
{
ss.beginObject(name);
@@ -451,10 +451,10 @@ FormatPhaseTimes(StatisticsSerializer& ss, const char* name, int64_t (*times)[PH
}
void
Statistics::gcDuration(int64_t* total, int64_t* maxPause)
Statistics::gcDuration(int64_t* total, int64_t* maxPause) const
{
*total = *maxPause = 0;
for (SliceData* slice = slices.begin(); slice != slices.end(); slice++) {
for (const SliceData* slice = slices.begin(); slice != slices.end(); slice++) {
*total += slice->duration();
if (slice->duration() > *maxPause)
*maxPause = slice->duration();
@@ -560,10 +560,14 @@ Statistics::formatData(StatisticsSerializer& ss, uint64_t timestamp)
typedef Vector<UniqueChars, 8, SystemAllocPolicy> FragmentVector;
static UniqueChars
Join(const FragmentVector& fragments) {
Join(const FragmentVector& fragments, const char* separator = "") {
const size_t separatorLength = strlen(separator);
size_t length = 0;
for (size_t i = 0; i < fragments.length(); ++i)
for (size_t i = 0; i < fragments.length(); ++i) {
length += fragments[i] ? strlen(fragments[i].get()) : 0;
if (i < (fragments.length() - 1))
length += separatorLength;
}
char* joined = js_pod_malloc<char>(length + 1);
joined[length] = '\0';
@@ -573,13 +577,178 @@ Join(const FragmentVector& fragments) {
if (fragments[i])
strcpy(cursor, fragments[i].get());
cursor += fragments[i] ? strlen(fragments[i].get()) : 0;
if (i < (fragments.length() - 1)) {
if (separatorLength)
strcpy(cursor, separator);
cursor += separatorLength;
}
}
return UniqueChars(joined);
}
static int64_t
SumChildTimes(size_t phaseSlot, Phase phase, Statistics::PhaseTimeTable phaseTimes)
{
// Sum the contributions from single-parented children.
int64_t total = 0;
for (unsigned i = 0; i < PHASE_LIMIT; i++) {
if (phases[i].parent == phase)
total += phaseTimes[phaseSlot][i];
}
// Sum the contributions from multi-parented children.
size_t dagSlot = phaseExtra[phase].dagSlot;
if (dagSlot != PHASE_DAG_NONE) {
for (size_t i = 0; i < mozilla::ArrayLength(dagChildEdges); i++) {
if (dagChildEdges[i].parent == phase) {
Phase child = dagChildEdges[i].child;
total += phaseTimes[dagSlot][child];
}
}
}
return total;
}
UniqueChars
Statistics::formatDescription()
Statistics::formatCompactSliceMessage() const
{
// Skip if we OOM'ed.
if (slices.length() == 0)
return UniqueChars(nullptr);
const size_t index = slices.length() - 1;
const SliceData& slice = slices[index];
char budgetDescription[200];
slice.budget.describe(budgetDescription, sizeof(budgetDescription) - 1);
const char* format =
"GC Slice %u - Pause: %.3fms of %s budget (@ %.3fms); Reason: %s; Reset: %s%s; Times: ";
char buffer[1024];
memset(buffer, 0, sizeof(buffer));
JS_snprintf(buffer, sizeof(buffer), format, index,
t(slice.duration()), budgetDescription, t(slice.start - slices[0].start),
ExplainReason(slice.reason),
slice.resetReason ? "yes - " : "no", slice.resetReason ? slice.resetReason : "");
FragmentVector fragments;
if (!fragments.append(make_string_copy(buffer)) ||
!fragments.append(formatCompactSlicePhaseTimes(slices[index].phaseTimes)))
{
return UniqueChars(nullptr);
}
return Join(fragments);
}
UniqueChars
Statistics::formatCompactSummaryMessage() const
{
const double bytesPerMiB = 1024 * 1024;
FragmentVector fragments;
if (!fragments.append(make_string_copy("Summary - ")))
return UniqueChars(nullptr);
int64_t total, longest;
gcDuration(&total, &longest);
const double mmu20 = computeMMU(20 * PRMJ_USEC_PER_MSEC);
const double mmu50 = computeMMU(50 * PRMJ_USEC_PER_MSEC);
char buffer[1024];
if (!nonincrementalReason_) {
JS_snprintf(buffer, sizeof(buffer),
"Max Pause: %.3fms; MMU 20ms: %.1f%%; MMU 50ms: %.1f%%; Total: %.3fms; ",
t(longest), mmu20 * 100., mmu50 * 100., t(total));
} else {
JS_snprintf(buffer, sizeof(buffer), "Non-Incremental: %.3fms; ", t(total));
}
if (!fragments.append(make_string_copy(buffer)))
return UniqueChars(nullptr);
JS_snprintf(buffer, sizeof(buffer),
"Zones: %d of %d; Compartments: %d of %d; HeapSize: %.3f MiB; "\
"HeapChange (abs): %+d (%d); ",
zoneStats.collectedZoneCount, zoneStats.zoneCount,
zoneStats.collectedCompartmentCount, zoneStats.compartmentCount,
double(preBytes) / bytesPerMiB,
counts[STAT_NEW_CHUNK] - counts[STAT_DESTROY_CHUNK],
counts[STAT_NEW_CHUNK] + counts[STAT_DESTROY_CHUNK]);
if (!fragments.append(make_string_copy(buffer)))
return UniqueChars(nullptr);
MOZ_ASSERT_IF(counts[STAT_ARENA_RELOCATED], gckind == GC_SHRINK);
if (gckind == GC_SHRINK) {
JS_snprintf(buffer, sizeof(buffer),
"Kind: %s; Relocated: %.3f MiB; ",
ExplainInvocationKind(gckind),
double(ArenaSize * counts[STAT_ARENA_RELOCATED]) / bytesPerMiB);
if (!fragments.append(make_string_copy(buffer)))
return UniqueChars(nullptr);
}
return Join(fragments);
}
UniqueChars
Statistics::formatCompactSlicePhaseTimes(PhaseTimeTable phaseTimes) const
{
static const int64_t MaxUnaccountedTimeUS = 100;
FragmentVector fragments;
char buffer[128];
for (AllPhaseIterator iter(phaseTimes); !iter.done(); iter.advance()) {
Phase phase;
size_t dagSlot;
size_t level;
iter.get(&phase, &dagSlot, &level);
MOZ_ASSERT(level < 4);
int64_t ownTime = phaseTimes[dagSlot][phase];
int64_t childTime = SumChildTimes(dagSlot, phase, phaseTimes);
if (ownTime > MaxUnaccountedTimeUS) {
JS_snprintf(buffer, sizeof(buffer), "%s: %.3fms", phases[phase].name, t(ownTime));
if (!fragments.append(make_string_copy(buffer)))
return UniqueChars(nullptr);
if (childTime && (ownTime - childTime) > MaxUnaccountedTimeUS) {
MOZ_ASSERT(level < 3);
JS_snprintf(buffer, sizeof(buffer), "%s: %.3fms", "Other", t(ownTime - childTime));
if (!fragments.append(make_string_copy(buffer)))
return UniqueChars(nullptr);
}
}
}
return Join(fragments, ", ");
}
UniqueChars
Statistics::formatDetailedMessage()
{
FragmentVector fragments;
if (!fragments.append(formatDetailedDescription()))
return UniqueChars(nullptr);
if (slices.length() > 1) {
for (unsigned i = 0; i < slices.length(); i++) {
if (!fragments.append(formatDetailedSliceDescription(i, slices[i])))
return UniqueChars(nullptr);
if (!fragments.append(formatDetailedPhaseTimes(slices[i].phaseTimes)))
return UniqueChars(nullptr);
}
}
if (!fragments.append(formatDetailedTotals()))
return UniqueChars(nullptr);
if (!fragments.append(formatDetailedPhaseTimes(phaseTimes)))
return UniqueChars(nullptr);
return Join(fragments);
}
UniqueChars
Statistics::formatDetailedDescription()
{
const double bytesPerMiB = 1024 * 1024;
@@ -625,7 +794,7 @@ Statistics::formatDescription()
}
UniqueChars
Statistics::formatSliceDescription(unsigned i, const SliceData& slice)
Statistics::formatDetailedSliceDescription(unsigned i, const SliceData& slice)
{
char budgetDescription[200];
slice.budget.describe(budgetDescription, sizeof(budgetDescription) - 1);
@@ -649,48 +818,7 @@ Statistics::formatSliceDescription(unsigned i, const SliceData& slice)
}
UniqueChars
Statistics::formatTotals()
{
int64_t total, longest;
gcDuration(&total, &longest);
const char* format =
"\
---- Totals ----\n\
Total Time: %.3fms\n\
Max Pause: %.3fms\n\
";
char buffer[1024];
memset(buffer, 0, sizeof(buffer));
JS_snprintf(buffer, sizeof(buffer), format, t(total), t(longest));
return make_string_copy(buffer);
}
static int64_t
SumChildTimes(size_t phaseSlot, Phase phase, int64_t (*phaseTimes)[PHASE_LIMIT])
{
// Sum the contributions from single-parented children.
int64_t total = 0;
for (unsigned i = 0; i < PHASE_LIMIT; i++) {
if (phases[i].parent == phase)
total += phaseTimes[phaseSlot][i];
}
// Sum the contributions from multi-parented children.
size_t dagSlot = phaseExtra[phase].dagSlot;
if (dagSlot != PHASE_DAG_NONE) {
for (size_t i = 0; i < mozilla::ArrayLength(dagChildEdges); i++) {
if (dagChildEdges[i].parent == phase) {
Phase child = dagChildEdges[i].child;
total += phaseTimes[dagSlot][child];
}
}
}
return total;
}
UniqueChars
Statistics::formatPhaseTimes(int64_t (*phaseTimes)[PHASE_LIMIT])
Statistics::formatDetailedPhaseTimes(PhaseTimeTable phaseTimes)
{
static const char* LevelToIndent[] = { "", " ", " ", " " };
static const int64_t MaxUnaccountedChildTimeUS = 50;
@@ -725,29 +853,178 @@ Statistics::formatPhaseTimes(int64_t (*phaseTimes)[PHASE_LIMIT])
}
UniqueChars
Statistics::formatDetailedMessage()
Statistics::formatDetailedTotals()
{
int64_t total, longest;
gcDuration(&total, &longest);
const char* format =
"\
---- Totals ----\n\
Total Time: %.3fms\n\
Max Pause: %.3fms\n\
";
char buffer[1024];
memset(buffer, 0, sizeof(buffer));
JS_snprintf(buffer, sizeof(buffer), format, t(total), t(longest));
return make_string_copy(buffer);
}
UniqueChars
Statistics::formatJsonMessage(uint64_t timestamp)
{
MOZ_ASSERT(!aborted);
FragmentVector fragments;
if (!fragments.append(formatDescription()))
if (!fragments.append(make_string_copy("{")) ||
!fragments.append(formatJsonDescription(timestamp)) ||
!fragments.append(make_string_copy("\"slices\":[")))
{
return UniqueChars(nullptr);
}
if (slices.length() > 1) {
for (unsigned i = 0; i < slices.length(); i++) {
if (!fragments.append(formatSliceDescription(i, slices[i])))
return UniqueChars(nullptr);
if (!fragments.append(formatPhaseTimes(slices[i].phaseTimes)))
return UniqueChars(nullptr);
for (unsigned i = 0; i < slices.length(); i++) {
if (!fragments.append(make_string_copy("{")) ||
!fragments.append(formatJsonSliceDescription(i, slices[i])) ||
!fragments.append(make_string_copy("\"times\":{")) ||
!fragments.append(formatJsonPhaseTimes(slices[i].phaseTimes)) ||
!fragments.append(make_string_copy("}}")) ||
(i < (slices.length() - 1) && !fragments.append(make_string_copy(","))))
{
return UniqueChars(nullptr);
}
}
if (!fragments.append(formatTotals()))
return UniqueChars(nullptr);
if (!fragments.append(formatPhaseTimes(phaseTimes)))
if (!fragments.append(make_string_copy("],\"totals\":{")) ||
!fragments.append(formatJsonPhaseTimes(phaseTimes)) ||
!fragments.append(make_string_copy("}}")))
{
return UniqueChars(nullptr);
}
return Join(fragments);
}
UniqueChars
Statistics::formatJsonDescription(uint64_t timestamp)
{
int64_t total, longest;
gcDuration(&total, &longest);
int64_t sccTotal, sccLongest;
sccDurations(&sccTotal, &sccLongest);
double mmu20 = computeMMU(20 * PRMJ_USEC_PER_MSEC);
double mmu50 = computeMMU(50 * PRMJ_USEC_PER_MSEC);
const char *format =
"\"timestamp\":%llu,"
"\"max_pause\":%lu.%03lu,"
"\"total_time\":%lu.%03lu,"
"\"zones_collected\":%d,"
"\"total_zones\":%d,"
"\"total_compartments\":%d,"
"\"minor_gcs\":%d,"
"\"store_buffer_overflows\":%d,"
"\"mmu_20ms\":%d,"
"\"mmu_50ms\":%d,"
"\"scc_sweep_total\":%lu.%03lu,"
"\"scc_sweep_max_pause\":%lu.%03lu,"
"\"nonincremental_reason\":\"%s\","
"\"allocated\":%u,"
"\"added_chunks\":%d,"
"\"removed_chunks\":%d,";
char buffer[1024];
memset(buffer, 0, sizeof(buffer));
JS_snprintf(buffer, sizeof(buffer), format,
(unsigned long long)timestamp,
longest / 1000, longest % 1000,
total / 1000, total % 1000,
zoneStats.collectedZoneCount,
zoneStats.zoneCount,
zoneStats.compartmentCount,
counts[STAT_MINOR_GC],
counts[STAT_STOREBUFFER_OVERFLOW],
int(mmu20 * 100),
int(mmu50 * 100),
sccTotal / 1000, sccTotal % 1000,
sccLongest / 1000, sccLongest % 1000,
nonincrementalReason_ ? nonincrementalReason_ : "none",
unsigned(preBytes / 1024 / 1024),
counts[STAT_NEW_CHUNK],
counts[STAT_DESTROY_CHUNK]);
return make_string_copy(buffer);
}
UniqueChars
Statistics::formatJsonSliceDescription(unsigned i, const SliceData& slice)
{
int64_t duration = slices[i].duration();
int64_t when = slices[i].start - slices[0].start;
char budgetDescription[200];
slice.budget.describe(budgetDescription, sizeof(budgetDescription) - 1);
int64_t pageFaults = slices[i].endFaults - slices[i].startFaults;
const char* format =
"\"slice\":%d,"
"\"pause\":%lu.%03lu,"
"\"when\":%lu.%03lu,"
"\"reason\":\"%s\","
"\"budget\":\"%s\","
"\"page_faults\":%llu,"
"\"start_timestamp\":%llu,"
"\"end_timestamp\":%llu,";
char buffer[1024];
memset(buffer, 0, sizeof(buffer));
JS_snprintf(buffer, sizeof(buffer), format,
i,
duration / 1000, duration % 1000,
when / 1000, when % 1000,
ExplainReason(slices[i].reason),
budgetDescription,
pageFaults,
slices[i].start,
slices[i].end);
return make_string_copy(buffer);
}
UniqueChars
FilterJsonKey(const char*const buffer)
{
char* mut = strdup(buffer);
char* c = mut;
while (*c) {
if (!isalpha(*c))
*c = '_';
else if (isupper(*c))
*c = tolower(*c);
++c;
}
return UniqueChars(mut);
}
UniqueChars
Statistics::formatJsonPhaseTimes(PhaseTimeTable phaseTimes)
{
FragmentVector fragments;
char buffer[128];
for (AllPhaseIterator iter(phaseTimes); !iter.done(); iter.advance()) {
Phase phase;
size_t dagSlot;
iter.get(&phase, &dagSlot);
UniqueChars name = FilterJsonKey(phases[phase].name);
int64_t ownTime = phaseTimes[dagSlot][phase];
JS_snprintf(buffer, sizeof(buffer), "\"%s\":%lu.%03lu",
name.get(), ownTime / 1000, ownTime % 1000);
if (!fragments.append(make_string_copy(buffer)))
return UniqueChars(nullptr);
}
return Join(fragments, ",");
}
char16_t*
Statistics::formatMessage()
{
@@ -756,19 +1033,10 @@ Statistics::formatMessage()
return ss.finishJSString();
}
char16_t*
Statistics::formatJSON(uint64_t timestamp)
{
StatisticsSerializer ss(StatisticsSerializer::AsJSON);
formatData(ss, timestamp);
return ss.finishJSString();
}
Statistics::Statistics(JSRuntime* rt)
: runtime(rt),
startupTime(PRMJ_Now()),
fp(nullptr),
fullFormat(false),
gcDepth(0),
nonincrementalReason_(nullptr),
timedGCStart(0),
@@ -842,41 +1110,25 @@ Statistics::Statistics(JSRuntime* rt)
}
char* env = getenv("MOZ_GCTIMER");
if (!env || strcmp(env, "none") == 0) {
fp = nullptr;
return;
}
if (strcmp(env, "stdout") == 0) {
fullFormat = false;
fp = stdout;
} else if (strcmp(env, "stderr") == 0) {
fullFormat = false;
fp = stderr;
} else {
fullFormat = true;
fp = fopen(env, "a");
MOZ_ASSERT(fp);
if (env) {
if (strcmp(env, "none") == 0) {
fp = nullptr;
} else if (strcmp(env, "stdout") == 0) {
fp = stdout;
} else if (strcmp(env, "stderr") == 0) {
fp = stderr;
} else {
fp = fopen(env, "a");
if (!fp)
MOZ_CRASH("Failed to open MOZ_GCTIMER log file.");
}
}
}
Statistics::~Statistics()
{
if (fp) {
if (fullFormat) {
StatisticsSerializer ss(StatisticsSerializer::AsText);
FormatPhaseTimes(ss, "", phaseTotals);
char* msg = ss.finishCString();
if (msg) {
fprintf(fp, "TOTALS\n%s\n\n-------\n", msg);
js_free(msg);
}
}
if (fp != stdout && fp != stderr)
fclose(fp);
}
if (fp && fp != stdout && fp != stderr)
fclose(fp);
}
JS::GCSliceCallback
@@ -902,7 +1154,7 @@ Statistics::getMaxGCPauseSinceClear()
}
static int64_t
SumPhase(Phase phase, int64_t (*times)[PHASE_LIMIT])
SumPhase(Phase phase, Statistics::PhaseTimeTable times)
{
int64_t sum = 0;
for (size_t i = 0; i < Statistics::MAX_MULTIPARENT_PHASES + 1; i++)
@@ -914,26 +1166,11 @@ void
Statistics::printStats()
{
if (aborted) {
if (fullFormat)
fprintf(fp, "OOM during GC statistics collection. The report is unavailable for this GC.\n");
fflush(fp);
return;
}
if (fullFormat) {
fprintf(fp, "OOM during GC statistics collection. The report is unavailable for this GC.\n");
} else {
UniqueChars msg = formatDetailedMessage();
if (msg)
fprintf(fp, "GC(T+%.3fs) %s\n", t(slices[0].start - startupTime) / 1000.0, msg.get());
} else {
int64_t total, longest;
gcDuration(&total, &longest);
int64_t markTotal = SumPhase(PHASE_MARK, phaseTimes);
fprintf(fp, "%f %f %f\n",
t(total),
t(markTotal),
t(phaseTimes[PHASE_DAG_NONE][PHASE_SWEEP]));
MOZ_ASSERT(phaseExtra[PHASE_SWEEP].dagSlot == PHASE_DAG_NONE);
}
fflush(fp);
}
@@ -1166,7 +1403,7 @@ Statistics::endSCC(unsigned scc, int64_t start)
* as long as the total time it spends is at most 10ms.
*/
double
Statistics::computeMMU(int64_t window)
Statistics::computeMMU(int64_t window) const
{
MOZ_ASSERT(!slices.empty());
+21 -10
View File
@@ -187,7 +187,9 @@ struct Statistics
void endSCC(unsigned scc, int64_t start);
char16_t* formatMessage();
char16_t* formatJSON(uint64_t timestamp);
UniqueChars formatCompactSliceMessage() const;
UniqueChars formatCompactSummaryMessage() const;
UniqueChars formatJsonMessage(uint64_t timestamp);
UniqueChars formatDetailedMessage();
JS::GCSliceCallback setSliceCallback(JS::GCSliceCallback callback);
@@ -232,13 +234,16 @@ struct Statistics
SliceRange sliceRange() const { return slices.all(); }
size_t slicesLength() const { return slices.length(); }
/* Create a convenient typedef for referring tables of phase times. */
typedef int64_t const (*PhaseTimeTable)[PHASE_LIMIT];
private:
JSRuntime *runtime;
JSRuntime* runtime;
int64_t startupTime;
/* File pointer used for MOZ_GCTIMER output. */
FILE* fp;
bool fullFormat;
/*
* GCs can't really nest, but a second GC can be triggered from within the
@@ -274,7 +279,7 @@ struct Statistics
size_t preBytes;
/* Records the maximum GC pause in an API-controlled interval (in us). */
int64_t maxPauseInInterval;
mutable int64_t maxPauseInInterval;
/* Phases that are currently on stack. */
Phase phaseNesting[MAX_NESTING];
@@ -306,17 +311,23 @@ struct Statistics
void recordPhaseEnd(Phase phase);
void gcDuration(int64_t* total, int64_t* maxPause);
void gcDuration(int64_t* total, int64_t* maxPause) const;
void sccDurations(int64_t* total, int64_t* maxPause);
void printStats();
bool formatData(StatisticsSerializer& ss, uint64_t timestamp);
UniqueChars formatDescription();
UniqueChars formatSliceDescription(unsigned i, const SliceData& slice);
UniqueChars formatTotals();
UniqueChars formatPhaseTimes(int64_t (*phaseTimes)[PHASE_LIMIT]);
UniqueChars formatCompactSlicePhaseTimes(PhaseTimeTable phaseTimes) const;
double computeMMU(int64_t resolution);
UniqueChars formatDetailedDescription();
UniqueChars formatDetailedSliceDescription(unsigned i, const SliceData& slice);
UniqueChars formatDetailedPhaseTimes(PhaseTimeTable phaseTimes);
UniqueChars formatDetailedTotals();
UniqueChars formatJsonDescription(uint64_t timestamp);
UniqueChars formatJsonSliceDescription(unsigned i, const SliceData& slice);
UniqueChars formatJsonPhaseTimes(PhaseTimeTable phaseTimes);
double computeMMU(int64_t resolution) const;
};
struct AutoGCSlice
+2
View File
@@ -12,6 +12,7 @@
namespace js {
namespace jit {
//{{{ check_macroassembler_style
// ===============================================================
// Frame manipulation functions.
@@ -73,6 +74,7 @@ MacroAssembler::call(const CallSiteDesc& desc, Label* label)
append(desc, currentOffset(), framePushed());
}
//}}} check_macroassembler_style
// ===============================================================
void
+3
View File
@@ -2597,6 +2597,7 @@ MacroAssembler::icRestoreLive(LiveRegisterSet& liveRegs, AfterICSaveLive& aic)
PopRegsInMask(liveRegs);
}
//{{{ check_macroassembler_style
// ===============================================================
// Stack manipulation functions.
@@ -2761,3 +2762,5 @@ MacroAssembler::freeStack(Register amount)
{
addToStackPtr(amount);
}
//}}} check_macroassembler_style
+140 -31
View File
@@ -7,6 +7,7 @@
#ifndef jit_MacroAssembler_h
#define jit_MacroAssembler_h
#include "mozilla/MacroForEach.h"
#include "mozilla/MathAlgorithms.h"
#include "jscompartment.h"
@@ -34,28 +35,134 @@
#include "vm/Shape.h"
#include "vm/UnboxedObject.h"
// This Macro is only a hint for code readers that the function is defined in a
// specific macro assembler, and not in the generic macro assembler. Thus, when
// looking for the implementation one might find if the function is implemented
// and where it is supposed to be implemented.
# define PER_ARCH
// * How to read/write MacroAssembler method declarations:
//
// The following macros are made to avoid #ifdef around each method declarations
// of the Macro Assembler, and they are also used as an hint on the location of
// the implementations of each method. For example, the following declaration
//
// void Pop(FloatRegister t) DEFINED_ON(x86_shared, arm);
//
// suggests the MacroAssembler::Pop(FloatRegister) method is implemented in
// x86-shared/MacroAssembler-x86-shared.h, and also in arm/MacroAssembler-arm.h.
//
// - If there is no annotation, then there is only one generic definition in
// MacroAssembler.cpp.
//
// - If the declaration is "inline", then the method definition(s) would be in
// the "-inl.h" variant of the same file(s).
//
// The script check_macroassembler_style.py (check-masm target of the Makefile)
// is used to verify that method definitions are matching the annotation added
// to the method declarations. If there is any difference, then you either
// forgot to define the method in one of the macro assembler, or you forgot to
// update the annotation of the macro assembler declaration.
//
// Some convenient short-cuts are used to avoid repeating the same list of
// architectures on each method declaration, such as PER_ARCH and
// PER_SHARED_ARCH.
# define ALL_ARCH mips, arm, arm64, x86, x64
# define ALL_SHARED_ARCH mips, arm, arm64, x86_shared
// * How this macro works:
//
// DEFINED_ON is a macro which check if, for the current architecture, the
// method is defined on the macro assembler or not.
//
// For each architecutre, we have a macro named DEFINED_ON_arch. This macro is
// empty if this is not the current architecture. Otherwise it must be either
// set to "define" or "crash" (only use for the none target so-far).
//
// The DEFINED_ON macro maps the list of architecture names given as argument to
// a list of macro names. For example,
//
// DEFINED_ON(arm, x86_shared)
//
// is expanded to
//
// DEFINED_ON_none DEFINED_ON_arm DEFINED_ON_x86_shared
//
// which are later expanded on ARM, x86, x64 by DEFINED_ON_EXPAND_ARCH_RESULTS
// to
//
// define
//
// or if the JIT is disabled or set to no architecture to
//
// crash
//
// or to nothing, if the current architecture is not lsited in the list of
// arguments of DEFINED_ON. Note, only one of the DEFINED_ON_arch macro
// contributes to the non-empty result, which is the macro of the current
// architecture if it is listed in the arguments of DEFINED_ON.
//
// This result is appended to DEFINED_ON_RESULT_ before expanding the macro,
// which result is either no annotation, a MOZ_CRASH(), or a "= delete"
// annotation on the method declaration.
# define DEFINED_ON_x86
# define DEFINED_ON_x64
# define DEFINED_ON_x86_shared
# define DEFINED_ON_arm
# define DEFINED_ON_arm64
# define DEFINED_ON_mips
# define DEFINED_ON_none
// Specialize for each architecture.
#if defined(JS_CODEGEN_X86)
# define ONLY_X86_X64
# undef DEFINED_ON_x86
# define DEFINED_ON_x86 define
# undef DEFINED_ON_x86_shared
# define DEFINED_ON_x86_shared define
#elif defined(JS_CODEGEN_X64)
# define ONLY_X86_X64
# undef DEFINED_ON_x64
# define DEFINED_ON_x64 define
# undef DEFINED_ON_x86_shared
# define DEFINED_ON_x86_shared define
#elif defined(JS_CODEGEN_ARM)
# define ONLY_X86_X64 = delete
# undef DEFINED_ON_arm
# define DEFINED_ON_arm define
#elif defined(JS_CODEGEN_ARM64)
# define ONLY_X86_X64 = delete
# undef DEFINED_ON_arm64
# define DEFINED_ON_arm64 define
#elif defined(JS_CODEGEN_MIPS)
# define ONLY_X86_X64 = delete
# undef DEFINED_ON_mips
# define DEFINED_ON_mips define
#elif defined(JS_CODEGEN_NONE)
# define ONLY_X86_X64 = delete
# undef DEFINED_ON_none
# define DEFINED_ON_none crash
#else
# error "Unknown architecture!"
#endif
# define DEFINED_ON_RESULT_crash { MOZ_CRASH(); }
# define DEFINED_ON_RESULT_define
# define DEFINED_ON_RESULT_ = delete
# define DEFINED_ON_DISPATCH_RESULT(Result) \
DEFINED_ON_RESULT_ ## Result
// We need to let the evaluation of MOZ_FOR_EACH terminates.
# define DEFINED_ON_EXPAND_ARCH_RESULTS_3(ParenResult) \
DEFINED_ON_DISPATCH_RESULT ParenResult
# define DEFINED_ON_EXPAND_ARCH_RESULTS_2(ParenResult) \
DEFINED_ON_EXPAND_ARCH_RESULTS_3 (ParenResult)
# define DEFINED_ON_EXPAND_ARCH_RESULTS(ParenResult) \
DEFINED_ON_EXPAND_ARCH_RESULTS_2 (ParenResult)
# define DEFINED_ON_FWDARCH(Arch) DEFINED_ON_ ## Arch
# define DEFINED_ON_MAP_ON_ARCHS(ArchList) \
DEFINED_ON_EXPAND_ARCH_RESULTS( \
(MOZ_FOR_EACH(DEFINED_ON_FWDARCH, (), ArchList)))
# define DEFINED_ON(...) \
DEFINED_ON_MAP_ON_ARCHS((none, __VA_ARGS__))
# define PER_ARCH DEFINED_ON(ALL_ARCH)
# define PER_SHARED_ARCH DEFINED_ON(ALL_SHARED_ARCH)
#ifdef IS_LITTLE_ENDIAN
#define IMM32_16ADJ(X) X << 16
#else
@@ -285,6 +392,7 @@ class MacroAssembler : public MacroAssemblerSpecific
return size();
}
//{{{ check_macroassembler_style
public:
// ===============================================================
// Frame manipulation functions.
@@ -309,20 +417,20 @@ class MacroAssembler : public MacroAssemblerSpecific
// ===============================================================
// Stack manipulation functions.
void PushRegsInMask(LiveRegisterSet set) PER_ARCH;
void PushRegsInMask(LiveRegisterSet set) PER_SHARED_ARCH;
void PushRegsInMask(LiveGeneralRegisterSet set);
void PopRegsInMask(LiveRegisterSet set);
void PopRegsInMask(LiveGeneralRegisterSet set);
void PopRegsInMaskIgnore(LiveRegisterSet set, LiveRegisterSet ignore) PER_ARCH;
void PopRegsInMaskIgnore(LiveRegisterSet set, LiveRegisterSet ignore) PER_SHARED_ARCH;
void Push(const Operand op) PER_ARCH ONLY_X86_X64;
void Push(Register reg) PER_ARCH;
void Push(const Imm32 imm) PER_ARCH;
void Push(const ImmWord imm) PER_ARCH;
void Push(const ImmPtr imm) PER_ARCH;
void Push(const ImmGCPtr ptr) PER_ARCH;
void Push(FloatRegister reg) PER_ARCH;
void Push(const Operand op) DEFINED_ON(x86_shared);
void Push(Register reg) PER_SHARED_ARCH;
void Push(const Imm32 imm) PER_SHARED_ARCH;
void Push(const ImmWord imm) PER_SHARED_ARCH;
void Push(const ImmPtr imm) PER_SHARED_ARCH;
void Push(const ImmGCPtr ptr) PER_SHARED_ARCH;
void Push(FloatRegister reg) PER_SHARED_ARCH;
void Push(jsid id, Register scratchReg);
void Push(TypedOrValueRegister v);
void Push(ConstantOrRegister v);
@@ -334,10 +442,10 @@ class MacroAssembler : public MacroAssemblerSpecific
inline CodeOffsetLabel PushWithPatch(ImmWord word);
inline CodeOffsetLabel PushWithPatch(ImmPtr imm);
void Pop(const Operand op) PER_ARCH ONLY_X86_X64;
void Pop(Register reg) PER_ARCH;
void Pop(FloatRegister t) PER_ARCH ONLY_X86_X64;
void Pop(const ValueOperand& val) PER_ARCH;
void Pop(const Operand op) DEFINED_ON(x86_shared);
void Pop(Register reg) PER_SHARED_ARCH;
void Pop(FloatRegister t) DEFINED_ON(x86_shared);
void Pop(const ValueOperand& val) PER_SHARED_ARCH;
void popRooted(VMFunction::RootType rootType, Register cellReg, const ValueOperand& valueReg);
// Move the stack pointer based on the requested amount.
@@ -352,19 +460,20 @@ class MacroAssembler : public MacroAssemblerSpecific
// ===============================================================
// Simple call functions.
void call(Register reg) PER_ARCH;
void call(const Address& addr) PER_ARCH ONLY_X86_X64;
void call(Label* label) PER_ARCH;
void call(ImmWord imm) PER_ARCH;
void call(Register reg) PER_SHARED_ARCH;
void call(const Address& addr) DEFINED_ON(x86_shared);
void call(Label* label) PER_SHARED_ARCH;
void call(ImmWord imm) PER_SHARED_ARCH;
// Call a target native function, which is neither traceable nor movable.
void call(ImmPtr imm) PER_ARCH;
void call(AsmJSImmPtr imm) PER_ARCH;
void call(ImmPtr imm) PER_SHARED_ARCH;
void call(AsmJSImmPtr imm) PER_SHARED_ARCH;
// Call a target JitCode, which must be traceable, and may be movable.
void call(JitCode* c) PER_ARCH;
void call(JitCode* c) PER_SHARED_ARCH;
inline void call(const CallSiteDesc& desc, const Register reg);
inline void call(const CallSiteDesc& desc, Label* label);
//}}} check_macroassembler_style
public:
// Emits a test of a value against all types in a TypeSet. A scratch
+3
View File
@@ -5182,6 +5182,7 @@ MacroAssemblerARMCompat::asMasm() const
return *static_cast<const MacroAssembler*>(this);
}
//{{{ check_macroassembler_style
// ===============================================================
// Stack manipulation functions.
@@ -5372,3 +5373,5 @@ MacroAssembler::call(JitCode* c)
ma_movPatchable(ImmPtr(c->raw()), ScratchRegister, Always, rs);
ma_callJitHalfPush(ScratchRegister);
}
//}}} check_macroassembler_style
+13 -10
View File
@@ -552,18 +552,10 @@ MacroAssemblerCompat::breakpoint()
Brk((code++) & 0xffff);
}
//{{{ check_macroassembler_style
// ===============================================================
// Stack manipulation functions.
void
MacroAssembler::reserveStack(uint32_t amount)
{
// TODO: This bumps |sp| every time we reserve using a second register.
// It would save some instructions if we had a fixed frame size.
vixl::MacroAssembler::Claim(Operand(amount));
adjustFrame(amount);
}
void
MacroAssembler::PushRegsInMask(LiveRegisterSet set)
{
@@ -688,7 +680,7 @@ MacroAssembler::Push(FloatRegister f)
}
void
MacroAssembler::Pop(const Register reg)
MacroAssembler::Pop(Register reg)
{
pop(reg);
adjustFrame(-1 * int64_t(sizeof(int64_t)));
@@ -701,6 +693,15 @@ MacroAssembler::Pop(const ValueOperand& val)
adjustFrame(-1 * int64_t(sizeof(int64_t)));
}
void
MacroAssembler::reserveStack(uint32_t amount)
{
// TODO: This bumps |sp| every time we reserve using a second register.
// It would save some instructions if we had a fixed frame size.
vixl::MacroAssembler::Claim(Operand(amount));
adjustFrame(amount);
}
// ===============================================================
// Simple call functions.
@@ -753,5 +754,7 @@ MacroAssembler::call(JitCode* c)
blr(scratch64);
}
//}}} check_macroassembler_style
} // namespace jit
} // namespace js
@@ -3651,6 +3651,7 @@ MacroAssemblerMIPSCompat::asMasm() const
return *static_cast<const MacroAssembler*>(this);
}
//{{{ check_macroassembler_style
// ===============================================================
// Stack manipulation functions.
@@ -3822,3 +3823,5 @@ MacroAssembler::call(JitCode* c)
ma_liPatchable(ScratchRegister, Imm32((uint32_t)c->raw()));
ma_callJitHalfPush(ScratchRegister);
}
//}}} check_macroassembler_style
-23
View File
@@ -53,26 +53,3 @@ bool ICCompare_Double::Compiler::generateStubCode(MacroAssembler&) { MOZ_CRASH()
bool ICBinaryArith_Int32::Compiler::generateStubCode(MacroAssembler&) { MOZ_CRASH(); }
bool ICUnaryArith_Int32::Compiler::generateStubCode(MacroAssembler&) { MOZ_CRASH(); }
JitCode* JitRuntime::generateProfilerExitFrameTailStub(JSContext*) { MOZ_CRASH(); }
void MacroAssembler::alignFrameForICArguments(AfterICSaveLive& aic) { MOZ_CRASH(); }
void MacroAssembler::restoreFrameAlignmentForICArguments(AfterICSaveLive& aic) { MOZ_CRASH(); }
void MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output) { MOZ_CRASH(); }
// ===============================================================
// Stack manipulation functions.
void MacroAssembler::PushRegsInMask(LiveRegisterSet) { MOZ_CRASH(); }
void MacroAssembler::PopRegsInMaskIgnore(LiveRegisterSet, LiveRegisterSet) { MOZ_CRASH(); }
void MacroAssembler::Push(Register reg) { MOZ_CRASH(); }
void MacroAssembler::Push(const Imm32 imm) { MOZ_CRASH(); }
void MacroAssembler::Push(const ImmWord imm) { MOZ_CRASH(); }
void MacroAssembler::Push(const ImmPtr imm) { MOZ_CRASH(); }
void MacroAssembler::Push(const ImmGCPtr ptr) { MOZ_CRASH(); }
void MacroAssembler::Push(FloatRegister reg) { MOZ_CRASH(); }
void MacroAssembler::Pop(Register reg) { MOZ_CRASH(); }
void MacroAssembler::Pop(const ValueOperand& val) { MOZ_CRASH(); }
void MacroAssembler::reserveStack(uint32_t amount) { MOZ_CRASH(); }
+3
View File
@@ -584,6 +584,7 @@ MacroAssemblerX64::asMasm() const
return *static_cast<const MacroAssembler*>(this);
}
//{{{ check_macroassembler_style
// ===============================================================
// Stack manipulation functions.
@@ -606,3 +607,5 @@ MacroAssembler::reserveStack(uint32_t amount)
}
framePushed_ += amount;
}
//}}} check_macroassembler_style
@@ -195,6 +195,7 @@ MacroAssemblerX86Shared::asMasm() const
return *static_cast<const MacroAssembler*>(this);
}
//{{{ check_macroassembler_style
// ===============================================================
// Stack manipulation functions.
@@ -415,3 +416,5 @@ MacroAssembler::call(JitCode* target)
{
Assembler::call(target);
}
//}}} check_macroassembler_style
+3
View File
@@ -565,6 +565,7 @@ MacroAssemblerX86::asMasm() const
return *static_cast<const MacroAssembler*>(this);
}
//{{{ check_macroassembler_style
// ===============================================================
// Stack manipulation functions.
@@ -587,3 +588,5 @@ MacroAssembler::reserveStack(uint32_t amount)
}
framePushed_ += amount;
}
//}}} check_macroassembler_style
+36 -3
View File
@@ -7086,9 +7086,33 @@ JS::AbortIncrementalGC(JSRuntime* rt)
}
char16_t*
JS::GCDescription::formatMessage(JSRuntime* rt) const
JS::GCDescription::formatSliceMessage(JSRuntime* rt) const
{
return rt->gc.stats.formatMessage();
UniqueChars cstr = rt->gc.stats.formatCompactSliceMessage();
size_t nchars = strlen(cstr.get());
UniquePtr<char16_t, JS::FreePolicy> out(js_pod_malloc<char16_t>(nchars + 1));
if (!out)
return nullptr;
out.get()[nchars] = 0;
CopyAndInflateChars(out.get(), cstr.get(), nchars);
return out.release();
}
char16_t*
JS::GCDescription::formatSummaryMessage(JSRuntime* rt) const
{
UniqueChars cstr = rt->gc.stats.formatCompactSummaryMessage();
size_t nchars = strlen(cstr.get());
UniquePtr<char16_t, JS::FreePolicy> out(js_pod_malloc<char16_t>(nchars + 1));
if (!out)
return nullptr;
out.get()[nchars] = 0;
CopyAndInflateChars(out.get(), cstr.get(), nchars);
return out.release();
}
JS::dbg::GarbageCollectionEvent::Ptr
@@ -7100,7 +7124,16 @@ JS::GCDescription::toGCEvent(JSRuntime* rt) const
char16_t*
JS::GCDescription::formatJSON(JSRuntime* rt, uint64_t timestamp) const
{
return rt->gc.stats.formatJSON(timestamp);
UniqueChars cstr = rt->gc.stats.formatJsonMessage(timestamp);
size_t nchars = strlen(cstr.get());
UniquePtr<char16_t, JS::FreePolicy> out(js_pod_malloc<char16_t>(nchars + 1));
if (!out)
return nullptr;
out.get()[nchars] = 0;
CopyAndInflateChars(out.get(), cstr.get(), nchars);
return out.release();
}
JS_PUBLIC_API(JS::GCSliceCallback)
-1
View File
@@ -7,7 +7,6 @@
XPIDL_SOURCES += [
'mozIJSSubScriptLoader.idl',
'nsIAddonInterposition.idl',
'nsIJSRuntimeService.idl',
'nsIRemoteTagService.idl',
'nsIScriptError.idl',
'nsIXPConnect.idl',
-46
View File
@@ -1,46 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/. */
#include "nsISupports.idl"
[ptr] native JSRuntime(JSRuntime);
[ptr] native JSContext(JSContext);
native xpcGCCallback(xpcGCCallback);
native xpcContextCallback(xpcContextCallback);
%{C++
#include "jsapi.h" // for JSGCStatus
typedef void
(* xpcGCCallback)(JSGCStatus status);
typedef bool
(* xpcContextCallback)(JSContext* cx, unsigned operation);
%}
interface nsIBackstagePass;
[uuid( 2ac111f2-e492-488e-85df-353c453e98f3)]
interface nsIJSRuntimeService : nsISupports
{
readonly attribute JSRuntime runtime;
/**
* Register additional GC callback which will run after the
* standard XPConnect callback.
*/
[noscript, notxpcom] void registerGCCallback(in xpcGCCallback func);
[noscript, notxpcom] void unregisterGCCallback(in xpcGCCallback func);
/**
* Register additional context callback which will run after the
* standard XPConnect callback.
*/
[noscript, notxpcom] void registerContextCallback(in xpcContextCallback func);
[noscript, notxpcom] void unregisterContextCallback(in xpcContextCallback func);
};
+18 -24
View File
@@ -208,13 +208,6 @@ XPCJSRuntime::CustomContextCallback(JSContext* cx, unsigned operation)
delete XPCContext::GetXPCContext(cx);
}
nsTArray<xpcContextCallback> callbacks(extraContextCallbacks);
for (uint32_t i = 0; i < callbacks.Length(); ++i) {
if (!callbacks[i](cx, operation)) {
return false;
}
}
return true;
}
@@ -1758,6 +1751,24 @@ xpc::GetCurrentCompartmentName(JSContext* cx, nsCString& name)
GetCompartmentName(compartment, name, &anonymizeID, false);
}
JSRuntime*
xpc::GetJSRuntime()
{
return XPCJSRuntime::Get()->Runtime();
}
void
xpc::AddGCCallback(xpcGCCallback cb)
{
XPCJSRuntime::Get()->AddGCCallback(cb);
}
void
xpc::RemoveGCCallback(xpcGCCallback cb)
{
XPCJSRuntime::Get()->RemoveGCCallback(cb);
}
static int64_t
JSMainRuntimeGCHeapDistinguishedAmount()
{
@@ -3675,23 +3686,6 @@ XPCJSRuntime::RemoveGCCallback(xpcGCCallback cb)
}
}
void
XPCJSRuntime::AddContextCallback(xpcContextCallback cb)
{
MOZ_ASSERT(cb, "null callback");
extraContextCallbacks.AppendElement(cb);
}
void
XPCJSRuntime::RemoveContextCallback(xpcContextCallback cb)
{
MOZ_ASSERT(cb, "null callback");
bool found = extraContextCallbacks.RemoveElement(cb);
if (!found) {
NS_ERROR("Removing a callback which was never added.");
}
}
void
XPCJSRuntime::InitSingletonScopes()
{
-1
View File
@@ -46,7 +46,6 @@ NS_DEFINE_NAMED_CID(MOZ_JSSUBSCRIPTLOADER_CID);
{ XPC_ID_CONTRACTID, &kNS_JS_ID_CID }, \
{ XPC_XPCONNECT_CONTRACTID, &kNS_XPCONNECT_CID }, \
{ XPC_CONTEXT_STACK_CONTRACTID, &kNS_XPCONNECT_CID }, \
{ XPC_RUNTIME_CONTRACTID, &kNS_XPCONNECT_CID }, \
{ NS_SCRIPTERROR_CONTRACTID, &kNS_SCRIPTERROR_CID }, \
{ MOZJSCOMPONENTLOADER_CONTRACTID, &kMOZJSCOMPONENTLOADER_CID }, \
{ MOZJSSUBSCRIPTLOADER_CONTRACTID, &kMOZ_JSSUBSCRIPTLOADER_CID },
+3 -10
View File
@@ -22,7 +22,6 @@
#include "nsArrayEnumerator.h"
#include "nsCOMArray.h"
#include "nsDirectoryServiceUtils.h"
#include "nsIJSRuntimeService.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsJSPrincipals.h"
@@ -1359,15 +1358,9 @@ XRE_XPCShellMain(int argc, char** argv, char** envp)
return 1;
}
nsCOMPtr<nsIJSRuntimeService> rtsvc = do_GetService("@mozilla.org/js/xpc/RuntimeService;1");
// get the JSRuntime from the runtime svc
if (!rtsvc) {
printf("failed to get nsJSRuntimeService!\n");
return 1;
}
if (NS_FAILED(rtsvc->GetRuntime(&rt)) || !rt) {
printf("failed to get JSRuntime from nsJSRuntimeService!\n");
rt = xpc::GetJSRuntime();
if (!rt) {
printf("failed to get JSRuntime from XPConnect!\n");
return 1;
}
+1 -44
View File
@@ -40,8 +40,7 @@ using namespace JS;
NS_IMPL_ISUPPORTS(nsXPConnect,
nsIXPConnect,
nsISupportsWeakReference,
nsIThreadObserver,
nsIJSRuntimeService)
nsIThreadObserver)
nsXPConnect* nsXPConnect::gSelf = nullptr;
bool nsXPConnect::gOnceAliveNowDead = false;
@@ -53,7 +52,6 @@ nsIScriptSecurityManager* nsXPConnect::gScriptSecurityManager = nullptr;
nsIPrincipal* nsXPConnect::gSystemPrincipal = nullptr;
const char XPC_CONTEXT_STACK_CONTRACTID[] = "@mozilla.org/js/xpc/ContextStack;1";
const char XPC_RUNTIME_CONTRACTID[] = "@mozilla.org/js/xpc/RuntimeService;1";
const char XPC_EXCEPTION_CONTRACTID[] = "@mozilla.org/js/xpc/Exception;1";
const char XPC_CONSOLE_CONTRACTID[] = "@mozilla.org/consoleservice;1";
const char XPC_SCRIPT_ERROR_CONTRACTID[] = "@mozilla.org/scripterror;1";
@@ -1022,47 +1020,6 @@ nsXPConnect::SetReportAllJSExceptions(bool newval)
return NS_OK;
}
/* attribute JSRuntime runtime; */
NS_IMETHODIMP
nsXPConnect::GetRuntime(JSRuntime** runtime)
{
if (!runtime)
return NS_ERROR_NULL_POINTER;
JSRuntime* rt = GetRuntime()->Runtime();
JS_AbortIfWrongThread(rt);
*runtime = rt;
return NS_OK;
}
/* [noscript, notxpcom] void registerGCCallback(in xpcGCCallback func); */
NS_IMETHODIMP_(void)
nsXPConnect::RegisterGCCallback(xpcGCCallback func)
{
mRuntime->AddGCCallback(func);
}
/* [noscript, notxpcom] void unregisterGCCallback(in xpcGCCallback func); */
NS_IMETHODIMP_(void)
nsXPConnect::UnregisterGCCallback(xpcGCCallback func)
{
mRuntime->RemoveGCCallback(func);
}
/* [noscript, notxpcom] void registerContextCallback(in xpcContextCallback func); */
NS_IMETHODIMP_(void)
nsXPConnect::RegisterContextCallback(xpcContextCallback func)
{
mRuntime->AddContextCallback(func);
}
/* [noscript, notxpcom] void unregisterContextCallback(in xpcContextCallback func); */
NS_IMETHODIMP_(void)
nsXPConnect::UnregisterContextCallback(xpcContextCallback func)
{
mRuntime->RemoveContextCallback(func);
}
/* virtual */
JSContext*
nsXPConnect::GetCurrentJSContext()
+1 -8
View File
@@ -112,7 +112,6 @@
#include "nsIXPConnect.h"
#include "nsIInterfaceInfo.h"
#include "nsIXPCScriptable.h"
#include "nsIJSRuntimeService.h"
#include "nsIObserver.h"
#include "nsWeakReference.h"
#include "nsCOMPtr.h"
@@ -192,7 +191,6 @@
/***************************************************************************/
// data declarations...
extern const char XPC_CONTEXT_STACK_CONTRACTID[];
extern const char XPC_RUNTIME_CONTRACTID[];
extern const char XPC_EXCEPTION_CONTRACTID[];
extern const char XPC_CONSOLE_CONTRACTID[];
extern const char XPC_SCRIPT_ERROR_CONTRACTID[];
@@ -251,15 +249,13 @@ static inline bool IS_WN_REFLECTOR(JSObject* obj)
class nsXPConnect final : public nsIXPConnect,
public nsIThreadObserver,
public nsSupportsWeakReference,
public nsIJSRuntimeService
public nsSupportsWeakReference
{
public:
// all the interface method declarations...
NS_DECL_ISUPPORTS
NS_DECL_NSIXPCONNECT
NS_DECL_NSITHREADOBSERVER
NS_DECL_NSIJSRUNTIMESERVICE
// non-interface implementation
public:
@@ -608,8 +604,6 @@ public:
void AddGCCallback(xpcGCCallback cb);
void RemoveGCCallback(xpcGCCallback cb);
void AddContextCallback(xpcContextCallback cb);
void RemoveContextCallback(xpcContextCallback cb);
struct EnvironmentPreparer : public js::ScriptEnvironmentPreparer {
bool invoke(JS::HandleObject scope, Closure& closure) override;
@@ -673,7 +667,6 @@ private:
XPCRootSetElem* mWrappedJSRoots;
XPCRootSetElem* mObjectHolderRoots;
nsTArray<xpcGCCallback> extraGCCallbacks;
nsTArray<xpcContextCallback> extraContextCallbacks;
nsRefPtr<WatchdogManager> mWatchdogManager;
JS::GCSliceCallback mPrevGCSliceCallback;
JS::PersistentRootedObject mUnprivilegedJunkScope;
+8
View File
@@ -30,6 +30,8 @@ class nsIPrincipal;
class nsScriptNameSpaceManager;
class nsIMemoryReporterCallback;
typedef void (* xpcGCCallback)(JSGCStatus status);
namespace xpc {
class Scriptability {
@@ -540,6 +542,12 @@ DispatchScriptErrorEvent(nsPIDOMWindow* win, JSRuntime* rt, xpc::ErrorReport* xp
extern void
GetCurrentCompartmentName(JSContext*, nsCString& name);
JSRuntime*
GetJSRuntime();
void AddGCCallback(xpcGCCallback cb);
void RemoveGCCallback(xpcGCCallback cb);
} // namespace xpc
namespace mozilla {
+1 -1
View File
@@ -2,7 +2,7 @@
# 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 __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
import mozpack.path as mozpath
import os
+2 -3
View File
@@ -143,10 +143,9 @@
'conditions' : [
## Mac and BSDs
[ 'OS == "mac"', {
[ 'OS == "mac" or OS == "ios"', {
'defines' : [
'DARWIN',
'HAVE_XLOCALE',
],
}],
[ 'os_bsd == 1', {
@@ -154,7 +153,7 @@
'BSD',
],
}],
[ 'OS == "mac" or os_bsd == 1', {
[ 'OS == "mac" or OS == "ios" or os_bsd == 1', {
'cflags_mozilla': [
'-Wall',
'-Wno-parentheses',
+1 -1
View File
@@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <locale.h>
#include <stdlib.h>
#include <wchar.h>
#ifdef DARWIN
#if defined(DARWIN)
#define HAVE_XLOCALE
#endif
+1 -1
View File
@@ -153,7 +153,7 @@
'BSD',
],
}],
[ 'OS == "mac" or os_bsd == 1', {
[ 'OS == "mac" or OS == "ios" or os_bsd == 1', {
'cflags_mozilla': [
'-Wall',
'-Wno-parentheses',
+1 -1
View File
@@ -310,7 +310,7 @@
'cflags_mozilla': [
],
}],
['OS=="mac"', {
['OS=="mac" or OS=="ios"', {
'include_dirs': [
],
'defines': [
@@ -322,6 +322,8 @@ struct JsepVideoCodecDescription : public JsepCodecDescription {
mDefaultPt, SdpRtcpFbAttributeList::kNack, SdpRtcpFbAttributeList::pli);
rtcpfb.PushEntry(
mDefaultPt, SdpRtcpFbAttributeList::kCcm, SdpRtcpFbAttributeList::fir);
rtcpfb.PushEntry(
mDefaultPt, SdpRtcpFbAttributeList::kCcm, SdpRtcpFbAttributeList::tmmbr);
}
SdpFmtpAttributeList::H264Parameters
@@ -36,7 +36,8 @@ kMediaConduitPlayoutError, // Runtime playout error
kMediaConduitMTUError, // Can't set MTU
kMediaConduitRTCPStatusError, // Can't set RTCP mode
kMediaConduitKeyFrameRequestError, // Can't set KeyFrameRequest mode
kMediaConduitNACKStatusError // Can't set NACK mode
kMediaConduitNACKStatusError, // Can't set NACK mode
kMediaConduitTMMBRStatusError // Can't set TMMBR mode
};
}
@@ -267,7 +267,8 @@ public:
};
VideoSessionConduit() : mFrameRequestMethod(FrameRequestNone),
mUsingNackBasic(false) {}
mUsingNackBasic(false),
mUsingTmmbr(false) {}
virtual ~VideoSessionConduit() {}
@@ -362,10 +363,14 @@ public:
return mUsingNackBasic;
}
bool UsingTmmbr() const {
return mUsingTmmbr;
}
protected:
/* RTCP feedback settings, for unit testing purposes */
FrameRequestType mFrameRequestMethod;
bool mUsingNackBasic;
bool mUsingTmmbr;
};
/**
@@ -698,6 +698,7 @@ WebrtcVideoConduit::ConfigureRecvMediaCodecs(
webrtc::ViEKeyFrameRequestMethod kf_request = webrtc::kViEKeyFrameRequestNone;
bool use_nack_basic = false;
bool use_tmmbr = false;
//Try Applying the codecs in the list
// we treat as success if atleast one codec was applied and reception was
@@ -727,6 +728,11 @@ WebrtcVideoConduit::ConfigureRecvMediaCodecs(
use_nack_basic = true;
}
// Check whether TMMBR is requested
if (codecConfigList[i]->RtcpFbCcmIsSet("tmmbr")) {
use_tmmbr = true;
}
webrtc::VideoCodec video_codec;
memset(&video_codec, 0, sizeof(webrtc::VideoCodec));
@@ -858,6 +864,16 @@ WebrtcVideoConduit::ConfigureRecvMediaCodecs(
}
mUsingNackBasic = use_nack_basic;
if (use_tmmbr) {
CSFLogDebug(logTag, "Enabling TMMBR for video stream");
if (mPtrRTP->SetTMMBRStatus(mChannel, true) != 0) {
CSFLogError(logTag, "%s SetTMMBRStatus Failed %d ", __FUNCTION__,
mPtrViEBase->LastError());
return kMediaConduitTMMBRStatusError;
}
}
mUsingTmmbr = use_tmmbr;
condError = StartReceiving();
if (condError != kMediaConduitNoError) {
return condError;
@@ -941,7 +941,7 @@ WebrtcOMXH264VideoEncoder::Encode(const webrtc::I420VideoFrame& aInputImage,
nsresult rv = mOMX->ConfigureDirect(format,
OMXVideoEncoder::BlobFormat::AVC_NAL);
if (NS_WARN_IF(NS_FAILED(rv))) {
CODEC_LOGE("WebrtcOMXH264VideoEncoder:%p FAILED configuring encoder %d", this, rv);
CODEC_LOGE("WebrtcOMXH264VideoEncoder:%p FAILED configuring encoder %d", this, int(rv));
return WEBRTC_VIDEO_CODEC_ERROR;
}
mOMXConfigured = true;
@@ -11,6 +11,9 @@
#include "cpr_win_types.h"
#elif defined SIP_OS_OSX
#include "cpr_darwin_types.h"
#else
//lol
//#error "Unsupported platform"
#endif
#ifdef __cplusplus
+2 -1
View File
@@ -4,7 +4,8 @@
# 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/.
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
# TODO: bug 1172551 - get these tests working on iOS
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'uikit':
GeckoCppUnitTests([
'jsep_session_unittest',
'mediaconduit_unittests',
@@ -903,6 +903,7 @@ class SignalingAgent {
mBundleEnabled(true),
mExpectedFrameRequestType(VideoSessionConduit::FrameRequestPli),
mExpectNack(true),
mExpectTmmbr(true),
mExpectRtcpMuxAudio(true),
mExpectRtcpMuxVideo(true),
mRemoteDescriptionSet(false) {
@@ -1195,6 +1196,7 @@ class SignalingAgent {
mozilla::VideoSessionConduit *video_conduit =
static_cast<mozilla::VideoSessionConduit*>(conduit);
ASSERT_EQ(mExpectNack, video_conduit->UsingNackBasic());
ASSERT_EQ(mExpectTmmbr, video_conduit->UsingTmmbr());
ASSERT_EQ(mExpectedFrameRequestType,
video_conduit->FrameRequestMethod());
ASSERT_EQ(mExpectRtcpMuxVideo, pipeline->IsDoingRtcpMux())
@@ -1543,6 +1545,7 @@ public:
bool mBundleEnabled;
VideoSessionConduit::FrameRequestType mExpectedFrameRequestType;
bool mExpectNack;
bool mExpectTmmbr;
bool mExpectRtcpMuxAudio;
bool mExpectRtcpMuxVideo;
bool mRemoteDescriptionSet;
@@ -1984,6 +1987,7 @@ public:
void TestRtcpFbAnswer(const std::set<std::string>& feedback,
bool expectNack,
bool expectTmmbr,
VideoSessionConduit::FrameRequestType frameRequestType) {
EnsureInit();
OfferOptions options;
@@ -2002,6 +2006,7 @@ public:
a1_->SetExpectedFrameRequestType(frameRequestType);
a1_->mExpectNack = expectNack;
a1_->mExpectTmmbr = expectTmmbr;
WaitForCompleted();
CheckPipelines();
@@ -2012,6 +2017,7 @@ public:
void TestRtcpFbOffer(
const std::set<std::string>& feedback,
bool expectNack,
bool expectTmmbr,
VideoSessionConduit::FrameRequestType frameRequestType) {
EnsureInit();
OfferOptions options;
@@ -2024,6 +2030,7 @@ public:
a2_->SetRemote(TestObserver::OFFER, modifiedOffer);
a2_->SetExpectedFrameRequestType(frameRequestType);
a2_->mExpectNack = expectNack;
a2_->mExpectTmmbr = expectTmmbr;
a2_->CreateAnswer(OFFER_AV | ANSWER_AV);
@@ -3381,23 +3388,25 @@ TEST_P(SignalingTest, RtcpFbInOffer)
EnsureInit();
OfferOptions options;
a1_->CreateOffer(options, OFFER_AV);
const char *expected[] = { "nack", "nack pli", "ccm fir" };
const char *expected[] = { "nack", "nack pli", "ccm fir", "ccm tmmbr" };
CheckRtcpFbSdp(a1_->offer(), ARRAY_TO_SET(std::string, expected));
}
TEST_P(SignalingTest, RtcpFbOfferAll)
{
const char *feedbackTypes[] = { "nack", "nack pli", "ccm fir" };
const char *feedbackTypes[] = { "nack", "nack pli", "ccm fir", "ccm tmmbr" };
TestRtcpFbOffer(ARRAY_TO_SET(std::string, feedbackTypes),
true,
true,
VideoSessionConduit::FrameRequestPli);
}
TEST_P(SignalingTest, RtcpFbOfferNoNackBasic)
{
const char *feedbackTypes[] = { "nack pli", "ccm fir" };
const char *feedbackTypes[] = { "nack pli", "ccm fir", "ccm tmmbr" };
TestRtcpFbOffer(ARRAY_TO_SET(std::string, feedbackTypes),
false,
true,
VideoSessionConduit::FrameRequestPli);
}
@@ -3406,6 +3415,7 @@ TEST_P(SignalingTest, RtcpFbOfferNoNackPli)
const char *feedbackTypes[] = { "nack", "ccm fir" };
TestRtcpFbOffer(ARRAY_TO_SET(std::string, feedbackTypes),
true,
false,
VideoSessionConduit::FrameRequestFir);
}
@@ -3414,6 +3424,7 @@ TEST_P(SignalingTest, RtcpFbOfferNoCcmFir)
const char *feedbackTypes[] = { "nack", "nack pli" };
TestRtcpFbOffer(ARRAY_TO_SET(std::string, feedbackTypes),
true,
false,
VideoSessionConduit::FrameRequestPli);
}
@@ -3421,6 +3432,7 @@ TEST_P(SignalingTest, RtcpFbOfferNoNack)
{
const char *feedbackTypes[] = { "ccm fir" };
TestRtcpFbOffer(ARRAY_TO_SET(std::string, feedbackTypes),
false,
false,
VideoSessionConduit::FrameRequestFir);
}
@@ -3430,6 +3442,7 @@ TEST_P(SignalingTest, RtcpFbOfferNoFrameRequest)
const char *feedbackTypes[] = { "nack" };
TestRtcpFbOffer(ARRAY_TO_SET(std::string, feedbackTypes),
true,
false,
VideoSessionConduit::FrameRequestNone);
}
@@ -3437,6 +3450,7 @@ TEST_P(SignalingTest, RtcpFbOfferPliOnly)
{
const char *feedbackTypes[] = { "nack pli" };
TestRtcpFbOffer(ARRAY_TO_SET(std::string, feedbackTypes),
false,
false,
VideoSessionConduit::FrameRequestPli);
}
@@ -3445,6 +3459,7 @@ TEST_P(SignalingTest, RtcpFbOfferNoFeedback)
{
const char *feedbackTypes[] = { };
TestRtcpFbOffer(ARRAY_TO_SET(std::string, feedbackTypes),
false,
false,
VideoSessionConduit::FrameRequestNone);
}
@@ -3454,6 +3469,7 @@ TEST_P(SignalingTest, RtcpFbAnswerAll)
const char *feedbackTypes[] = { "nack", "nack pli", "ccm fir" };
TestRtcpFbAnswer(ARRAY_TO_SET(std::string, feedbackTypes),
true,
false,
VideoSessionConduit::FrameRequestPli);
}
@@ -3461,6 +3477,7 @@ TEST_P(SignalingTest, RtcpFbAnswerNoNackBasic)
{
const char *feedbackTypes[] = { "nack pli", "ccm fir" };
TestRtcpFbAnswer(ARRAY_TO_SET(std::string, feedbackTypes),
false,
false,
VideoSessionConduit::FrameRequestPli);
}
@@ -3470,6 +3487,7 @@ TEST_P(SignalingTest, RtcpFbAnswerNoNackPli)
const char *feedbackTypes[] = { "nack", "ccm fir" };
TestRtcpFbAnswer(ARRAY_TO_SET(std::string, feedbackTypes),
true,
false,
VideoSessionConduit::FrameRequestFir);
}
@@ -3478,6 +3496,7 @@ TEST_P(SignalingTest, RtcpFbAnswerNoCcmFir)
const char *feedbackTypes[] = { "nack", "nack pli" };
TestRtcpFbAnswer(ARRAY_TO_SET(std::string, feedbackTypes),
true,
false,
VideoSessionConduit::FrameRequestPli);
}
@@ -3485,6 +3504,7 @@ TEST_P(SignalingTest, RtcpFbAnswerNoNack)
{
const char *feedbackTypes[] = { "ccm fir" };
TestRtcpFbAnswer(ARRAY_TO_SET(std::string, feedbackTypes),
false,
false,
VideoSessionConduit::FrameRequestFir);
}
@@ -3494,6 +3514,7 @@ TEST_P(SignalingTest, RtcpFbAnswerNoFrameRequest)
const char *feedbackTypes[] = { "nack" };
TestRtcpFbAnswer(ARRAY_TO_SET(std::string, feedbackTypes),
true,
false,
VideoSessionConduit::FrameRequestNone);
}
@@ -3501,7 +3522,8 @@ TEST_P(SignalingTest, RtcpFbAnswerPliOnly)
{
const char *feedbackTypes[] = { "nack pli" };
TestRtcpFbAnswer(ARRAY_TO_SET(std::string, feedbackTypes),
0,
false,
false,
VideoSessionConduit::FrameRequestPli);
}
@@ -3509,7 +3531,8 @@ TEST_P(SignalingTest, RtcpFbAnswerNoFeedback)
{
const char *feedbackTypes[] = { };
TestRtcpFbAnswer(ARRAY_TO_SET(std::string, feedbackTypes),
0,
false,
false,
VideoSessionConduit::FrameRequestNone);
}
@@ -4362,6 +4385,12 @@ TEST_P(SignalingTest, UseNonPrefferedPayloadTypeOnAnswer)
strlen("\r\na=rtcp-fb:121 ccm fir"),
"\r\na=rtcp-fb:121 ccm fir");
match = answer.find("\r\na=rtcp-fb:120 ccm tmmbr");
ASSERT_NE(std::string::npos, match);
answer.replace(match,
strlen("\r\na=rtcp-fb:121 ccm tmmbr"),
"\r\na=rtcp-fb:121 ccm tmmbr");
std::cout << "Modified SDP " << std::endl
<< indent(answer) << std::endl;
+5 -9
View File
@@ -377,8 +377,8 @@ pref("media.webrtc.debug.aec_dump_max_size", 4194304); // 4MB
#ifdef MOZ_WIDGET_GONK
pref("media.navigator.video.default_width",320);
pref("media.navigator.video.default_height",240);
pref("media.peerconnection.enabled", false);
pref("media.peerconnection.video.enabled", false);
pref("media.peerconnection.enabled", true);
pref("media.peerconnection.video.enabled", true);
pref("media.navigator.video.max_fs", 1200); // 640x480 == 1200mb
pref("media.navigator.video.max_fr", 30);
pref("media.navigator.video.h264.level", 12); // 0x42E00C - level 1.2
@@ -394,8 +394,8 @@ pref("media.peerconnection.video.max_bitrate", 1000);
#else
pref("media.navigator.video.default_width",0); // adaptive default
pref("media.navigator.video.default_height",0); // adaptive default
pref("media.peerconnection.enabled", false);
pref("media.peerconnection.video.enabled", false);
pref("media.peerconnection.enabled", true);
pref("media.peerconnection.video.enabled", true);
pref("media.navigator.video.max_fs", 12288); // Enough for 2048x1536
pref("media.navigator.video.max_fr", 60);
pref("media.navigator.video.h264.level", 31); // 0x42E01f - level 3.1
@@ -414,11 +414,7 @@ pref("media.navigator.permission.disabled", false);
pref("media.peerconnection.default_iceservers", "[{\"urls\": [\"stun:stun.services.mozilla.com\"]}]");
pref("media.peerconnection.ice.loopback", false); // Set only for testing in offline environments.
pref("media.peerconnection.use_document_iceservers", true);
// Do not enable identity before ensuring that the UX cannot be spoofed
// see Bug 884573 for details
// Do not enable identity before fixing domain comparison: see Bug 958741
// Do not enable identity before fixing origin spoofing: see Bug 968335
pref("media.peerconnection.identity.enabled", false);
pref("media.peerconnection.identity.enabled", true);
pref("media.peerconnection.identity.timeout", 10000);
pref("media.peerconnection.ice.loopback", false); // Set only for testing in offline environments.
// These values (aec, agc, and noice) are from media/webrtc/trunk/webrtc/common_types.h
+1 -1
View File
@@ -2,7 +2,7 @@
# 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 __future__ import print_function, unicode_literals
from __future__ import absolute_import, print_function, unicode_literals
import argparse
import glob
+1 -1
View File
@@ -2,7 +2,7 @@
# 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 __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
from mach.decorators import (
CommandArgument,
@@ -2,7 +2,7 @@
# 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 __future__ import print_function, unicode_literals
from __future__ import absolute_import, print_function, unicode_literals
import argparse
import os
@@ -4,6 +4,8 @@
# This modules provides functionality for dealing with code completion.
from __future__ import absolute_import
import os
from mach.decorators import (
@@ -2,7 +2,7 @@
# 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 __future__ import print_function, unicode_literals
from __future__ import absolute_import, print_function, unicode_literals
from collections import defaultdict
import os
+1 -1
View File
@@ -2,7 +2,7 @@
# 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 __future__ import print_function, unicode_literals
from __future__ import absolute_import, print_function, unicode_literals
import argparse
import json
+1 -1
View File
@@ -2,7 +2,7 @@
# 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 __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
import mozpack.path as mozpath
+2
View File
@@ -4,6 +4,8 @@
# Integrates luciddream test runner with mach.
from __future__ import absolute_import
import os
from mozbuild.base import (
+8 -4
View File
@@ -2,10 +2,9 @@
# 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 __future__ import print_function, unicode_literals
from __future__ import absolute_import, print_function, unicode_literals
import os
import pprint
import sys
from mach.decorators import (
@@ -14,7 +13,6 @@ from mach.decorators import (
Command,
)
from autotry import AutoTry
from mozbuild.base import MachCommandBase
@@ -354,7 +352,11 @@ class CheckSpiderMonkeyCommand(MachCommandBase):
check_style_cmd = [sys.executable, os.path.join(self.topsrcdir, 'config', 'check_spidermonkey_style.py')]
check_style_result = subprocess.call(check_style_cmd, cwd=os.path.join(self.topsrcdir, 'js', 'src'))
all_passed = jittest_result and jstest_result and jsapi_tests_result and check_style_result
print('running check-masm')
check_masm_cmd = [sys.executable, os.path.join(self.topsrcdir, 'config', 'check_macroassembler_style.py')]
check_masm_result = subprocess.call(check_masm_cmd, cwd=os.path.join(self.topsrcdir, 'js', 'src'))
all_passed = jittest_result and jstest_result and jsapi_tests_result and check_style_result and check_masm_result
return all_passed
@@ -455,6 +457,8 @@ class PushToTry(MachCommandBase):
from mozbuild.testing import TestResolver
from mozbuild.controller.building import BuildDriver
from autotry import AutoTry
import pprint
print("mach try is under development, please file bugs blocking 1149670.")
+1 -1
View File
@@ -2,7 +2,7 @@
# 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 __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
import os
import sys
+1 -1
View File
@@ -2,7 +2,7 @@
# 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 __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
from argparse import Namespace
from collections import defaultdict
+1 -1
View File
@@ -4,7 +4,7 @@
# Integrates Talos mozharness with mach
from __future__ import print_function, unicode_literals
from __future__ import absolute_import, print_function, unicode_literals
import os
import sys
+2
View File
@@ -4,6 +4,8 @@
# 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 __future__ import absolute_import
import os
import json
import copy
+1 -1
View File
@@ -4,7 +4,7 @@
# Integrates the web-platform-tests test runner with mach.
from __future__ import unicode_literals, print_function
from __future__ import absolute_import, unicode_literals, print_function
import os
import sys
+1 -1
View File
@@ -4,7 +4,7 @@
# Integrates the xpcshell test runner with mach.
from __future__ import unicode_literals, print_function
from __future__ import absolute_import, unicode_literals, print_function
import argparse
import os
@@ -17,7 +17,6 @@
#include "nsJSUtils.h"
#include "xpcpublic.h"
#include "jspubtd.h"
#include "nsIJSRuntimeService.h"
#include "nsIDOMWindow.h"
#include "nsGlobalWindow.h"
+3 -9
View File
@@ -10,7 +10,6 @@
#include "jsapi.h"
#include "xpcpublic.h"
#include "nsIJSRuntimeService.h"
#include "nsIAddonInterposition.h"
#include "nsIAppStartup.h"
#include "nsIDirectoryEnumerator.h"
@@ -888,14 +887,9 @@ nsXREDirProvider::DoShutdown()
// Phase 2c: Now that things are torn down, force JS GC so that things which depend on
// resources which are about to go away in "profile-before-change" are destroyed first.
nsCOMPtr<nsIJSRuntimeService> rtsvc
(do_GetService("@mozilla.org/js/xpc/RuntimeService;1"));
if (rtsvc)
{
JSRuntime *rt = nullptr;
rtsvc->GetRuntime(&rt);
if (rt)
::JS_GC(rt);
JSRuntime *rt = xpc::GetJSRuntime();
if (rt) {
JS_GC(rt);
}
// Phase 3: Notify observers of a profile change
+1 -1
View File
@@ -2,7 +2,7 @@
# 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 __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
import os
+1 -1
View File
@@ -2,7 +2,7 @@
# 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 __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
import sys
import os
+1 -1
View File
@@ -2,7 +2,7 @@
# 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 __future__ import print_function, unicode_literals
from __future__ import absolute_import, print_function, unicode_literals
import os
import sys
-1
View File
@@ -12,7 +12,6 @@
#include "nsDirectoryServiceUtils.h"
#include "nsDirectoryServiceDefs.h"
#include "nsXULAppAPI.h"
#include "nsIJSRuntimeService.h"
#include "nsIProfileSaveEvent.h"
#ifdef XP_WIN