Verify HostZoomMapImpl lives on the UI thread.
By spamming it with DCHECK_CURRENTLY_ON() everywhere. Since no DCHECKs
failed, delete the lock and all the related code that assume the class
can be accessed on other threads. Add threading checks to ZoomController
as well.
Change-Id: I04f8315eaebd5839889a771fd5c13bf43c4d8f31
Reviewed-on: https://chromium-review.googlesource.com/762529
Reviewed-by: James MacLean <[email protected]>
Commit-Queue: Lei Zhang <[email protected]>
Cr-Commit-Position: refs/heads/master@{#517891}
diff --git a/content/browser/host_zoom_map_impl.h b/content/browser/host_zoom_map_impl.h
index 418acedf..e35249b 100644
--- a/content/browser/host_zoom_map_impl.h
+++ b/content/browser/host_zoom_map_impl.h
@@ -13,15 +13,13 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/sequenced_task_runner_helpers.h"
-#include "base/synchronization/lock.h"
#include "content/public/browser/host_zoom_map.h"
namespace content {
class WebContentsImpl;
-// HostZoomMap needs to be deleted on the UI thread because it listens
-// to notifications on there.
+// HostZoomMap lives on the UI thread.
class CONTENT_EXPORT HostZoomMapImpl : public HostZoomMap {
public:
HostZoomMapImpl();
@@ -84,15 +82,11 @@
// Returns the temporary zoom level that's only valid for the lifetime of
// the given WebContents (i.e. isn't saved and doesn't affect other
// WebContentses) if it exists, the default zoom level otherwise.
- //
- // This may be called on any thread.
double GetTemporaryZoomLevel(int render_process_id,
int render_view_id) const;
// Returns the zoom level regardless of whether it's temporary, host-keyed or
// scheme+host-keyed.
- //
- // This may be called on any thread.
double GetZoomLevelForView(const GURL& url,
int render_process_id,
int render_view_id) const;
@@ -128,12 +122,6 @@
double GetZoomLevelForHost(const std::string& host) const;
- // Non-locked versions for internal use. These should only be called within
- // a scope where a lock has been acquired.
- double GetZoomLevelForHostInternal(const std::string& host) const;
- double GetZoomLevelForHostAndSchemeInternal(const std::string& scheme,
- const std::string& host) const;
-
// Set a zoom level for |host| and store the |last_modified| timestamp.
// Use only to explicitly set a timestamp.
void SetZoomLevelForHostInternal(const std::string& host,
@@ -151,7 +139,7 @@
base::CallbackList<void(const ZoomLevelChange&)>
zoom_level_changed_callbacks_;
- // Copy of the pref data, so that we can read it on the IO thread.
+ // Copy of the pref data.
HostZoomLevels host_zoom_levels_;
SchemeHostZoomLevels scheme_host_zoom_levels_;
double default_zoom_level_;
@@ -161,11 +149,6 @@
TemporaryZoomLevels temporary_zoom_levels_;
- // Used around accesses to |host_zoom_levels_|, |default_zoom_level_|,
- // |temporary_zoom_levels_|, and |view_page_scale_factors_are_one_| to
- // guarantee thread safety.
- mutable base::Lock lock_;
-
bool store_last_modified_;
std::unique_ptr<base::Clock> clock_;