Skip to content

Commit 5f08783

Browse files
committed
Improve comments around CEF UI thread
1 parent 466fa67 commit 5f08783

File tree

6 files changed

+39
-20
lines changed

6 files changed

+39
-20
lines changed

CefSharp.Core/Cef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace CefSharp
5151

5252
public:
5353
/// <summary>
54-
/// Called on the browser process UI thread immediately after the CEF context has been initialized.
54+
/// Called on the CEF UI thread immediately after the CEF context has been initialized.
5555
/// You can now access the Global RequestContext through Cef.GetGlobalRequestContext() - this is the
5656
/// first place you can set Preferences (e.g. proxy settings, spell check dictionaries).
5757
/// </summary>

CefSharp/IDialogHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace CefSharp
88
{
99
/// <summary>
10-
/// Implement this interface to handle dialog events. The methods of this class will be called on the browser process UI thread.
10+
/// Implement this interface to handle dialog events. The methods of this class will be called on the CEF UI thread.
1111
/// </summary>
1212
public interface IDialogHandler
1313
{

CefSharp/IGeolocationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace CefSharp
66
{
77
/// <summary>
88
/// Implement this interface to handle events related to geolocation permission requests.
9-
/// The methods of this class will be called on the browser process UI thread.
9+
/// The methods of this class will be called on the CEF UI thread.
1010
/// </summary>
1111
public interface IGeolocationHandler
1212
{

CefSharp/IPrintToPdfCallback.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace CefSharp
66
{
77
/// <summary>
88
/// Callback interface for <see cref="IBrowserHost.PrintToPDF"/>. The methods of this interface
9-
/// will be called on the browser process UI thread.
9+
/// will be called on the CEF UI thread.
1010
/// </summary>
1111
public interface IPrintToPdfCallback
1212
{

CefSharp/IRequestContext.cs

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,30 +72,40 @@ public interface IRequestContext : IDisposable
7272

7373
/// <summary>
7474
/// Tells all renderer processes associated with this context to throw away
75-
/// their plugin list cache. If |reload_pages| is true they will also reload
75+
/// their plugin list cache. If reloadPages is true they will also reload
7676
/// all pages with plugins. RequestContextHandler.OnBeforePluginLoad may
7777
/// be called to rebuild the plugin list cache.
7878
/// </summary>
7979
/// <param name="reloadPages">reload any pages with pluginst</param>
8080
void PurgePluginListCache(bool reloadPages);
8181

8282
/// <summary>
83-
/// Returns true if a preference with the specified |name| exists. This method
84-
/// must be called on the browser process UI thread.
83+
/// Returns true if a preference with the specified name exists. This method
84+
/// must be called on the CEF UI thread.
8585
/// </summary>
86-
/// <param name="name"></param>
87-
/// <returns></returns>
86+
/// <param name="name">name of preference</param>
87+
/// <returns>bool if the preference exists</returns>
88+
/// <remarks>Use Cef.UIThreadTaskFactory to execute this method if required,
89+
/// Cef.OnContextInitialized and ChromiumWebBrowser.IsBrowserInitializedChanged are both
90+
/// executed on the CEF UI thread, so can be called directly.
91+
/// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
92+
/// application thread will be the CEF UI thread.</remarks>
8893
bool HasPreference(string name);
8994

9095
/// <summary>
91-
/// Returns the value for the preference with the specified |name|. Returns
96+
/// Returns the value for the preference with the specified name. Returns
9297
/// NULL if the preference does not exist. The returned object contains a copy
9398
/// of the underlying preference value and modifications to the returned object
9499
/// will not modify the underlying preference value. This method must be called
95-
/// on the browser process UI thread.
96-
/// </summary>
97-
/// <param name="name"></param>
98-
/// <returns></returns>
100+
/// on the CEF UI thread.
101+
/// </summary>
102+
/// <param name="name">preference name</param>
103+
/// <returns>Returns the value for the preference with the specified name</returns>
104+
/// <remarks>Use Cef.UIThreadTaskFactory to execute this method if required,
105+
/// Cef.OnContextInitialized and ChromiumWebBrowser.IsBrowserInitializedChanged are both
106+
/// executed on the CEF UI thread, so can be called directly.
107+
/// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
108+
/// application thread will be the CEF UI thread.</remarks>
99109
object GetPreference(string name);
100110

101111
/// <summary>
@@ -113,25 +123,34 @@ public interface IRequestContext : IDisposable
113123
/// <summary>
114124
/// Returns true if the preference with the specified name can be modified
115125
/// using SetPreference. As one example preferences set via the command-line
116-
/// usually cannot be modified. This method must be called on the browser
117-
/// process UI thread.
126+
/// usually cannot be modified. This method must be called on the CEF UI thread.
118127
/// </summary>
119128
/// <param name="name">preference key</param>
120129
/// <returns>Returns true if the preference with the specified name can be modified
121130
/// using SetPreference</returns>
131+
/// <remarks>Use Cef.UIThreadTaskFactory to execute this method if required,
132+
/// Cef.OnContextInitialized and ChromiumWebBrowser.IsBrowserInitializedChanged are both
133+
/// executed on the CEF UI thread, so can be called directly.
134+
/// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
135+
/// application thread will be the CEF UI thread.</remarks>
122136
bool CanSetPreference(string name);
123137

124138
/// <summary>
125139
/// Set the value associated with preference name. If value is null the
126140
/// preference will be restored to its default value. If setting the preference
127141
/// fails then error will be populated with a detailed description of the
128-
/// problem. This method must be called on the browser process UI thread.
142+
/// problem. This method must be called on the CEF UI thread.
129143
/// Preferences set via the command-line usually cannot be modified.
130144
/// </summary>
131145
/// <param name="name">preference key</param>
132146
/// <param name="value">preference value</param>
133147
/// <param name="error">out error</param>
134148
/// <returns>Returns true if the value is set successfully and false otherwise.</returns>
149+
/// /// <remarks>Use Cef.UIThreadTaskFactory to execute this method if required,
150+
/// Cef.OnContextInitialized and ChromiumWebBrowser.IsBrowserInitializedChanged are both
151+
/// executed on the CEF UI thread, so can be called directly.
152+
/// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
153+
/// application thread will be the CEF UI thread.</remarks>
135154
bool SetPreference(string name, object value, out string error);
136155

137156
/// <summary>
@@ -162,7 +181,8 @@ public interface IRequestContext : IDisposable
162181

163182
/// <summary>
164183
/// Attempts to resolve origin to a list of associated IP addresses using
165-
/// cached data. This method must be called on the CEF IO thread.
184+
/// cached data. This method must be called on the CEF IO thread. Use
185+
/// Cef.IOThreadTaskFactory to execute on that thread.
166186
/// </summary>
167187
/// <param name="origin">host name to resolve</param>
168188
/// <param name="resolvedIpAddresses">list of resolved IP

CefSharp/IRequestHandler.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,13 @@ bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame
145145
bool OnProtocolExecution(IWebBrowser browserControl, IBrowser browser, string url);
146146

147147
/// <summary>
148-
/// Called on the browser process UI thread when the render view associated
148+
/// Called on the CEF UI thread when the render view associated
149149
/// with browser is ready to receive/handle IPC messages in the render
150150
/// process.
151151
/// </summary>
152152
/// <param name="browserControl">The ChromiumWebBrowser control</param>
153153
/// <param name="browser">the browser object</param>
154154
void OnRenderViewReady(IWebBrowser browserControl, IBrowser browser);
155-
156155

157156
/// <summary>
158157
/// Called on the CEF IO thread when a resource response is received.

0 commit comments

Comments
 (0)