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

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

Issue 2888773002: Switch BrowserAccessibilityStateImpl to the TaskScheduler API. (Closed)
Patch Set: Add comment Created 3 years, 7 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 faf6a7bd412ba3745d4e9a7a84d8965df4ccbb61..32e17d9f019a2ab8aafb82e47e40f780fda66148 100644
--- a/content/browser/accessibility/browser_accessibility_state_impl.cc
+++ b/content/browser/accessibility/browser_accessibility_state_impl.cc
@@ -8,6 +8,7 @@
#include "base/command_line.h"
#include "base/metrics/histogram_macros.h"
+#include "base/task_scheduler/post_task.h"
#include "build/build_config.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
@@ -57,22 +58,15 @@ BrowserAccessibilityStateImpl::BrowserAccessibilityStateImpl()
: BrowserAccessibilityState(),
disable_hot_tracking_(false) {
ResetAccessibilityModeValue();
-#if defined(OS_WIN)
- // On Windows, UpdateHistograms 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, UpdateHistograms 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(
- update_histogram_thread, FROM_HERE,
+ // The delay is necessary because assistive technology sometimes isn't
+ // detected until after the user interacts in some way, so a reasonable delay
+ // gives us better numbers.
+ base::PostDelayedTaskWithTraits(
+ FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
base::Bind(&BrowserAccessibilityStateImpl::UpdateHistograms, this),
base::TimeDelta::FromSeconds(ACCESSIBILITY_HISTOGRAM_DELAY_SECS));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698