ProxyConfigLookupParent.cpp (1484B)
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 "ProxyConfigLookupParent.h" 8 #include "ProxyConfigLookup.h" 9 #include "nsProxyInfo.h" 10 11 namespace mozilla { 12 namespace net { 13 14 ProxyConfigLookupParent::ProxyConfigLookupParent(nsIURI* aURI, 15 uint32_t aProxyResolveFlags) 16 : mURI(aURI), mProxyResolveFlags(aProxyResolveFlags) {} 17 18 ProxyConfigLookupParent::~ProxyConfigLookupParent() = default; 19 20 void ProxyConfigLookupParent::DoProxyLookup() { 21 RefPtr<ProxyConfigLookupParent> self = this; 22 nsresult rv = ProxyConfigLookup::Create( 23 [self](nsIProxyInfo* aProxyInfo, nsresult aStatus) { 24 if (self->CanSend()) { 25 nsTArray<ProxyInfoCloneArgs> proxyInfoArray; 26 if (aProxyInfo && NS_SUCCEEDED(aStatus)) { 27 nsProxyInfo::SerializeProxyInfo( 28 static_cast<nsProxyInfo*>(aProxyInfo), proxyInfoArray); 29 } 30 (void)Send__delete__(self, proxyInfoArray, aStatus); 31 } 32 }, 33 mURI, mProxyResolveFlags); 34 35 if (NS_WARN_IF(NS_FAILED(rv))) { 36 nsTArray<ProxyInfoCloneArgs> emptyArray; 37 (void)Send__delete__(self, emptyArray, rv); 38 } 39 } 40 41 } // namespace net 42 } // namespace mozilla