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

Side by Side Diff: chrome/browser/google/google_url_tracker.cc

Issue 9215005: Revert 117824 - Convert use of int ms to TimeDelta in files owned by brettw. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/google/google_url_tracker.h" 5 #include "chrome/browser/google/google_url_tracker.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (!queue_wakeup_task_) 181 if (!queue_wakeup_task_)
182 return; 182 return;
183 183
184 // Because this function can be called during startup, when kicking off a URL 184 // Because this function can be called during startup, when kicking off a URL
185 // fetch can eat up 20 ms of time, we delay five seconds, which is hopefully 185 // fetch can eat up 20 ms of time, we delay five seconds, which is hopefully
186 // long enough to be after startup, but still get results back quickly. 186 // long enough to be after startup, but still get results back quickly.
187 // Ideally, instead of this timer, we'd do something like "check if the 187 // Ideally, instead of this timer, we'd do something like "check if the
188 // browser is starting up, and if so, come back later", but there is currently 188 // browser is starting up, and if so, come back later", but there is currently
189 // no function to do this. 189 // no function to do this.
190 static const int kStartFetchDelayMS = 5000; 190 static const int kStartFetchDelayMS = 5000;
191
192 MessageLoop::current()->PostDelayedTask(FROM_HERE, 191 MessageLoop::current()->PostDelayedTask(FROM_HERE,
193 base::Bind(&GoogleURLTracker::FinishSleep, 192 base::Bind(&GoogleURLTracker::FinishSleep,
194 weak_ptr_factory_.GetWeakPtr()), 193 weak_ptr_factory_.GetWeakPtr()),
195 base::TimeDelta::FromMilliseconds(kStartFetchDelayMS)); 194 kStartFetchDelayMS);
196 } 195 }
197 196
198 void GoogleURLTracker::FinishSleep() { 197 void GoogleURLTracker::FinishSleep() {
199 in_startup_sleep_ = false; 198 in_startup_sleep_ = false;
200 StartFetchIfDesirable(); 199 StartFetchIfDesirable();
201 } 200 }
202 201
203 void GoogleURLTracker::StartFetchIfDesirable() { 202 void GoogleURLTracker::StartFetchIfDesirable() {
204 // Bail if a fetch isn't appropriate right now. This function will be called 203 // Bail if a fetch isn't appropriate right now. This function will be called
205 // again each time one of the preconditions changes, so we'll fetch 204 // again each time one of the preconditions changes, so we'll fetch
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 392
394 // |tab_contents| can be NULL during tests. 393 // |tab_contents| can be NULL during tests.
395 InfoBarTabHelper* infobar_helper = NULL; 394 InfoBarTabHelper* infobar_helper = NULL;
396 if (web_contents) { 395 if (web_contents) {
397 TabContentsWrapper* wrapper = 396 TabContentsWrapper* wrapper =
398 TabContentsWrapper::GetCurrentWrapperForContents(web_contents); 397 TabContentsWrapper::GetCurrentWrapperForContents(web_contents);
399 infobar_helper = wrapper->infobar_tab_helper(); 398 infobar_helper = wrapper->infobar_tab_helper();
400 } 399 }
401 infobar_ = (*infobar_creator_)(infobar_helper, this, fetched_google_url_); 400 infobar_ = (*infobar_creator_)(infobar_helper, this, fetched_google_url_);
402 } 401 }
OLDNEW
« no previous file with comments | « chrome/browser/feedback/feedback_util.cc ('k') | chrome/browser/history/expire_history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698