Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

line chart: better WebGL edge case handle #5465

Merged
merged 3 commits into from
Dec 15, 2021

Conversation

stephanwlee
Copy link
Contributor

This change makes two improvements to WebGL support for the line chart.

  1. Better feature detection. We now also listen to
    webglcontextcreationerror which gets emitted when browser fails to
    create webgl context from a canvas. This can be a good indication
    that user's system may not be able to handle WebGL renderer.
  2. Better removal of JavaScript object. When an Angular components get
    scrapped, we get a chance to clean more stuff up. With the signal, we
    now instruct Three.js renderer to dispose all the objects more
    explicitly for better freeing of WebGL context + Three.js objects.

There is no great way to unit test to guarantee correctness of the
utility and the operation. Thus, we will leave such test to an
integration test that would exercise browser capabilities. For now, we
are happy with a manual functional test.

@stephanwlee stephanwlee requested a review from bmd3k December 15, 2021 15:14
@@ -84,6 +84,11 @@ export interface ObjectRenderer<CacheValue = {}> {
destroyObject(cachedValue: CacheValue): void;

setUseDarkMode(useDarkMode: boolean): void;

/**
* Disposes rendering context. After invocation, renderer will never be used.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"will never be used" or "should never be used"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is indicating to the implementer of renderer that one should expect that the renderer will no longer be used ever after dispose is called. should never be used sounds like an instruction to a user of the renderer. 🤔

I could see this jsdoc being used for both cases. Adopted your phrasing instead.

This change makes two improvements to WebGL support for the line chart.

1. Better feature detection. We now also listen to
   `webglcontextcreationerror` which gets emitted when browser fails to
   create webgl context from a canvas. This can be a good indication
   that user's system may not be able to handle WebGL renderer.
2. Better removal of JavaScript object. When an Angular components get
   scrapped, we get a chance to clean more stuff up. With the signal, we
   now instruct Three.js renderer to dispose all the objects more
   explicitly for better freeing of WebGL context + Three.js objects.

There is no great way to unit test to guarantee correctness of the
utility and the operation. Thus, we will leave such test to an
integration test that would exercise browser capabilities.  For now, we
are happy with a manual functional test.
@stephanwlee stephanwlee merged commit f6056d6 into tensorflow:master Dec 15, 2021
@stephanwlee stephanwlee deleted the webgl branch December 15, 2021 17:54
yatbear pushed a commit to yatbear/tensorboard that referenced this pull request Mar 27, 2023
This change makes two improvements to WebGL support for the line chart.

1. Better feature detection. We now also listen to
   `webglcontextcreationerror` which gets emitted when browser fails to
   create webgl context from a canvas. This can be a good indication
   that user's system may not be able to handle WebGL renderer.
2. Better removal of JavaScript object. When an Angular components get
   scrapped, we get a chance to clean more stuff up. With the signal, we
   now instruct Three.js renderer to dispose all the objects more
   explicitly for better freeing of WebGL context + Three.js objects.

There is no great way to unit test to guarantee correctness of the
utility and the operation. Thus, we will leave such test to an
integration test that would exercise browser capabilities.  For now, we
are happy with a manual functional test.
dna2github pushed a commit to dna2fork/tensorboard that referenced this pull request May 1, 2023
This change makes two improvements to WebGL support for the line chart.

1. Better feature detection. We now also listen to
   `webglcontextcreationerror` which gets emitted when browser fails to
   create webgl context from a canvas. This can be a good indication
   that user's system may not be able to handle WebGL renderer.
2. Better removal of JavaScript object. When an Angular components get
   scrapped, we get a chance to clean more stuff up. With the signal, we
   now instruct Three.js renderer to dispose all the objects more
   explicitly for better freeing of WebGL context + Three.js objects.

There is no great way to unit test to guarantee correctness of the
utility and the operation. Thus, we will leave such test to an
integration test that would exercise browser capabilities.  For now, we
are happy with a manual functional test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants