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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 #include "content/browser/android/date_time_chooser_android.h" 104 #include "content/browser/android/date_time_chooser_android.h"
105 #include "content/browser/media/android/browser_media_player_manager.h" 105 #include "content/browser/media/android/browser_media_player_manager.h"
106 #include "content/browser/web_contents/web_contents_android.h" 106 #include "content/browser/web_contents/web_contents_android.h"
107 #include "content/public/browser/android/content_view_core.h" 107 #include "content/public/browser/android/content_view_core.h"
108 #endif 108 #endif
109 109
110 #if defined(OS_MACOSX) 110 #if defined(OS_MACOSX)
111 #include "base/mac/foundation_util.h" 111 #include "base/mac/foundation_util.h"
112 #endif 112 #endif
113 113
114 namespace {
115
116 int run_count = 0;
117 bool started = false;
118
119 void AwesomeTicker(base::TimeTicks scheduled_at) {
120 if (!scheduled_at.is_null()) {
121 base::TimeTicks now = base::TimeTicks::HighResNow();
122 LOG(ERROR) << "Actual delay: " << (now - scheduled_at).InMicroseconds();
123 ++run_count;
124 }
125 if (run_count == 10) {
126 run_count = 0;
127 started = false;
128 return;
129 }
130 base::MessageLoop::current()->PostDelayedTask(
131 FROM_HERE,
132 base::Bind(&AwesomeTicker, base::TimeTicks::HighResNow()),
133 base::TimeDelta::FromMicroseconds(16666));
134 }
135
136 void EnsureExperimentStarted() {
137 if (started)
138 return;
139 started = true;
140 base::MessageLoop::current()->PostDelayedTask(
141 FROM_HERE,
142 base::Bind(&AwesomeTicker, base::TimeTicks()),
143 base::TimeDelta::FromSeconds(10));
144 }
145
146 } // namespace
147
114 // Cross-Site Navigations 148 // Cross-Site Navigations
115 // 149 //
116 // If a WebContentsImpl is told to navigate to a different web site (as 150 // If a WebContentsImpl is told to navigate to a different web site (as
117 // determined by SiteInstance), it will replace its current RenderViewHost with 151 // determined by SiteInstance), it will replace its current RenderViewHost with
118 // a new RenderViewHost dedicated to the new SiteInstance. This works as 152 // a new RenderViewHost dedicated to the new SiteInstance. This works as
119 // follows: 153 // follows:
120 // 154 //
121 // - RVHM::Navigate determines whether the destination is cross-site, and if so, 155 // - RVHM::Navigate determines whether the destination is cross-site, and if so,
122 // it creates a pending_render_view_host_. 156 // it creates a pending_render_view_host_.
123 // - The pending RVH is "suspended," so that no navigation messages are sent to 157 // - The pending RVH is "suspended," so that no navigation messages are sent to
(...skipping 2393 matching lines...) Expand 10 before | Expand all | Expand 10 after
2517 2551
2518 void WebContentsImpl::DidCommitProvisionalLoad( 2552 void WebContentsImpl::DidCommitProvisionalLoad(
2519 RenderFrameHostImpl* render_frame_host, 2553 RenderFrameHostImpl* render_frame_host,
2520 const GURL& url, 2554 const GURL& url,
2521 PageTransition transition_type) { 2555 PageTransition transition_type) {
2522 // Notify observers about the commit of the provisional load. 2556 // Notify observers about the commit of the provisional load.
2523 FOR_EACH_OBSERVER(WebContentsObserver, 2557 FOR_EACH_OBSERVER(WebContentsObserver,
2524 observers_, 2558 observers_,
2525 DidCommitProvisionalLoadForFrame( 2559 DidCommitProvisionalLoadForFrame(
2526 render_frame_host, url, transition_type)); 2560 render_frame_host, url, transition_type));
2561 EnsureExperimentStarted();
2527 } 2562 }
2528 2563
2529 void WebContentsImpl::DidNavigateMainFramePreCommit( 2564 void WebContentsImpl::DidNavigateMainFramePreCommit(
2530 bool navigation_is_within_page) { 2565 bool navigation_is_within_page) {
2531 // Ensure fullscreen mode is exited before committing the navigation to a 2566 // Ensure fullscreen mode is exited before committing the navigation to a
2532 // different page. The next page will not start out assuming it is in 2567 // different page. The next page will not start out assuming it is in
2533 // fullscreen mode. 2568 // fullscreen mode.
2534 if (navigation_is_within_page) { 2569 if (navigation_is_within_page) {
2535 // No page change? Then, the renderer and browser can remain in fullscreen. 2570 // No page change? Then, the renderer and browser can remain in fullscreen.
2536 return; 2571 return;
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after
4233 if (new_size != old_size) 4268 if (new_size != old_size)
4234 delegate_->UpdatePreferredSize(this, new_size); 4269 delegate_->UpdatePreferredSize(this, new_size);
4235 } 4270 }
4236 4271
4237 void WebContentsImpl::ResumeResponseDeferredAtStart() { 4272 void WebContentsImpl::ResumeResponseDeferredAtStart() {
4238 FrameTreeNode* node = frame_tree_.root(); 4273 FrameTreeNode* node = frame_tree_.root();
4239 node->render_manager()->ResumeResponseDeferredAtStart(); 4274 node->render_manager()->ResumeResponseDeferredAtStart();
4240 } 4275 }
4241 4276
4242 } // namespace content 4277 } // namespace content
OLDNEW
« 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