Simplify StringImpl::CreateCFString.

Currently, it does a clever trick if called on the main thread, where it uses a
custom CFAllocator to hold a StringImpl reference next to the CFStringRef
allocation and release it when the NSCFString is dealloced, posting a task to
the main thread if necessary.

Firstly, the number of places where this efficiency is likely to be helpful has
significantly reduced, now that most OS interaction occurs in the browser process.
Locale and font names are not long enough in practice to be worth this.

Secondly, though this may not presently occur, this is not sufficient to ensure
safety, since it assumes that the NSCFString can move from one thread to another,
but the original WTF::String doesn't.

The following sequence appears to be possible currently:
  - WTF::String created on main thread
  - NSCFString created from it
  - Object owning both moves to another thread
  - Object is destroyed, releasing both
  - NSCFString release task races with ~String

Change-Id: I4bd2b0ca01dbe8a637d58f61bcebaf7c2f1e0006
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1521030
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#640436}
3 files changed