Skip to content

Commit 6694909

Browse files
committed
Backed out 4 changesets (bug 1489317) for causing Windows test failures CLOSED TREE
Backed out changeset 8cf95604ce94 (bug 1489317) Backed out changeset 9d444f92b939 (bug 1489317) Backed out changeset e0535e0450c8 (bug 1489317) Backed out changeset 0f8554d82b32 (bug 1489317)
1 parent 1377458 commit 6694909

File tree

7 files changed

+48
-231
lines changed

7 files changed

+48
-231
lines changed

ipc/mscom/AgileReference.cpp

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66

77
#include "mozilla/mscom/AgileReference.h"
88

9-
#include "mozilla/Assertions.h"
109
#include "mozilla/DebugOnly.h"
1110
#include "mozilla/DynamicallyLinkedFunctionPtr.h"
11+
#include "mozilla/Assertions.h"
1212
#include "mozilla/Move.h"
13-
#include "mozilla/mscom/Utils.h"
1413

1514
#if NTDDI_VERSION < NTDDI_WINBLUE
1615

@@ -31,34 +30,10 @@ HRESULT WINAPI RoGetAgileReference(AgileReferenceOptions options,
3130
namespace mozilla {
3231
namespace mscom {
3332

34-
AgileReference::AgileReference()
35-
: mIid()
36-
, mGitCookie(0)
37-
{
38-
}
39-
4033
AgileReference::AgileReference(REFIID aIid, IUnknown* aObject)
4134
: mIid(aIid)
4235
, mGitCookie(0)
4336
{
44-
AssignInternal(aObject);
45-
}
46-
47-
void
48-
AgileReference::Assign(REFIID aIid, IUnknown* aObject)
49-
{
50-
Clear();
51-
mIid = aIid;
52-
AssignInternal(aObject);
53-
}
54-
55-
void
56-
AgileReference::AssignInternal(IUnknown* aObject)
57-
{
58-
// We expect mIid to already be set
59-
DebugOnly<IID> zeroIid = {};
60-
MOZ_ASSERT(mIid != zeroIid);
61-
6237
/*
6338
* There are two possible techniques for creating agile references. Starting
6439
* with Windows 8.1, we may use the RoGetAgileReference API, which is faster.
@@ -71,7 +46,7 @@ AgileReference::AssignInternal(IUnknown* aObject)
7146
MOZ_ASSERT(aObject);
7247

7348
if (pRoGetAgileReference &&
74-
SUCCEEDED(pRoGetAgileReference(AGILEREFERENCE_DEFAULT, mIid, aObject,
49+
SUCCEEDED(pRoGetAgileReference(AGILEREFERENCE_DEFAULT, aIid, aObject,
7550
getter_AddRefs(mAgileRef)))) {
7651
return;
7752
}
@@ -82,7 +57,7 @@ AgileReference::AssignInternal(IUnknown* aObject)
8257
return;
8358
}
8459

85-
DebugOnly<HRESULT> hr = git->RegisterInterfaceInGlobal(aObject, mIid,
60+
DebugOnly<HRESULT> hr = git->RegisterInterfaceInGlobal(aObject, aIid,
8661
&mGitCookie);
8762
MOZ_ASSERT(SUCCEEDED(hr));
8863
}
@@ -97,16 +72,7 @@ AgileReference::AgileReference(AgileReference&& aOther)
9772

9873
AgileReference::~AgileReference()
9974
{
100-
Clear();
101-
}
102-
103-
void
104-
AgileReference::Clear()
105-
{
106-
mIid = {};
107-
10875
if (!mGitCookie) {
109-
mAgileRef = nullptr;
11076
return;
11177
}
11278

@@ -118,27 +84,13 @@ AgileReference::Clear()
11884

11985
DebugOnly<HRESULT> hr = git->RevokeInterfaceFromGlobal(mGitCookie);
12086
MOZ_ASSERT(SUCCEEDED(hr));
121-
mGitCookie = 0;
122-
}
123-
124-
AgileReference&
125-
AgileReference::operator=(AgileReference&& aOther)
126-
{
127-
Clear();
128-
mIid = aOther.mIid;
129-
aOther.mIid = {};
130-
mAgileRef = std::move(aOther.mAgileRef);
131-
mGitCookie = aOther.mGitCookie;
132-
aOther.mGitCookie = 0;
133-
return *this;
13487
}
13588

13689
HRESULT
137-
AgileReference::Resolve(REFIID aIid, void** aOutInterface) const
90+
AgileReference::Resolve(REFIID aIid, void** aOutInterface)
13891
{
13992
MOZ_ASSERT(aOutInterface);
14093
MOZ_ASSERT(mAgileRef || mGitCookie);
141-
MOZ_ASSERT(IsCOMInitializedOnCurrentThread());
14294

14395
if (!aOutInterface) {
14496
return E_INVALIDARG;
@@ -178,7 +130,7 @@ AgileReference::Resolve(REFIID aIid, void** aOutInterface) const
178130
return originalInterface->QueryInterface(aIid, aOutInterface);
179131
}
180132

181-
/* static */ IGlobalInterfaceTable*
133+
IGlobalInterfaceTable*
182134
AgileReference::ObtainGit()
183135
{
184136
// Internally to COM, the Global Interface Table is a singleton, therefore we

ipc/mscom/AgileReference.h

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,9 @@ namespace mscom {
3333
* HRESULT hr = myAgileRef->Resolve(IID_IFoo, getter_AddRefs(foo));
3434
* // Now foo may be called from the main thread
3535
*/
36-
class AgileReference final
36+
class AgileReference
3737
{
3838
public:
39-
AgileReference();
40-
41-
template <typename InterfaceT>
42-
explicit AgileReference(RefPtr<InterfaceT>& aObject)
43-
: AgileReference(__uuidof(InterfaceT), aObject)
44-
{
45-
}
46-
4739
AgileReference(REFIID aIid, IUnknown* aObject);
4840
AgileReference(AgileReference&& aOther);
4941

@@ -54,31 +46,14 @@ class AgileReference final
5446
return mAgileRef || mGitCookie;
5547
}
5648

57-
template <typename T>
58-
void Assign(const RefPtr<T>& aOther)
59-
{
60-
Assign(__uuidof(T), aOther);
61-
}
62-
63-
template <typename T>
64-
AgileReference& operator=(const RefPtr<T>& aOther)
65-
{
66-
Assign(aOther);
67-
return *this;
68-
}
69-
70-
HRESULT Resolve(REFIID aIid, void** aOutInterface) const;
49+
HRESULT Resolve(REFIID aIid, void** aOutInterface);
7150

7251
AgileReference(const AgileReference& aOther) = delete;
7352
AgileReference& operator=(const AgileReference& aOther) = delete;
74-
75-
AgileReference& operator=(AgileReference&& aOther);
53+
AgileReference& operator=(AgileReference&& aOther) = delete;
7654

7755
private:
78-
void Assign(REFIID aIid, IUnknown* aObject);
79-
void AssignInternal(IUnknown* aObject);
80-
void Clear();
81-
static IGlobalInterfaceTable* ObtainGit();
56+
IGlobalInterfaceTable* ObtainGit();
8257

8358
private:
8459
IID mIid;
@@ -89,26 +64,4 @@ class AgileReference final
8964
} // namespace mscom
9065
} // namespace mozilla
9166

92-
template <typename T>
93-
RefPtr<T>::RefPtr(const mozilla::mscom::AgileReference& aAgileRef)
94-
{
95-
void* newRawPtr;
96-
if (FAILED(aAgileRef.Resolve(__uuidof(T), &newRawPtr))) {
97-
newRawPtr = nullptr;
98-
}
99-
assign_assuming_AddRef(static_cast<T*>(newRawPtr));
100-
}
101-
102-
template <typename T>
103-
RefPtr<T>&
104-
RefPtr<T>::operator=(const mozilla::mscom::AgileReference& aAgileRef)
105-
{
106-
void* newRawPtr;
107-
if (FAILED(aAgileRef.Resolve(__uuidof(T), &newRawPtr))) {
108-
newRawPtr = nullptr;
109-
}
110-
assign_assuming_AddRef(static_cast<T*>(newRawPtr));
111-
return *this;
112-
}
113-
11467
#endif // mozilla_mscom_AgileReference_h

ipc/mscom/Utils.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@ extern "C" IMAGE_DOS_HEADER __ImageBase;
3232
namespace mozilla {
3333
namespace mscom {
3434

35-
bool
36-
IsCOMInitializedOnCurrentThread()
37-
{
38-
APTTYPE aptType;
39-
APTTYPEQUALIFIER aptTypeQualifier;
40-
HRESULT hr = CoGetApartmentType(&aptType, &aptTypeQualifier);
41-
return hr != CO_E_NOTINITIALIZED;
42-
}
43-
4435
bool
4536
IsCurrentThreadMTA()
4637
{

ipc/mscom/Utils.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ struct IUnknown;
2020
namespace mozilla {
2121
namespace mscom {
2222

23-
bool IsCOMInitializedOnCurrentThread();
2423
bool IsCurrentThreadMTA();
2524
bool IsProxy(IUnknown* aUnknown);
2625
bool IsValidGUID(REFGUID aCheckGuid);

mfbt/RefPtr.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ class nsISupports;
2222
namespace mozilla {
2323
template<class T> class OwningNonNull;
2424
template<class T> class StaticRefPtr;
25-
#if defined(XP_WIN)
26-
namespace mscom {
27-
class AgileReference;
28-
} // namespace mscom
29-
#endif // defined(XP_WIN)
3025

3126
// Traditionally, RefPtr supports automatic refcounting of any pointer type
3227
// with AddRef() and Release() methods that follow the traditional semantics.
@@ -157,9 +152,6 @@ class MOZ_IS_REFPTR RefPtr
157152

158153
MOZ_IMPLICIT RefPtr(const nsQueryReferent& aHelper);
159154
MOZ_IMPLICIT RefPtr(const nsCOMPtr_helper& aHelper);
160-
#if defined(XP_WIN)
161-
MOZ_IMPLICIT RefPtr(const mozilla::mscom::AgileReference& aAgileRef);
162-
#endif // defined(XP_WIN)
163155

164156
// Defined in OwningNonNull.h
165157
template<class U>
@@ -223,9 +215,6 @@ class MOZ_IS_REFPTR RefPtr
223215

224216
RefPtr<T>& operator=(const nsQueryReferent& aQueryReferent);
225217
RefPtr<T>& operator=(const nsCOMPtr_helper& aHelper);
226-
#if defined(XP_WIN)
227-
RefPtr<T>& operator=(const mozilla::mscom::AgileReference& aAgileRef);
228-
#endif // defined(XP_WIN)
229218

230219
RefPtr<T>&
231220
operator=(RefPtr<T> && aRefPtr)

0 commit comments

Comments
 (0)