forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1409635 (part 2) - Fix up nsIPrefLocalizedString. r=froydnj.
nsIPrefLocalizedString is meant to be a wrapper for nsISupportsString, basically identical but with a different identifier. But it's not a sub-interface of nsISupportsString. Instead it (almost) duplicates nsISupportsString's internals. Specifically, nsISupportsString has `attribute AString data`, resulting in these C++ methods: > NS_IMETHOD GetData(nsAString& aData) > NS_IMETHOD SetData(const nsAString& aData) nsIPrefLocalizedString has `attribute wstring data`, resulting in these C++ methods: > NS_IMETHOD GetData(char16_t** aData) > NS_IMETHOD SetData(const char16_t* aData) Then we have nsPrefLocalizedString, the concrete subclass of nsIPrefLocalizedString. It implements the AString methods via NS_FORWARD_NSISUPPORTSSTRING, which forwards to mUnicodeString. It also implements the wstring methods explicitly, and they just call the AString methods. It's all a bit of a mess. (Both interfaces also have `wstring toString()`. The forwarding works more smoothly for that method.) This patch changes nsIPrefLocalizedString so it is a trivial sub-interface of nsISupportsString. This change eliminates the need for the wstring methods, so the patch removes them as well. The net result is we have less code, and fewer conversions between C strings and Gecko strings. The patch also merges the nsISupportsString and nsIPrefLocalizedString cases in nsPrefBranch::SetComplexValue(), because they are now identical. (The nsISupportsString and nsIPrefLocalizedString cases in nsPrefBranch::GetComplexValue() remain distinct; indeed, that's the whole reason for having them as separate interfaces.)
- Loading branch information
1 parent
289ca78
commit 4b08893
Showing
2 changed files
with
9 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters