Refactoring the code of JBR-4478 so that C++ standard library headers get only included in AccessibleCaret.cpp and not in any headers.
(cherry picked from commit 12bbc14e5e)
The feature adds caret tracking support for assistive tools that don't work with Java Access Bridge, specifically, for the built-in Windows Magnifier.
It works by implementing Win32 IAccessible interface for the text caret, and sending EVENT_OBJECT_LOCATIONCHANGE events whenever it changes.
It's enabled by default and can be disabled by setting `sun.awt.windows.use.native.caret.accessibility.events` property to false.
(cherry picked from commit 88f1599bad)
(cherry picked from commit 3f6c1d54e10d49dc72f9d02f30e52f4aa32e099d)
Enhanced Window counters to provide statistics (using the new marlin StatDouble class), enhanced logging code to dump regularly (10s) window stats, added shutdown hook, bumpCounter() renamed to incrementCounter(), added addStat(window, name, value) used by MTLLayer to report blitTexture & nextDrawable timings (ms), use InnocuousThread for shutdown hooks, fixed D3DSurfaceData bumpCounter() usages to incrementCounter()
Before this commit there was a race condition: `sun.nio.fs.ExtendedOptions.InternalOption.register(java.nio.file.OpenOption)` could register only one option.
There have been two similar options:
* `sun.nio.fs.ExtendedOptions.NOSHARE_DELETE`
* `java.io.JbExtendedOpenOptions.NOSHARE_DELETE`
This led to the following failure:
```
Caused by: java.lang.UnsupportedOperationException
at java.base/sun.nio.fs.WindowsChannelFactory$Flags.toFlags(WindowsChannelFactory.java:131)
at java.base/sun.nio.fs.WindowsChannelFactory.newFileChannel(WindowsChannelFactory.java:151)
at java.base/sun.nio.fs.WindowsFileSystemProvider.newFileChannel(WindowsFileSystemProvider.java:114)
at java.base/java.io.IoOverNioFileSystem.initializeStreamsUsingNio0(IoOverNioFileSystem.java:294)
at java.base/java.io.IoOverNioFileSystem.initializeStreamUsingNio(IoOverNioFileSystem.java:279)
at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:332)
```
This commit fixes the issue, now both options are supported.
`IoOverNio.isAllowedInThisThread` contained a bug: it could return `true` even if the feature is totally disabled.
Luckily, all usages of `IoOverNio.isAllowedInThisThread` don't exploit this bug. However, this problem can suddenly hit us later.