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

Side by Side Diff: chrome/browser/safe_browsing/client_side_model_loader.cc

Issue 1548133002: Switch to standard integer types in chrome/browser/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
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/safe_browsing/client_side_model_loader.h" 5 #include "chrome/browser/safe_browsing/client_side_model_loader.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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // We're adding 60s of additional delay to make sure we're past 180 // We're adding 60s of additional delay to make sure we're past
181 // the model's age. 181 // the model's age.
182 max_age += base::TimeDelta::FromMinutes(1); 182 max_age += base::TimeDelta::FromMinutes(1);
183 delay_ms = max_age.InMilliseconds(); 183 delay_ms = max_age.InMilliseconds();
184 } 184 }
185 185
186 // Schedule the next model reload. 186 // Schedule the next model reload.
187 ScheduleFetch(delay_ms); 187 ScheduleFetch(delay_ms);
188 } 188 }
189 189
190 void ModelLoader::ScheduleFetch(int64 delay_ms) { 190 void ModelLoader::ScheduleFetch(int64_t delay_ms) {
191 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 191 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
192 switches::kSbDisableAutoUpdate)) 192 switches::kSbDisableAutoUpdate))
193 return; 193 return;
194 base::MessageLoop::current()->PostDelayedTask( 194 base::MessageLoop::current()->PostDelayedTask(
195 FROM_HERE, 195 FROM_HERE,
196 base::Bind(&ModelLoader::StartFetch, weak_factory_.GetWeakPtr()), 196 base::Bind(&ModelLoader::StartFetch, weak_factory_.GetWeakPtr()),
197 base::TimeDelta::FromMilliseconds(delay_ms)); 197 base::TimeDelta::FromMilliseconds(delay_ms));
198 } 198 }
199 199
200 void ModelLoader::CancelFetcher() { 200 void ModelLoader::CancelFetcher() {
201 // Invalidate any scheduled request. 201 // Invalidate any scheduled request.
202 weak_factory_.InvalidateWeakPtrs(); 202 weak_factory_.InvalidateWeakPtrs();
203 // Cancel any request in progress. 203 // Cancel any request in progress.
204 fetcher_.reset(); 204 fetcher_.reset();
205 } 205 }
206 206
207 } // namespace safe_browsing 207 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698