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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 407063002: Timer resolution test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 5c9cd720bd74ca281485fdac701c09db6cf00c95..44cc85881ce96a98cca3bc9ec3881905358decf0 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -111,6 +111,40 @@
#include "base/mac/foundation_util.h"
#endif
+namespace {
+
+int run_count = 0;
+bool started = false;
+
+void AwesomeTicker(base::TimeTicks scheduled_at) {
+ if (!scheduled_at.is_null()) {
+ base::TimeTicks now = base::TimeTicks::HighResNow();
+ LOG(ERROR) << "Actual delay: " << (now - scheduled_at).InMicroseconds();
+ ++run_count;
+ }
+ if (run_count == 10) {
+ run_count = 0;
+ started = false;
+ return;
+ }
+ base::MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&AwesomeTicker, base::TimeTicks::HighResNow()),
+ base::TimeDelta::FromMicroseconds(16666));
+}
+
+void EnsureExperimentStarted() {
+ if (started)
+ return;
+ started = true;
+ base::MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&AwesomeTicker, base::TimeTicks()),
+ base::TimeDelta::FromSeconds(10));
+}
+
+} // namespace
+
// Cross-Site Navigations
//
// If a WebContentsImpl is told to navigate to a different web site (as
@@ -2524,6 +2558,7 @@ void WebContentsImpl::DidCommitProvisionalLoad(
observers_,
DidCommitProvisionalLoadForFrame(
render_frame_host, url, transition_type));
+ EnsureExperimentStarted();
}
void WebContentsImpl::DidNavigateMainFramePreCommit(
« 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