Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: content/browser/accessibility/browser_accessibility_state_impl.cc

Issue 11299312: Run Chrome OS accessibility histograms on main thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed feedback Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/accessibility/browser_accessibility_state_impl.cc
diff --git a/content/browser/accessibility/browser_accessibility_state_impl.cc b/content/browser/accessibility/browser_accessibility_state_impl.cc
index 44a8d29d2a54f9e724ef671c7878424f10ff6ada..2f6e0c32a46de535d7aa75cea4eedc964035568b 100644
--- a/content/browser/accessibility/browser_accessibility_state_impl.cc
+++ b/content/browser/accessibility/browser_accessibility_state_impl.cc
@@ -49,13 +49,22 @@ BrowserAccessibilityStateImpl::BrowserAccessibilityStateImpl()
accessibility_mode_ = AccessibilityModeComplete;
}
- // UpdateHistogram only takes a couple of milliseconds, but run it on
- // the FILE thread to guarantee there's no jank.
- // And we need to AddRef() the leaky singleton so that Bind doesn't
+#if defined(OS_WIN)
+ // On Windows, UpdateHistogram calls some system functions with unknown
+ // runtime, so call it on the file thread to ensure there's no jank.
+ // Everything in that method must be safe to call on another thread.
+ BrowserThread::ID update_histogram_thread = BrowserThread::FILE;
+#else
+ // On all other platforms, UpdateHistogram should be called on the main
+ // thread.
+ BrowserThread::ID update_histogram_thread = BrowserThread::UI;
+#endif
+
+ // We need to AddRef() the leaky singleton so that Bind doesn't
// delete it prematurely.
AddRef();
BrowserThread::PostDelayedTask(
- BrowserThread::FILE, FROM_HERE,
+ update_histogram_thread, FROM_HERE,
base::Bind(&BrowserAccessibilityStateImpl::UpdateHistogram, this),
base::TimeDelta::FromSeconds(kAccessibilityHistogramDelaySecs));
}

Powered by Google App Engine
This is Rietveld 408576698