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

Side by Side Diff: chrome/browser/prerender/prerender_manager.cc

Issue 6609008: Change other usages of .size() to .empty() when applicable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter nits Created 9 years, 9 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) 2011 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/prerender/prerender_manager.h" 5 #include "chrome/browser/prerender/prerender_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 PrerenderManager::PrerenderManager(Profile* profile) 56 PrerenderManager::PrerenderManager(Profile* profile)
57 : profile_(profile), 57 : profile_(profile),
58 max_prerender_age_(base::TimeDelta::FromSeconds( 58 max_prerender_age_(base::TimeDelta::FromSeconds(
59 kDefaultMaxPrerenderAgeSeconds)), 59 kDefaultMaxPrerenderAgeSeconds)),
60 max_elements_(kDefaultMaxPrerenderElements), 60 max_elements_(kDefaultMaxPrerenderElements),
61 prerender_contents_factory_(PrerenderContents::CreateFactory()) { 61 prerender_contents_factory_(PrerenderContents::CreateFactory()) {
62 } 62 }
63 63
64 PrerenderManager::~PrerenderManager() { 64 PrerenderManager::~PrerenderManager() {
65 while (prerender_list_.size() > 0) { 65 while (!prerender_list_.empty()) {
66 PrerenderContentsData data = prerender_list_.front(); 66 PrerenderContentsData data = prerender_list_.front();
67 prerender_list_.pop_front(); 67 prerender_list_.pop_front();
68 data.contents_->set_final_status(FINAL_STATUS_MANAGER_SHUTDOWN); 68 data.contents_->set_final_status(FINAL_STATUS_MANAGER_SHUTDOWN);
69 delete data.contents_; 69 delete data.contents_;
70 } 70 }
71 } 71 }
72 72
73 void PrerenderManager::SetPrerenderContentsFactory( 73 void PrerenderManager::SetPrerenderContentsFactory(
74 PrerenderContents::Factory* prerender_contents_factory) { 74 PrerenderContents::Factory* prerender_contents_factory) {
75 prerender_contents_factory_.reset(prerender_contents_factory); 75 prerender_contents_factory_.reset(prerender_contents_factory);
(...skipping 25 matching lines...) Expand all
101 data = prerender_list_.front(); 101 data = prerender_list_.front();
102 prerender_list_.pop_front(); 102 prerender_list_.pop_front();
103 data.contents_->set_final_status(FINAL_STATUS_EVICTED); 103 data.contents_->set_final_status(FINAL_STATUS_EVICTED);
104 delete data.contents_; 104 delete data.contents_;
105 } 105 }
106 StartSchedulingPeriodicCleanups(); 106 StartSchedulingPeriodicCleanups();
107 return true; 107 return true;
108 } 108 }
109 109
110 void PrerenderManager::DeleteOldEntries() { 110 void PrerenderManager::DeleteOldEntries() {
111 while (prerender_list_.size() > 0) { 111 while (!prerender_list_.empty()) {
112 PrerenderContentsData data = prerender_list_.front(); 112 PrerenderContentsData data = prerender_list_.front();
113 if (IsPrerenderElementFresh(data.start_time_)) 113 if (IsPrerenderElementFresh(data.start_time_))
114 return; 114 return;
115 prerender_list_.pop_front(); 115 prerender_list_.pop_front();
116 data.contents_->set_final_status(FINAL_STATUS_TIMED_OUT); 116 data.contents_->set_final_status(FINAL_STATUS_TIMED_OUT);
117 delete data.contents_; 117 delete data.contents_;
118 } 118 }
119 if (prerender_list_.empty()) 119 if (prerender_list_.empty())
120 StopSchedulingPeriodicCleanups(); 120 StopSchedulingPeriodicCleanups();
121 } 121 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 302 }
303 for (std::vector<PrerenderContents*>::iterator it = 303 for (std::vector<PrerenderContents*>::iterator it =
304 prerender_contents.begin(); 304 prerender_contents.begin();
305 it != prerender_contents.end(); 305 it != prerender_contents.end();
306 ++it) { 306 ++it) {
307 (*it)->DestroyWhenUsingTooManyResources(); 307 (*it)->DestroyWhenUsingTooManyResources();
308 } 308 }
309 } 309 }
310 310
311 } // namespace prerender 311 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/plugin_exceptions_table_model_unittest.cc ('k') | chrome/browser/renderer_host/web_cache_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698