Skip to content

Commit

Permalink
[PlatformKeysService] Document the thread on which callbacks will run
Browse files Browse the repository at this point in the history
PlatformKeysService expects users to call its public functions on the UI
thread and it saves the task runner on which the NSS operation runs
(which should be always the UI thread task runner in that case) and then
calls the callback on that task runner.

This CL documents that behavior so that it is easier for the service
users to know on what thread their callback will be called.

In a future CL, we may simplify the code by always running the callbacks
on the UI thread task runner using content::GetUIThreadTaskRunner
without saving the origin task runner.

Bug: 1205375
Change-Id: I34914e6254409a65f269e76abf892f4e6ae114cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2917017
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#887799}
  • Loading branch information
omorsi authored and Chromium LUCI CQ committed May 31, 2021
1 parent 3c8153d commit c82a92f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ class PlatformKeysServiceObserver : public base::CheckedObserver {
// Functions of this class shouldn't be called directly from the context of
// an extension. Instead use ExtensionPlatformKeysService which enforces
// restrictions upon extensions.
// All public methods of this class should be called on the UI thread.
// All public methods of this class should be called on the UI thread and all of
// the callbacks will be called with the result on the UI thread as well.
// When the underlying key store is not available anymore, a PlatformKeysService
// is shut down. Any function called after that will fail with an error.
// For a Profile-specific PlatformKeysService, this will be when the Profile is
Expand Down

0 comments on commit c82a92f

Please sign in to comment.