Skip to content

Commit 2757d86

Browse files
authored
Update SingleAppHost.md
1 parent 05d1bb4 commit 2757d86

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

specs/SingleAppHost.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
# Background
2-
While WebViews from different app processes normally don't share the same WebView browser process instance, app processes from the same product suite may share the same webview browser process
3-
instance by specifying the same user data folder when creating WebView2Environment object.
4-
The `ExclusiveUserDataFolderAccess` property is for the developer to express the sharing intent, so that we could provide optimized security and performance according expected usage.
2+
WebViews which use the same user data folder can share browser processes. The `ExclusiveUserDataFolderAccess` property specifies that the WebView environment obtains exclusive access to the user data folder. If the user data folder is already being used by another WebView environment, the WebView creation will fail. Setting exclusive data folder access therefore has the effect of preventing the browser processes from being shared with WebViews associated with other WebView environments.
53

64
# Description
7-
The `ExclusiveUserDataFolderAccess` property indicates whether other processes can create WebView2 sharing the same WebView browser process instance by using WebView2Environment created with the same user data folder.
5+
The `ExclusiveUserDataFolderAccess` property specifies whether other WebViews can be created with the same user data folder. Setting exclusive access prevents the WebView browser processes from being shared with those belonging to other environments because sharing occurs only between instances that use the same user data folder and the same exclusive access setting.
86
Default is FALSE.
97

108
# Examples
119
## Win32 C++
1210
```cpp
1311
auto options = Microsoft::WRL::Make<CoreWebView2EnvironmentOptions>();
14-
// Don't expect any other process to share the WebView browser process instance.
15-
CHECK_FAILURE(options->put_ExclusiveUserDataFolderAccess(TRUE);
12+
// Don't allow any other WebView environments to use the same user data folder.
13+
// This prevents other processes from sharing WebView browser process instances with our WebView.
14+
CHECK_FAILURE(options->put_ExclusiveUserDataFolderAccess(TRUE));
1615
HRESULT hr = CreateCoreWebView2EnvironmentWithOptions(
1716
nullptr, m_userDataFolder.c_str(), options.Get(),
1817
Callback<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler>(
@@ -34,22 +33,25 @@ See API details.
3433
interface ICoreWebView2EnvironmentOptions_2 : IUnknown
3534
{
3635

37-
/// Whether other processes can create WebView2 sharing the same WebView browser
38-
/// process instance by using WebView2Environment created with the same user data folder.
36+
/// Whether other processes can create WebView2 from WebView2Environment created with the
37+
/// same user data folder and therefore sharing the same WebView browser process instance.
3938
/// Default is FALSE.
4039
[propget] HRESULT ExclusiveUserDataFolderAccess([out, retval] BOOL* value);
4140

4241
/// Sets the `ExclusiveUserDataFolderAccess` property.
43-
/// When set as TRUE, no other process can create WebView sharing the same browser
44-
/// process instance. When another process tries to create WebView2Controller from
45-
/// an WebView2Environment objct created with the same user data folder, it will fail
46-
/// with `HRESULT_FROM_WIN32(ERROR_INVALID_STATE)`.
47-
/// When the same user data folder is used, if there is already a WebView running,
48-
/// creating a WebView using WebView2Environment object with a different value for
49-
/// this property from that of the WebView2Environment object of the existing WebView
50-
/// will fail with `HRESULT_FROM_WIN32(ERROR_INVALID_STATE)`.
51-
/// When set to TRUE, `TrySuspend` could potentially do more optimization on reducing
52-
/// CPU usage for suspended WebViews.
42+
/// The `ExclusiveUserDataFolderAccess` property specifies that the WebView environment
43+
/// obtains exclusive access to the user data folder.
44+
/// If the user data folder is already being used by another WebView environment with
45+
/// different value for `ExclusiveUserDataFolderAccess` property, the creation of WebView2Controller
46+
/// using the environmen object will fail with `HRESULT_FROM_WIN32(ERROR_INVALID_STATE)`.
47+
/// When set as TRUE, no other WebView can be created from other process using WebView2Environment
48+
/// objects with the same UserDataFolder. This prevents other processes from creating WebViews
49+
/// which share the same browser process instance, since sharing is performed among
50+
/// WebViews that have the same UserDataFolder. When another process tries to create
51+
/// WebView2Controller from an WebView2Environment objct created with the same user data folder,
52+
/// it will fail with `HRESULT_FROM_WIN32(ERROR_INVALID_STATE)`.
53+
/// Exclusive data folder access also opens optimization opportunities, such as more aggressive
54+
/// CPU reduction for suspended WebViews.
5355
[propput] HRESULT ExclusiveUserDataFolderAccess([in] BOOL value);
5456

5557
}

0 commit comments

Comments
 (0)