Skip to content

Commit

Permalink
Update docs for IResourceRequestHandlerFactory (#3998)
Browse files Browse the repository at this point in the history
I have just discovered that when HasHandlers returns false, the GetResourceRequestHandler method is never executed.  Presumably this is an optimisation which happens inside of Chromium, as I can see that the HasHandlers property value goes all way back to the C++ native project.

I was about to suggest removing this optimisation because it'd be trivial to optimise and return early inside the default factory impl in C# world.  If it goes all the way down to Chromium then that's less easy and so the next best thing would be to document it.
  • Loading branch information
craigfowler authored and amaitland committed Feb 14, 2022
1 parent 1663b19 commit 0fb3c50
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CefSharp/IResourceRequestHandlerFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ public interface IResourceRequestHandlerFactory
/// <summary>
/// Are there any <see cref="ResourceHandler"/>'s registered?
/// </summary>
/// <remarks>
/// <para>
/// Implementors must return <see langword="true"/> from this method if the factory is to be used.
/// The <see cref="GetResourceRequestHandler"/> method will not be executed if this property returns
/// <see langword="false"/>, presumably as an optimisation.
/// </para>
/// </remarks>
bool HasHandlers { get; }

/// <summary>
Expand Down

0 comments on commit 0fb3c50

Please sign in to comment.