tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

AgileReference.cpp (1243B)


      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 "mozilla/mscom/AgileReference.h"
      8 
      9 #include "mozilla/Assertions.h"
     10 #include "mozilla/mscom/Utils.h"
     11 
     12 namespace mozilla::mscom::detail {
     13 
     14 HRESULT AgileReference_CreateImpl(RefPtr<IAgileReference>& aRefPtr, REFIID riid,
     15                                  IUnknown* aObject) {
     16  MOZ_ASSERT(aObject);
     17  MOZ_ASSERT(IsCOMInitializedOnCurrentThread());
     18  return ::RoGetAgileReference(AGILEREFERENCE_DEFAULT, riid, aObject,
     19                               getter_AddRefs(aRefPtr));
     20 }
     21 
     22 HRESULT AgileReference_ResolveImpl(RefPtr<IAgileReference> const& aRefPtr,
     23                                   REFIID riid, void** aOutInterface) {
     24  MOZ_ASSERT(aRefPtr);
     25  MOZ_ASSERT(aOutInterface);
     26  MOZ_ASSERT(IsCOMInitializedOnCurrentThread());
     27 
     28  if (!aRefPtr || !aOutInterface) {
     29    return E_INVALIDARG;
     30  }
     31 
     32  *aOutInterface = nullptr;
     33  return aRefPtr->Resolve(riid, aOutInterface);
     34 }
     35 
     36 }  // namespace mozilla::mscom::detail