New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 658020 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
OOO until 4th Feb
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug
Team-Security-UX

Blocked on:
issue 658018



Sign in to add a comment

Add Threadsafe API to PermissionManager for GetPermissionStatus

Project Member Reported by dougt@chromium.org, Oct 20 2016

Issue description

Add threadsafe version of PermissionManager::GetPermissionStatus

The PermissionManager is not threadsafe.  However PermissionManager is built on top of host_content_settings_map.  These maps have a contract that it can be read from any thread (but only written to on the UI thread).  So, given a host_content_settings_map, we can implement PermissionManager::GetPermissionStatus thread safe way.


 
Cc: raymes@chromium.org

Comment 2 by raymes@chromium.org, Oct 24 2016

Components: Internals>Permissions>Model
As discussed in chat - I'm a bit wary of doing this because it implies that all code that would ever be used to query a permission must be threadsafe. Note that HostContentSettingsMap isn't the only source of permission data. We would want to carefully consider the implications before doing this.

Comment 3 by raymes@chromium.org, Oct 24 2016

I just noticed your doc, so I added a comment there :)
Project Member

Comment 5 by bugdroid1@chromium.org, Oct 25 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c7d2c5a9df56e9a3a2cacc23fcb07ae93870d7b6

commit c7d2c5a9df56e9a3a2cacc23fcb07ae93870d7b6
Author: dougt <dougt@chromium.org>
Date: Tue Oct 25 00:35:45 2016

Revert of Add threadsafe version of PermissionManager::GetPermissionStatus (patchset #5 id:80001 of https://codereview.chromium.org/2439673004/ )

Reason for revert:
Going to address a number of issues that Raymes pointed out including:

1) It's unclear the purpose the overloaded GetPermissionStatus function (see https://google.github.io/styleguide/cppguide.html#Function_Overloading). It could be good to name it something that reflects its usage from a background thread.

2) In PermissionManager, it's unclear that it is threadsafe while the rest of the class isn't - we should add a comment.

3) It's unclear why HostContentSettingsMap needs to be passed in - it's already available in the PermissionContextBase.

4) I feel like it would be better to leave the default implementation empty in the PermissionContextBase and have NOTREACHED. Then if someone really wants to support querying a permission safely from a background thread, they have to think about it.

Original issue's description:
> Add threadsafe version of PermissionManager::GetPermissionStatus
>
> Add a version of GetPermissionStatus that takes a host_content_settings_map.
> This method is guaranteed to be threadsafe.
>
> BUG=658020
>
> R=jochen, mlamouri
>
> Committed: https://crrev.com/d6b19d48cf91f89c1ec414485b781f2ef2434521
> Cr-Commit-Position: refs/heads/master@{#427078}

TBR=mlamouri@chromium.org,jochen@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=658020

Review-Url: https://codereview.chromium.org/2446863002
Cr-Commit-Position: refs/heads/master@{#427189}

[modify] https://crrev.com/c7d2c5a9df56e9a3a2cacc23fcb07ae93870d7b6/chrome/browser/permissions/permission_context_base.cc
[modify] https://crrev.com/c7d2c5a9df56e9a3a2cacc23fcb07ae93870d7b6/chrome/browser/permissions/permission_context_base.h
[modify] https://crrev.com/c7d2c5a9df56e9a3a2cacc23fcb07ae93870d7b6/chrome/browser/permissions/permission_manager.cc
[modify] https://crrev.com/c7d2c5a9df56e9a3a2cacc23fcb07ae93870d7b6/chrome/browser/permissions/permission_manager.h
[modify] https://crrev.com/c7d2c5a9df56e9a3a2cacc23fcb07ae93870d7b6/chrome/browser/permissions/permission_manager_unittest.cc

Comment 6 by dougt@chromium.org, Oct 26 2016

Cc: -raymes@chromium.org dougt@chromium.org
Owner: raymes@chromium.org
We have agreed to delay this fix until we refactor the permission manager (Servicification).

Assigning to raymes@chromium.org to hold on to.
Cc: raymes@chromium.org dominickn@chromium.org timloh@chromium.org
 Issue 730290  has been merged into this issue.

Comment 8 by est...@chromium.org, Nov 10 2017

Labels: Hotlist-EnamelAndFriendsFixIt

Comment 9 by est...@chromium.org, Feb 18 2018

Labels: -Hotlist-EnamelAndFriendsFixIt

Sign in to add a comment