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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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) 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 "chrome/browser/google/google_url_tracker.h" 5 #include "chrome/browser/google/google_url_tracker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // fetch can eat up 20 ms of time, we delay five seconds, which is hopefully 54 // fetch can eat up 20 ms of time, we delay five seconds, which is hopefully
55 // long enough to be after startup, but still get results back quickly. 55 // long enough to be after startup, but still get results back quickly.
56 // Ideally, instead of this timer, we'd do something like "check if the 56 // Ideally, instead of this timer, we'd do something like "check if the
57 // browser is starting up, and if so, come back later", but there is currently 57 // browser is starting up, and if so, come back later", but there is currently
58 // no function to do this. 58 // no function to do this.
59 // 59 //
60 // In UNIT_TEST mode, where we want to explicitly control when the tracker 60 // In UNIT_TEST mode, where we want to explicitly control when the tracker
61 // "wakes up", we do nothing at all. 61 // "wakes up", we do nothing at all.
62 if (mode == NORMAL_MODE) { 62 if (mode == NORMAL_MODE) {
63 static const int kStartFetchDelayMS = 5000; 63 static const int kStartFetchDelayMS = 5000;
64 MessageLoop::current()->PostDelayedTask(FROM_HERE, 64 base::MessageLoop::current()->PostDelayedTask(FROM_HERE,
65 base::Bind(&GoogleURLTracker::FinishSleep, 65 base::Bind(&GoogleURLTracker::FinishSleep,
66 weak_ptr_factory_.GetWeakPtr()), 66 weak_ptr_factory_.GetWeakPtr()),
67 base::TimeDelta::FromMilliseconds(kStartFetchDelayMS)); 67 base::TimeDelta::FromMilliseconds(kStartFetchDelayMS));
68 } 68 }
69 } 69 }
70 70
71 GoogleURLTracker::~GoogleURLTracker() { 71 GoogleURLTracker::~GoogleURLTracker() {
72 // We should only reach here after any tabs and their infobars have been torn 72 // We should only reach here after any tabs and their infobars have been torn
73 // down. 73 // down.
74 DCHECK(entry_map_.empty()); 74 DCHECK(entry_map_.empty());
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 i->second->navigation_controller())) { 407 i->second->navigation_controller())) {
408 DCHECK(nav_helper_->IsListeningForNavigationStart()); 408 DCHECK(nav_helper_->IsListeningForNavigationStart());
409 return; 409 return;
410 } 410 }
411 } 411 }
412 if (nav_helper_->IsListeningForNavigationStart()) { 412 if (nav_helper_->IsListeningForNavigationStart()) {
413 DCHECK(!search_committed_); 413 DCHECK(!search_committed_);
414 nav_helper_->SetListeningForNavigationStart(false); 414 nav_helper_->SetListeningForNavigationStart(false);
415 } 415 }
416 } 416 }
OLDNEW
« no previous file with comments | « chrome/browser/google/google_update_win.cc ('k') | chrome/browser/google/google_url_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698