Bug 1118164 - Tracelogging: Don't fail if there is no logger, r=bbouvier
authorHannes Verschore <hv1989@gmail.com>
Wed, 07 Jan 2015 11:14:29 +0100
changeset 222485 39b05ad67a2f1cf14b76c349a40e9718949de383
parent 222484 6e4dce410c272c458fd4772644e759d043ba0e8b
child 222486 839f6e4f322a626c9565455e29988ecbb3b9f407
push id28067
push userkwierso@gmail.com
push dateWed, 07 Jan 2015 23:41:38 +0000
treeherdermozilla-central@70de2960aa87 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1118164
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1118164 - Tracelogging: Don't fail if there is no logger, r=bbouvier
js/src/vm/TraceLogging.cpp
--- a/js/src/vm/TraceLogging.cpp
+++ b/js/src/vm/TraceLogging.cpp
@@ -882,41 +882,53 @@ js::TraceLogEnableTextId(JSContext *cx, 
 void
 js::TraceLogDisableTextId(JSContext *cx, uint32_t textId)
 {
     traceLoggers.disableTextId(cx, textId);
 }
 
 TraceLoggerEvent::TraceLoggerEvent(TraceLoggerThread *logger, TraceLoggerTextId textId)
 {
-    payload_ = logger->getOrCreateEventPayload(textId);
-    if (payload_)
-        payload_->use();
+    payload_ = nullptr;
+    if (logger) {
+        payload_ = logger->getOrCreateEventPayload(textId);
+        if (payload_)
+            payload_->use();
+    }
 }
 
 TraceLoggerEvent::TraceLoggerEvent(TraceLoggerThread *logger, TraceLoggerTextId type,
                                    JSScript *script)
 {
-    payload_ = logger->getOrCreateEventPayload(type, script);
-    if (payload_)
-        payload_->use();
+    payload_ = nullptr;
+    if (logger) {
+        payload_ = logger->getOrCreateEventPayload(type, script);
+        if (payload_)
+            payload_->use();
+    }
 }
 
 TraceLoggerEvent::TraceLoggerEvent(TraceLoggerThread *logger, TraceLoggerTextId type,
                                    const JS::ReadOnlyCompileOptions &compileOptions)
 {
-    payload_ = logger->getOrCreateEventPayload(type, compileOptions);
-    if (payload_)
-        payload_->use();
+    payload_ = nullptr;
+    if (logger) {
+        payload_ = logger->getOrCreateEventPayload(type, compileOptions);
+        if (payload_)
+            payload_->use();
+    }
 }
 
 TraceLoggerEvent::TraceLoggerEvent(TraceLoggerThread *logger, const char *text)
 {
-    payload_ = logger->getOrCreateEventPayload(text);
-    if (payload_)
-        payload_->use();
+    payload_ = nullptr;
+    if (logger) {
+        payload_ = logger->getOrCreateEventPayload(text);
+        if (payload_)
+            payload_->use();
+    }
 }
 
 TraceLoggerEvent::~TraceLoggerEvent()
 {
     if (payload_)
         payload_->release();
 }