fune/toolkit/components/viaduct/Viaduct.cpp
Nika Layzell e8e1f6902e Bug 1800295 - Delete the Viaduct XPCOM interface, r=chutten,markh
This XPCOM interface was being initialized and used, and was unnecessary.
This patch removes it completely to simplify things, initializing
viaduct during xpcom startup instead. This is done rather than keeping
it lazy and tied to FOG startup, as the implementation just sets a
static atomic to a function pointer.

This makes no changes to anything which actually uses viaduct, which is
done through the previously mentioned static atomic.

Differential Revision: https://phabricator.services.mozilla.com/D162010
2022-11-15 17:25:46 +00:00

28 lines
750 B
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#include "mozilla/Viaduct.h"
#include "mozilla/ViaductRequest.h"
namespace mozilla {
namespace {
extern "C" {
uint8_t viaduct_initialize(
ViaductByteBuffer (*fetch_callback)(ViaductByteBuffer));
}
static ViaductByteBuffer ViaductCallback(ViaductByteBuffer buffer) {
MOZ_ASSERT(!NS_IsMainThread(), "Background thread only!");
RefPtr<ViaductRequest> request = new ViaductRequest();
return request->MakeRequest(buffer);
}
} // namespace
void InitializeViaduct() { viaduct_initialize(ViaductCallback); }
} // namespace mozilla