File: | var/lib/jenkins/workspace/firefox-scan-build/dom/debugger/CallbackDebuggerNotification.h |
Warning: | line 70, column 21 Value stored to 'typeStr' during its initialization is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
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 | #ifndef mozilla_dom_CallbackDebuggerNotification_h |
8 | #define mozilla_dom_CallbackDebuggerNotification_h |
9 | |
10 | #include "DebuggerNotification.h" |
11 | #include "DebuggerNotificationManager.h" |
12 | #include "mozilla/CycleCollectedJSContext.h" |
13 | |
14 | namespace mozilla::dom { |
15 | |
16 | class CallbackDebuggerNotification : public DebuggerNotification { |
17 | public: |
18 | NS_DECL_ISUPPORTS_INHERITEDpublic: virtual nsresult QueryInterface(const nsIID& aIID , void** aInstancePtr) override; virtual MozExternalRefCountType AddRef(void) override; virtual MozExternalRefCountType Release (void) override; |
19 | NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CallbackDebuggerNotification,class cycleCollection : public DebuggerNotification::cycleCollection { public: constexpr explicit cycleCollection(Flags aFlags = 0 ) : DebuggerNotification::cycleCollection(aFlags) {} private: public: virtual nsresult TraverseNative(void* p, nsCycleCollectionTraversalCallback & cb) override; virtual const char* ClassName() override { return "CallbackDebuggerNotification"; }; static CallbackDebuggerNotification * Downcast(nsISupports* s) { return static_cast<CallbackDebuggerNotification *>(static_cast<DebuggerNotification*>( DebuggerNotification ::cycleCollection::Downcast(s))); } virtual void Unlink(void* p) override; static constexpr nsXPCOMCycleCollectionParticipant * GetParticipant() { return &CallbackDebuggerNotification ::_cycleCollectorGlobal; } }; virtual void CheckForRightParticipant () override { nsXPCOMCycleCollectionParticipant* p; CallQueryInterface (this, &p); do { static_assert( mozilla::detail::AssertionConditionType <decltype(p == &_cycleCollectorGlobal)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(p == &_cycleCollectorGlobal ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "p == &_cycleCollectorGlobal" " (" "CallbackDebuggerNotification" " should QI to its own CC participant" ")", "/var/lib/jenkins/workspace/firefox-scan-build/dom/debugger/CallbackDebuggerNotification.h" , 20); AnnotateMozCrashReason("MOZ_ASSERT" "(" "p == &_cycleCollectorGlobal" ") (" "CallbackDebuggerNotification" " should QI to its own CC participant" ")"); do { *((volatile int*)__null) = 20; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } static cycleCollection _cycleCollectorGlobal; |
20 | DebuggerNotification)class cycleCollection : public DebuggerNotification::cycleCollection { public: constexpr explicit cycleCollection(Flags aFlags = 0 ) : DebuggerNotification::cycleCollection(aFlags) {} private: public: virtual nsresult TraverseNative(void* p, nsCycleCollectionTraversalCallback & cb) override; virtual const char* ClassName() override { return "CallbackDebuggerNotification"; }; static CallbackDebuggerNotification * Downcast(nsISupports* s) { return static_cast<CallbackDebuggerNotification *>(static_cast<DebuggerNotification*>( DebuggerNotification ::cycleCollection::Downcast(s))); } virtual void Unlink(void* p) override; static constexpr nsXPCOMCycleCollectionParticipant * GetParticipant() { return &CallbackDebuggerNotification ::_cycleCollectorGlobal; } }; virtual void CheckForRightParticipant () override { nsXPCOMCycleCollectionParticipant* p; CallQueryInterface (this, &p); do { static_assert( mozilla::detail::AssertionConditionType <decltype(p == &_cycleCollectorGlobal)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(p == &_cycleCollectorGlobal ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "p == &_cycleCollectorGlobal" " (" "CallbackDebuggerNotification" " should QI to its own CC participant" ")", "/var/lib/jenkins/workspace/firefox-scan-build/dom/debugger/CallbackDebuggerNotification.h" , 20); AnnotateMozCrashReason("MOZ_ASSERT" "(" "p == &_cycleCollectorGlobal" ") (" "CallbackDebuggerNotification" " should QI to its own CC participant" ")"); do { *((volatile int*)__null) = 20; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } static cycleCollection _cycleCollectorGlobal; |
21 | |
22 | CallbackDebuggerNotification(nsIGlobalObject* aDebuggeeGlobal, |
23 | DebuggerNotificationType aType, |
24 | CallbackDebuggerNotificationPhase aPhase, |
25 | nsIGlobalObject* aOwnerGlobal = nullptr) |
26 | : DebuggerNotification(aDebuggeeGlobal, aType, aOwnerGlobal), |
27 | mPhase(aPhase) {} |
28 | |
29 | // nsWrapperCache |
30 | virtual JSObject* WrapObject(JSContext* aCx, |
31 | JS::Handle<JSObject*> aGivenProto) override; |
32 | |
33 | already_AddRefed<DebuggerNotification> CloneInto( |
34 | nsIGlobalObject* aNewOwner) const override; |
35 | |
36 | CallbackDebuggerNotificationPhase Phase() const { return mPhase; } |
37 | |
38 | protected: |
39 | ~CallbackDebuggerNotification() = default; |
40 | |
41 | CallbackDebuggerNotificationPhase mPhase; |
42 | }; |
43 | |
44 | class MOZ_RAII CallbackDebuggerNotificationGuard final { |
45 | public: |
46 | MOZ_CAN_RUN_SCRIPT CallbackDebuggerNotificationGuard( |
47 | nsIGlobalObject* aDebuggeeGlobal, DebuggerNotificationType aType) |
48 | : mDebuggeeGlobal(aDebuggeeGlobal), mType(aType) { |
49 | Dispatch(CallbackDebuggerNotificationPhase::Pre); |
50 | } |
51 | CallbackDebuggerNotificationGuard(const CallbackDebuggerNotificationGuard&) = |
52 | delete; |
53 | CallbackDebuggerNotificationGuard(CallbackDebuggerNotificationGuard&&) = |
54 | delete; |
55 | CallbackDebuggerNotificationGuard& operator=( |
56 | const CallbackDebuggerNotificationGuard&) = delete; |
57 | CallbackDebuggerNotificationGuard& operator=( |
58 | CallbackDebuggerNotificationGuard&&) = delete; |
59 | |
60 | MOZ_CAN_RUN_SCRIPT ~CallbackDebuggerNotificationGuard() { |
61 | Dispatch(CallbackDebuggerNotificationPhase::Post); |
62 | } |
63 | |
64 | private: |
65 | MOZ_CAN_RUN_SCRIPT void Dispatch(CallbackDebuggerNotificationPhase aPhase) { |
66 | auto manager = DebuggerNotificationManager::ForDispatch(mDebuggeeGlobal); |
67 | if (MOZ_UNLIKELY(manager)(__builtin_expect(!!(manager), 0))) { |
68 | CycleCollectedJSContext* ccjcx = CycleCollectedJSContext::Get(); |
69 | if (ccjcx) { |
70 | const char* typeStr = ""; |
Value stored to 'typeStr' during its initialization is never read | |
71 | switch (mType) { |
72 | case DebuggerNotificationType::SetTimeout: |
73 | typeStr = "setTimeout"; |
74 | break; |
75 | case DebuggerNotificationType::ClearTimeout: |
76 | typeStr = "clearTimeout"; |
77 | break; |
78 | case DebuggerNotificationType::SetInterval: |
79 | typeStr = "setInterval"; |
80 | break; |
81 | case DebuggerNotificationType::ClearInterval: |
82 | typeStr = "clearInterval"; |
83 | break; |
84 | case DebuggerNotificationType::RequestAnimationFrame: |
85 | typeStr = "requestAnimationFrame"; |
86 | break; |
87 | case DebuggerNotificationType::CancelAnimationFrame: |
88 | typeStr = "cancelAnimationFrame"; |
89 | break; |
90 | case DebuggerNotificationType::SetTimeoutCallback: |
91 | typeStr = "setTimeout"; |
92 | break; |
93 | case DebuggerNotificationType::SetIntervalCallback: |
94 | typeStr = "setInterval"; |
95 | break; |
96 | case DebuggerNotificationType::RequestAnimationFrameCallback: |
97 | typeStr = "requestAnimationFrame"; |
98 | break; |
99 | case DebuggerNotificationType::DomEvent: |
100 | MOZ_CRASH("Unreachable")do { do { } while (false); MOZ_ReportCrash("" "Unreachable", "/var/lib/jenkins/workspace/firefox-scan-build/dom/debugger/CallbackDebuggerNotification.h" , 100); AnnotateMozCrashReason("MOZ_CRASH(" "Unreachable" ")" ); do { *((volatile int*)__null) = 100; __attribute__((nomerge )) ::abort(); } while (false); } while (false); |
101 | break; |
102 | } |
103 | if (aPhase == CallbackDebuggerNotificationPhase::Pre) { |
104 | JS_TracerEnterLabelLatin1(ccjcx->Context(), typeStr); |
105 | } else { |
106 | JS_TracerLeaveLabelLatin1(ccjcx->Context(), typeStr); |
107 | } |
108 | } |
109 | |
110 | manager->Dispatch<CallbackDebuggerNotification>(mType, aPhase); |
111 | } |
112 | } |
113 | |
114 | nsIGlobalObject* mDebuggeeGlobal; |
115 | DebuggerNotificationType mType; |
116 | }; |
117 | |
118 | } // namespace mozilla::dom |
119 | |
120 | #endif // mozilla_dom_CallbackDebuggerNotification_h |