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

Side by Side Diff: chrome/browser/rlz/rlz.cc

Issue 9404021: rlz: Remove #include <windows.h> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 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
« no previous file with comments | « chrome/browser/rlz/rlz.h ('k') | chrome/browser/rlz/rlz_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This code glues the RLZ library DLL with Chrome. It allows Chrome to work 5 // This code glues the RLZ library DLL with Chrome. It allows Chrome to work
6 // with or without the DLL being present. If the DLL is not present the 6 // with or without the DLL being present. If the DLL is not present the
7 // functions do nothing and just return false. 7 // functions do nothing and just return false.
8 8
9 #include "chrome/browser/rlz/rlz.h" 9 #include "chrome/browser/rlz/rlz.h"
10 10
11 #include <windows.h>
12 #include <process.h>
13
14 #include <algorithm> 11 #include <algorithm>
15 12
16 #include "base/bind.h" 13 #include "base/bind.h"
17 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
18 #include "base/file_path.h" 15 #include "base/file_path.h"
19 #include "base/message_loop.h" 16 #include "base/message_loop.h"
20 #include "base/path_service.h" 17 #include "base/path_service.h"
21 #include "base/string_util.h" 18 #include "base/string_util.h"
22 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
23 #include "base/threading/thread.h" 20 #include "base/threading/thread.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 schedule_ping = true; 221 schedule_ping = true;
225 } 222 }
226 223
227 already_ran_ = true; 224 already_ran_ = true;
228 225
229 if (schedule_ping) 226 if (schedule_ping)
230 ScheduleFinancialPing(); 227 ScheduleFinancialPing();
231 } 228 }
232 229
233 void RLZTracker::ScheduleFinancialPing() { 230 void RLZTracker::ScheduleFinancialPing() {
234 // Investigate why _beginthread() is used here, and not chrome's threading 231 // TODO(thakis): Once akalin's TaskRunner around PostDelayedTask() is done,
235 // API. Tracked in bug http://crbug.com/106213 232 // use that instead of the file thread.
236 _beginthread(PingNow, 0, this); 233 BrowserThread::PostTask(
237 } 234 BrowserThread::FILE,
238 235 FROM_HERE,
239 // static 236 base::Bind(&RLZTracker::PingNowImpl, base::Unretained(this)));
akalin 2012/02/16 01:03:36 does PingNowImpl actually depend on instance varia
Nico 2012/02/16 01:11:47 Yes, it seems to look at cache_lock_. The instance
240 void _cdecl RLZTracker::PingNow(void* arg) {
241 RLZTracker* tracker = reinterpret_cast<RLZTracker*>(arg);
242 tracker->PingNowImpl();
243 } 237 }
244 238
245 void RLZTracker::PingNowImpl() { 239 void RLZTracker::PingNowImpl() {
246 // This is the entry point of a background thread, so I/O is allowed. 240 // This is the entry point of a background thread, so I/O is allowed.
akalin 2012/02/16 01:03:36 update this comment, although is the allow_io stil
Nico 2012/02/16 01:11:47 Guess not. Done.
247 base::ThreadRestrictions::ScopedAllowIO allow_io; 241 base::ThreadRestrictions::ScopedAllowIO allow_io;
248 242
249 string16 lang; 243 string16 lang;
250 GoogleUpdateSettings::GetLanguage(&lang); 244 GoogleUpdateSettings::GetLanguage(&lang);
251 if (lang.empty()) 245 if (lang.empty())
252 lang = L"en"; 246 lang = L"en";
253 string16 referral; 247 string16 referral;
254 GoogleUpdateSettings::GetReferral(&referral); 248 GoogleUpdateSettings::GetReferral(&referral);
255 249
256 std::string brand; 250 std::string brand;
257 if (google_util::GetBrand(&brand) && !IsBrandOrganic(brand) && 251 if (google_util::GetBrand(&brand) && !IsBrandOrganic(brand) &&
258 SendFinancialPing(brand, lang, referral)) { 252 SendFinancialPing(brand, lang, referral)) {
akalin 2012/02/16 01:08:25 does this do network IO or file IO? If it's netwo
Nico 2012/02/16 01:13:31 I believe this accesses the registry behind the sc
259 GoogleUpdateSettings::ClearReferral(); 253 GoogleUpdateSettings::ClearReferral();
260 254
261 { 255 {
262 base::AutoLock lock(cache_lock_); 256 base::AutoLock lock(cache_lock_);
263 rlz_cache_.clear(); 257 rlz_cache_.clear();
264 } 258 }
265 259
266 // Prime the RLZ cache for the access points we are interested in. 260 // Prime the RLZ cache for the access points we are interested in.
267 GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, NULL); 261 GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, NULL);
268 GetAccessPointRlz(rlz_lib::CHROME_HOME_PAGE, NULL); 262 GetAccessPointRlz(rlz_lib::CHROME_HOME_PAGE, NULL);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 base::Bind(base::IgnoreResult(&RLZTracker::GetAccessPointRlz), point, 396 base::Bind(base::IgnoreResult(&RLZTracker::GetAccessPointRlz), point,
403 not_used)); 397 not_used));
404 return true; 398 return true;
405 } 399 }
406 400
407 // static 401 // static
408 void RLZTracker::CleanupRlz() { 402 void RLZTracker::CleanupRlz() {
409 GetInstance()->rlz_cache_.clear(); 403 GetInstance()->rlz_cache_.clear();
410 GetInstance()->registrar_.RemoveAll(); 404 GetInstance()->registrar_.RemoveAll();
411 } 405 }
OLDNEW
« no previous file with comments | « chrome/browser/rlz/rlz.h ('k') | chrome/browser/rlz/rlz_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698