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 248311 39b05ad67a2f1cf14b76c349a40e9718949de383
parent 248310 6e4dce410c272c458fd4772644e759d043ba0e8b
child 248312 839f6e4f322a626c9565455e29988ecbb3b9f407
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [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();
 }