RFR: 8359266: Delete the usage of AppContext in the GraphicsDevice [v2]

Sergey Bylokhov serb at openjdk.org
Sat Jun 28 04:03:04 UTC 2025


> This PR removes the usage of AppContext from the GraphicsDevice class. The original use case was to store the full-screen window in some AppContext, which was necessary in the context of plugin/appletviewer environments. However, there is now effectively only one main AppContext, so this indirection can be eliminated.
> 
> Notes: GraphicsDevice provides two methods for handling full-screen windows:
>  - setFullScreenWindow() is considered thread-safe, as all platform-specific implementations override it with synchronized methods ([example](https://github.com/openjdk/jdk/blob/23e1e2ff4a4a75ec268c7925fb98d6b96a01bbcf/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java#L226)).
>  - getFullScreenWindow() previously relied on AppContext for thread-safety. After removing AppContext, this method is now made thread-safe by declaring the fullScreenWindow field as volatile. This change has been validated by an added test.

Sergey Bylokhov has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - Merge branch 'openjdk:master' into JDK-8359266
 - Create FullScreenWindowRace.java
 - 8359266: Delete the usage of AppContext in the GraphicsDevice

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/25818/files
  - new: https://git.openjdk.org/jdk/pull/25818/files/f4856925..bdb08a93

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25818&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25818&range=00-01

  Stats: 30633 lines in 915 files changed: 16999 ins; 8666 del; 4968 mod
  Patch: https://git.openjdk.org/jdk/pull/25818.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25818/head:pull/25818

PR: https://git.openjdk.org/jdk/pull/25818


More information about the client-libs-dev mailing list