-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add spec for IFrameMemoryUsage.md #3234
Conversation
specs/IFrameMemoryUsage
Outdated
[interface_name("Microsoft.Web.WebView2.Core.ICoreWebView2_18")] | ||
{ | ||
// ICoreWebView2_18 members | ||
UInt32 ProcessId { get; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably name this RendererProcessId (and rename all the rest too). There's different kinds of processes and we should make it clear what this is.
specs/IFrameMemoryUsage
Outdated
```c# (but really MIDL3) | ||
namespace Microsoft.Web.WebView2.Core | ||
{ | ||
runtimeclass CoreWebView2FrameCreatedEventArgs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same runtimeclass that already exists correct? No modifications? If so and you want to include it please add a comment noting that this is an existing unchanged class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Will remove this from spec.
specs/IFrameMemoryUsage
Outdated
} | ||
} | ||
|
||
// Skipping class CoreWebView2FrameInfoCollection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this comment. The frame info is not relevant to this doc
specs/IFrameMemoryUsage
Outdated
``` | ||
C# | ||
```c# | ||
void WebView_HandleIFrames(object sender, CoreWebView2FrameCreatedEventArgs args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The C# and C++ sample code should be the same. Currently the C++ code creates a message whereas the C# code creates a frames list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will refine that later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refined. I added some comments for both when renderer process id changed/obtained.
specs/IFrameMemoryUsage
Outdated
unsigned int processId; | ||
CHECK_FAILURE(webviewFrame5->get_ProcessId(&processId)); | ||
message += | ||
L",\"render process id\": " + std::to_wstring((int)processId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't do anything with this message we create. Is there a real scenario we can demonstrate with the FrameCreated event? What did we do for the sample code in the CoreWebView2.FrameCreated spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Win Sample App -> Window Event Monitor
, we print out this message. I will add that to the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what is the real world scenario? I guess we're adding it so apps can monitor performance and such via telemetry so this is perhaps fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apps can get memory usage based on process id.
specs/IFrameMemoryUsage
Outdated
unsigned int processId; | ||
CHECK_FAILURE(webviewFrame5->get_ProcessId(&processId)); | ||
message += | ||
L",\"render process id\": " + std::to_wstring((int)processId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what is the real world scenario? I guess we're adding it so apps can monitor performance and such via telemetry so this is perhaps fine.
specs/IFrameMemoryUsage
Outdated
// MSOWNERS: [email protected] | ||
HRESULT remove_FrameCreated([in] EventRegistrationToken token); | ||
|
||
/// Get the render process id of the iframe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to explain just a bit about the renderer process for a frame: The render process ID can change when navigating to a new document and you can use the RenderProcessIdChanged event to know when it changes. Child frames may have different renderer processes. See the process model documentation for more information.
specs/IFrameMemoryUsage
Outdated
|
||
/// Get the render process id of the iframe. | ||
// MSOWNERS: [email protected] | ||
[propget] HRESULT RenderProcessId([out, retval] UINT32* value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chromium code and documentation (https://www.chromium.org/developers/design-documents/multi-process-architecture/) calls this 'renderer process' not 'render process'. Do we already have reference to 'render process' in our APIs? If so we can match that existing term. Otherwise would be good to name 'renderer process'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No existing APIs use render process as naming. Agree!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like both show up already. Since we're already inconsistent we can go with the more accurate one renderer. COREWEBVIEW2_PROCESS_FAILED_KIND uses 'render' and COREWEBVIEW2_PROCESS_KIND uses 'renderer'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed.
specs/IFrameMemoryUsage
Outdated
// MSOWNERS: [email protected] | ||
[propget] HRESULT RenderProcessId([out, retval] UINT32* value); | ||
|
||
/// Subscribe to render process Id changed event. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to add some additional context, "The render process ID can change when X happens"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just some small wording updates. Please fix wording, complete PR, open new PR to main, and let me know link to new PR and I will schedule API review meeting.
specs/IFrameMemoryUsage.md
Outdated
# Background | ||
The WebView2 team has been asked to provide support for monitoring iframe | ||
memory usage. Developer needs to know how much memory each iframe consumes. | ||
To do that, they need to get renderer process id for each iframe". However, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To do that, they need to get renderer process id for each iframe". However, | |
To do that, they need to get the renderer process ID for each iframe. However, |
specs/IFrameMemoryUsage.md
Outdated
|
||
# Background | ||
The WebView2 team has been asked to provide support for monitoring iframe | ||
memory usage. Developer needs to know how much memory each iframe consumes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
memory usage. Developer needs to know how much memory each iframe consumes. | |
memory usage. The end developer needs to know how much memory each iframe consumes. |
specs/IFrameMemoryUsage.md
Outdated
The WebView2 team has been asked to provide support for monitoring iframe | ||
memory usage. Developer needs to know how much memory each iframe consumes. | ||
To do that, they need to get renderer process id for each iframe". However, | ||
WV2 only tracks the render frame host for top-level iframes. This limits the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WV2 only tracks the render frame host for top-level iframes. This limits the | |
WebView2 only tracks the render frame host for top-level iframes. This limits the |
specs/IFrameMemoryUsage.md
Outdated
memory usage. Developer needs to know how much memory each iframe consumes. | ||
To do that, they need to get renderer process id for each iframe". However, | ||
WV2 only tracks the render frame host for top-level iframes. This limits the | ||
[ICoreWebView2Frame2](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2frame?view=webview2-1.0.1518.46) apis for first-level iframes only. For instance, we can handle iframe created event for first-level iframe, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Break long line and wording updates
[ICoreWebView2Frame2](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2frame?view=webview2-1.0.1518.46) apis for first-level iframes only. For instance, we can handle iframe created event for first-level iframe, | |
[ICoreWebView2Frame2](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2frame?view=webview2-1.0.1518.46) APIs | |
for first-level iframes only. For instance, we raise the FrameCreated event for first-level iframes, |
specs/IFrameMemoryUsage.md
Outdated
To do that, they need to get renderer process id for each iframe". However, | ||
WV2 only tracks the render frame host for top-level iframes. This limits the | ||
[ICoreWebView2Frame2](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2frame?view=webview2-1.0.1518.46) apis for first-level iframes only. For instance, we can handle iframe created event for first-level iframe, | ||
but not for nested iframes with depth greater than 1. Also, WV2 lacks an API to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but not for nested iframes with depth greater than 1. Also, WV2 lacks an API to | |
but not for nested iframes with depth greater than 1. Also, WebView2 lacks an API to |
specs/IFrameMemoryUsage.md
Outdated
WV2 only tracks the render frame host for top-level iframes. This limits the | ||
[ICoreWebView2Frame2](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2frame?view=webview2-1.0.1518.46) apis for first-level iframes only. For instance, we can handle iframe created event for first-level iframe, | ||
but not for nested iframes with depth greater than 1. Also, WV2 lacks an API to | ||
get the renderer process id for its iframe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get the renderer process id for its iframe. | |
get the renderer process ID for iframes. |
specs/IFrameMemoryUsage.md
Outdated
the renderer process id is changed for `CoreWebView2` or `CoreWebView2Frame`. | ||
|
||
Additionally, we propose to add the `FrameCreated` event to `CoreWebView2Frame`. | ||
This event fires when a new frame is created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This event fires when a new frame is created. | |
This event is raised when a new frame is created. |
Add iframe memory usage API
ec49b4c
to
f354939
Compare
This is a review for the new IFrame memory usage API.