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

Side by Side Diff: chrome/browser/prerender/prerender_local_predictor.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/prerender/prerender_local_predictor.h" 5 #include "chrome/browser/prerender/prerender_local_predictor.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 DISALLOW_IMPLICIT_CONSTRUCTORS(PrerenderProperties); 305 DISALLOW_IMPLICIT_CONSTRUCTORS(PrerenderProperties);
306 }; 306 };
307 307
308 PrerenderLocalPredictor::PrerenderLocalPredictor( 308 PrerenderLocalPredictor::PrerenderLocalPredictor(
309 PrerenderManager* prerender_manager) 309 PrerenderManager* prerender_manager)
310 : prerender_manager_(prerender_manager), 310 : prerender_manager_(prerender_manager),
311 is_visit_database_observer_(false), 311 is_visit_database_observer_(false),
312 weak_factory_(this), 312 weak_factory_(this),
313 current_prerender_would_have_matched_(false) { 313 current_prerender_would_have_matched_(false) {
314 RecordEvent(EVENT_CONSTRUCTED); 314 RecordEvent(EVENT_CONSTRUCTED);
315 if (MessageLoop::current()) { 315 if (base::MessageLoop::current()) {
316 timer_.Start(FROM_HERE, 316 timer_.Start(FROM_HERE,
317 base::TimeDelta::FromMilliseconds(kInitDelayMs), 317 base::TimeDelta::FromMilliseconds(kInitDelayMs),
318 this, 318 this,
319 &PrerenderLocalPredictor::Init); 319 &PrerenderLocalPredictor::Init);
320 RecordEvent(EVENT_INIT_SCHEDULED); 320 RecordEvent(EVENT_INIT_SCHEDULED);
321 } 321 }
322 322
323 static const size_t kChecksumHashSize = 32; 323 static const size_t kChecksumHashSize = 32;
324 base::RefCountedStaticMemory* url_whitelist_data = 324 base::RefCountedStaticMemory* url_whitelist_data =
325 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( 325 ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 // If the namespace matches and the URL matches, we might be able to swap 795 // If the namespace matches and the URL matches, we might be able to swap
796 // in. However, the actual code initating the swapin is in the renderer 796 // in. However, the actual code initating the swapin is in the renderer
797 // and is checking for other criteria (such as POSTs). There may 797 // and is checking for other criteria (such as POSTs). There may
798 // also be conditions when a swapin should happen but does not. By recording 798 // also be conditions when a swapin should happen but does not. By recording
799 // the two previous events, we can keep an eye on the magnitude of the 799 // the two previous events, we can keep an eye on the magnitude of the
800 // discrepancy. 800 // discrepancy.
801 current_prerender_would_have_matched_ = true; 801 current_prerender_would_have_matched_ = true;
802 } 802 }
803 803
804 } // namespace prerender 804 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | chrome/browser/prerender/prerender_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698