[WebLayer] Enable SafeBrowsingDBManager to be created/retrieved on UI
In //weblayer, SafeBrowsingDBManager currently can can be accessed only from the IO thread. However, the subresource filter component needs to take in a scoped_refptr to the embedder's SafeBrowsingDBManager on the UI thread as part of creating a navigation throttle. This instance is then internally passed to and accessed on the IO thread. In //chrome, the ServicesDelegate class creates the SafeBrowsingDBManager on the UI thread and vends a reference to it on any thread. This CL takes an analogous approach in //weblayer, allowing the method that creates the SafeBrowsingDBManager to be called on the UI thread, with the DBManager being *started* on the IO thread as it is now (via a posted task if the current thread is not the IO thread). We add an IO-thread safeguard to ensure that the DBManager is only started once. The precise structure here is not the same as that in //chrome's SafeBrowsingService, as the underlying structure is not the same: //chrome's SafeBrowsingService has an explicit Start() method from which it posts a task to start the SafeBrowsingDBManager on the IO thread. //weblayer's SafeBrowsingService has no such method and instead the SafeBrowsingDBManager is created/started on demand. Bug: 1116095 Change-Id: If6303ee0ec36ec75109eb3917dd5cea3946d98bc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2478950 Commit-Queue: Colin Blundell <blundell@chromium.org> Reviewed-by:Tim Volodine <timvolodine@chromium.org> Cr-Commit-Position: refs/heads/master@{#818850}
Showing
Please register or sign in to comment