/src/mozilla-central/dom/media/doctor/DDLogMessage.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "DDLogMessage.h" |
8 | | |
9 | | #include "DDLifetimes.h" |
10 | | |
11 | | namespace mozilla { |
12 | | |
13 | | nsCString |
14 | | DDLogMessage::Print() const |
15 | 0 | { |
16 | 0 | nsCString str; |
17 | 0 | str.AppendPrintf("%" PRImi " | %f | %s[%p] | %s | %s | ", |
18 | 0 | mIndex.Value(), |
19 | 0 | ToSeconds(mTimeStamp), |
20 | 0 | mObject.TypeName(), |
21 | 0 | mObject.Pointer(), |
22 | 0 | ToShortString(mCategory), |
23 | 0 | mLabel); |
24 | 0 | AppendToString(mValue, str); |
25 | 0 | return str; |
26 | 0 | } |
27 | | |
28 | | nsCString |
29 | | DDLogMessage::Print(const DDLifetimes& aLifetimes) const |
30 | 0 | { |
31 | 0 | nsCString str; |
32 | 0 | const DDLifetime* lifetime = aLifetimes.FindLifetime(mObject, mIndex); |
33 | 0 | str.AppendPrintf("%" PRImi " | %f | ", mIndex.Value(), ToSeconds(mTimeStamp)); |
34 | 0 | lifetime->AppendPrintf(str); |
35 | 0 | str.AppendPrintf(" | %s | %s | ", ToShortString(mCategory), mLabel); |
36 | 0 | if (!mValue.is<DDLogObject>()) { |
37 | 0 | AppendToString(mValue, str); |
38 | 0 | } else { |
39 | 0 | const DDLifetime* lifetime2 = |
40 | 0 | aLifetimes.FindLifetime(mValue.as<DDLogObject>(), mIndex); |
41 | 0 | if (lifetime2) { |
42 | 0 | lifetime2->AppendPrintf(str); |
43 | 0 | } else { |
44 | 0 | AppendToString(mValue, str); |
45 | 0 | } |
46 | 0 | } |
47 | 0 | return str; |
48 | 0 | } |
49 | | |
50 | | } // namespace mozilla |