Skip to content

Commit

Permalink
Bug 1290337 - Part 19: Allocate JSErrorResult separately in Wrappable…
Browse files Browse the repository at this point in the history
…JSErrorResult. r=smaug
  • Loading branch information
arai-a committed Sep 11, 2016
1 parent 736738a commit 3e64f01
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,21 @@ class JSErrorResult :

class WrappableJSErrorResult {
public:
WrappableJSErrorResult() : isCopy(false) {}
WrappableJSErrorResult(const WrappableJSErrorResult &other) : mRv(), isCopy(true) {}
WrappableJSErrorResult()
: mRv(MakeUnique<JSErrorResult>()),
isCopy(false) {}
WrappableJSErrorResult(const WrappableJSErrorResult &other)
: mRv(MakeUnique<JSErrorResult>()),
isCopy(true) {}
~WrappableJSErrorResult() {
if (isCopy) {
MOZ_ASSERT(NS_IsMainThread());
}
}
operator JSErrorResult &() { return mRv; }
operator ErrorResult &() { return mRv; }
operator JSErrorResult &() { return *mRv; }
operator ErrorResult &() { return *mRv; }
private:
JSErrorResult mRv;
mozilla::UniquePtr<JSErrorResult> mRv;
bool isCopy;
};
}
Expand Down

0 comments on commit 3e64f01

Please sign in to comment.