Line data Source code
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 : #include "nsISupportsImpl.h"
8 : #include "mozilla/Assertions.h"
9 :
10 : using namespace mozilla;
11 :
12 : nsresult NS_FASTCALL
13 650245 : NS_TableDrivenQI(void* aThis, REFNSIID aIID, void** aInstancePtr,
14 : const QITableEntry* aEntries)
15 : {
16 295389 : do {
17 650245 : if (aIID.Equals(*aEntries->iid)) {
18 : nsISupports* r = reinterpret_cast<nsISupports*>(
19 267926 : reinterpret_cast<char*>(aThis) + aEntries->offset);
20 267926 : NS_ADDREF(r);
21 267927 : *aInstancePtr = r;
22 267927 : return NS_OK;
23 : }
24 :
25 382344 : ++aEntries;
26 382344 : } while (aEntries->iid);
27 :
28 86955 : *aInstancePtr = nullptr;
29 86955 : return NS_ERROR_NO_INTERFACE;
30 : }
31 :
32 : #ifdef MOZ_THREAD_SAFETY_OWNERSHIP_CHECKS_SUPPORTED
33 95164 : nsAutoOwningThread::nsAutoOwningThread()
34 95164 : : mThread(GetCurrentVirtualThread())
35 : {
36 95164 : }
37 :
38 : void
39 1304861 : nsAutoOwningThread::AssertCurrentThreadOwnsMe(const char* msg) const
40 : {
41 1304861 : if (MOZ_UNLIKELY(mThread != GetCurrentVirtualThread())) {
42 : // `msg` is a string literal by construction.
43 0 : MOZ_CRASH_UNSAFE_OOL(msg);
44 : }
45 1304866 : }
46 : #endif
|