зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1489317: Part 4 - Add asssertion that COM is initialized on the thread that is resolving an agile reference; r=mhowell
Depends on D5321 Differential Revision: https://phabricator.services.mozilla.com/D5323 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
543d327b4e
Коммит
c603f63fc2
|
@ -6,10 +6,11 @@
|
|||
|
||||
#include "mozilla/mscom/AgileReference.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/DynamicallyLinkedFunctionPtr.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Move.h"
|
||||
#include "mozilla/mscom/Utils.h"
|
||||
|
||||
#if NTDDI_VERSION < NTDDI_WINBLUE
|
||||
|
||||
|
@ -137,6 +138,7 @@ AgileReference::Resolve(REFIID aIid, void** aOutInterface) const
|
|||
{
|
||||
MOZ_ASSERT(aOutInterface);
|
||||
MOZ_ASSERT(mAgileRef || mGitCookie);
|
||||
MOZ_ASSERT(IsCOMInitializedOnCurrentThread());
|
||||
|
||||
if (!aOutInterface) {
|
||||
return E_INVALIDARG;
|
||||
|
|
|
@ -32,6 +32,15 @@ extern "C" IMAGE_DOS_HEADER __ImageBase;
|
|||
namespace mozilla {
|
||||
namespace mscom {
|
||||
|
||||
bool
|
||||
IsCOMInitializedOnCurrentThread()
|
||||
{
|
||||
APTTYPE aptType;
|
||||
APTTYPEQUALIFIER aptTypeQualifier;
|
||||
HRESULT hr = CoGetApartmentType(&aptType, &aptTypeQualifier);
|
||||
return hr != CO_E_NOTINITIALIZED;
|
||||
}
|
||||
|
||||
bool
|
||||
IsCurrentThreadMTA()
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ struct IUnknown;
|
|||
namespace mozilla {
|
||||
namespace mscom {
|
||||
|
||||
bool IsCOMInitializedOnCurrentThread();
|
||||
bool IsCurrentThreadMTA();
|
||||
bool IsProxy(IUnknown* aUnknown);
|
||||
bool IsValidGUID(REFGUID aCheckGuid);
|
||||
|
|
|
@ -229,6 +229,8 @@ NS_IMETHODIMP JumpListBuilder::InitListBuild(JSContext* aCx,
|
|||
|
||||
void JumpListBuilder::DoInitListBuild(RefPtr<Promise>&& aPromise)
|
||||
{
|
||||
// Since we're invoking COM interfaces to talk to the shell on a background
|
||||
// thread, we need to be running inside a single-threaded apartment.
|
||||
mscom::STARegion sta;
|
||||
MOZ_ASSERT(sta.IsValid());
|
||||
|
||||
|
@ -515,6 +517,8 @@ NS_IMETHODIMP JumpListBuilder::CommitListBuild(nsIJumpListCommittedCallback* aCa
|
|||
|
||||
void JumpListBuilder::DoCommitListBuild(RefPtr<detail::DoneCommitListBuildCallback> aCallback)
|
||||
{
|
||||
// Since we're invoking COM interfaces to talk to the shell on a background
|
||||
// thread, we need to be running inside a single-threaded apartment.
|
||||
mscom::STARegion sta;
|
||||
MOZ_ASSERT(sta.IsValid());
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче