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

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

Issue 776903002: Cleanup: Remove some unneeded string allocations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win Created 6 years 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 // 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
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 563
564 // Make sure we don't access disk outside of the I/O thread. 564 // Make sure we don't access disk outside of the I/O thread.
565 // In such case we repost the task on the right thread and return error. 565 // In such case we repost the task on the right thread and return error.
566 if (ScheduleGetAccessPointRlz(point)) 566 if (ScheduleGetAccessPointRlz(point))
567 return false; 567 return false;
568 568
569 char str_rlz[rlz_lib::kMaxRlzLength + 1]; 569 char str_rlz[rlz_lib::kMaxRlzLength + 1];
570 if (!rlz_lib::GetAccessPointRlz(point, str_rlz, rlz_lib::kMaxRlzLength)) 570 if (!rlz_lib::GetAccessPointRlz(point, str_rlz, rlz_lib::kMaxRlzLength))
571 return false; 571 return false;
572 572
573 base::string16 rlz_local(base::ASCIIToUTF16(std::string(str_rlz))); 573 base::string16 rlz_local(base::ASCIIToUTF16(str_rlz));
574 if (rlz) 574 if (rlz)
575 *rlz = rlz_local; 575 *rlz = rlz_local;
576 576
577 base::AutoLock lock(cache_lock_); 577 base::AutoLock lock(cache_lock_);
578 rlz_cache_[point] = rlz_local; 578 rlz_cache_[point] = rlz_local;
579 return true; 579 return true;
580 } 580 }
581 581
582 bool RLZTracker::ScheduleGetAccessPointRlz(rlz_lib::AccessPoint point) { 582 bool RLZTracker::ScheduleGetAccessPointRlz(rlz_lib::AccessPoint point) {
583 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) 583 if (!BrowserThread::CurrentlyOn(BrowserThread::UI))
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 void RLZTracker::EnableZeroDelayForTesting() { 630 void RLZTracker::EnableZeroDelayForTesting() {
631 GetInstance()->min_init_delay_ = base::TimeDelta(); 631 GetInstance()->min_init_delay_ = base::TimeDelta();
632 } 632 }
633 633
634 #if !defined(OS_IOS) 634 #if !defined(OS_IOS)
635 // static 635 // static
636 void RLZTracker::RecordAppListSearch() { 636 void RLZTracker::RecordAppListSearch() {
637 GetInstance()->RecordFirstSearch(RLZTracker::ChromeAppList()); 637 GetInstance()->RecordFirstSearch(RLZTracker::ChromeAppList());
638 } 638 }
639 #endif 639 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698