Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1733465 part 1: Store nsViewManager::mRootViewManager in a RefPtr…
… instead of manually managing its reference count. r=tnikkel This patch is just a refactoring which shouldn't change behavior. Before this patch, mRootViewManager is a bit of an odd hybrid in terms of its ownership semantics. If it's pointing to `this`, then it's not an owning reference (i.e. we don't AddRef or Release it), vs. if it's pointing to some other instance, then it *is* an owning reference (i.e. we *do* AddRef and Release it). After this patch, we change things such that it's unconditionally an owning reference, with a null value having special meaning. In particular: (a) Now, we'll store it in a RefPtr and let that manage the reference counting. (b) Now, we'll never explicitly assign it to 'this'; instead, we set it to null and we interpret a null value as an indication that 'this' is the root. Fortunately, this variable doesn't have many direct usages, so this slight change in meaning/invariatnts doesn't require very much code to be updated. This variable is mostly used via the infallible RootViewManager() getter. This patch updates that getter in accordance with the new contract, and the callers don't need to worry about this change. Differential Revision: https://phabricator.services.mozilla.com/D127178
- Loading branch information