Don't create services that need a DB thread if there is no DB thread.
Right now, this CL is vacuous, since |db_thread_| is always set. However, while changing the WebDataService to move off the DB thread, I'll be changing ChromeSyncClient to get the correct thread from the WebDataService. If there is no WebDataService, then the easiest thing to do is this CL (don't bother creating things that need a WebDataService to function, and ensure that tests that need these created create the WebDataService first). If we didn't do this, then one of two things would happen: * ChromeSyncClient would pass a null db_thread_ in, which would get passed into the various individual datatype services here, which would then run into problems because at least some of them DCHECK that they have a model thread. These services would have to be tweaked to instead DCHECK that no one tries to _use_ them when there's no model thread. I went this route first, then decided it made no sense to create services that weren't allowed to be used. * ChromeSyncClient would make up a random task runner and pass it down as the model thread. Again, it felt misleading to create a task runner that no one could run tasks on (because if someone did, it would mean they were trying to talk to a database that didn't exist). So, this seemed like the clearest precursor to the future changes. While there, I also tweaked how the conditional works for history-based services so it would be structured similarly. Bug: 689520 Change-Id: Ic1aaa5947e7328b322bc508e3092ab389b6f73c3 Reviewed-on: https://chromium-review.googlesource.com/578929Reviewed-by:Nicolas Zea <zea@chromium.org> Commit-Queue: Peter Kasting <pkasting@chromium.org> Cr-Commit-Position: refs/heads/master@{#488388}
Showing
Please register or sign in to comment