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

Side by Side Diff: chrome/browser/search_engines/template_url_service.cc

Issue 10827319: Fix a memory leak in TemplateURLServiceSyncTest. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: init Created 8 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/search_engines/template_url_service_sync_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) 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/search_engines/template_url_service.h" 5 #include "chrome/browser/search_engines/template_url_service.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 2356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2367 2367
2368 TemplateURL* conflicting_turl = 2368 TemplateURL* conflicting_turl =
2369 FindNonExtensionTemplateURLForKeyword(sync_turl->keyword()); 2369 FindNonExtensionTemplateURLForKeyword(sync_turl->keyword());
2370 bool should_add_sync_turl = true; 2370 bool should_add_sync_turl = true;
2371 2371
2372 // If there was no TemplateURL in the local model that conflicts with 2372 // If there was no TemplateURL in the local model that conflicts with
2373 // |sync_turl|, skip the following preparation steps and just add |sync_turl| 2373 // |sync_turl|, skip the following preparation steps and just add |sync_turl|
2374 // directly. Otherwise, modify |conflicting_turl| to make room for 2374 // directly. Otherwise, modify |conflicting_turl| to make room for
2375 // |sync_turl|. 2375 // |sync_turl|.
2376 if (conflicting_turl) { 2376 if (conflicting_turl) {
2377 DCHECK(conflicting_turl);
2378
2379 if (IsFromSync(conflicting_turl, sync_data)) { 2377 if (IsFromSync(conflicting_turl, sync_data)) {
2380 // |conflicting_turl| is already known to Sync, so we're not allowed to 2378 // |conflicting_turl| is already known to Sync, so we're not allowed to
2381 // remove it. In this case, we want to uniquify the worse one and send an 2379 // remove it. In this case, we want to uniquify the worse one and send an
2382 // update for the changed keyword to sync. We can reuse the logic from 2380 // update for the changed keyword to sync. We can reuse the logic from
2383 // ResolveSyncKeywordConflict for this. 2381 // ResolveSyncKeywordConflict for this.
2384 ResolveSyncKeywordConflict(sync_turl, conflicting_turl, change_list); 2382 ResolveSyncKeywordConflict(sync_turl, conflicting_turl, change_list);
2385 } else { 2383 } else {
2386 // |conflicting_turl| is not yet known to Sync. If it is better, then we 2384 // |conflicting_turl| is not yet known to Sync. If it is better, then we
2387 // want to transfer its values up to sync. Otherwise, we remove it and 2385 // want to transfer its values up to sync. Otherwise, we remove it and
2388 // allow the entry from Sync to overtake it in the model. 2386 // allow the entry from Sync to overtake it in the model.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 // TODO(mpcomplete): If we allow editing extension keywords, then those 2473 // TODO(mpcomplete): If we allow editing extension keywords, then those
2476 // should be persisted to disk and synced. 2474 // should be persisted to disk and synced.
2477 if (template_url->sync_guid().empty() && 2475 if (template_url->sync_guid().empty() &&
2478 !template_url->IsExtensionKeyword()) { 2476 !template_url->IsExtensionKeyword()) {
2479 template_url->data_.sync_guid = base::GenerateGUID(); 2477 template_url->data_.sync_guid = base::GenerateGUID();
2480 if (service_.get()) 2478 if (service_.get())
2481 service_->UpdateKeyword(template_url->data()); 2479 service_->UpdateKeyword(template_url->data());
2482 } 2480 }
2483 } 2481 }
2484 } 2482 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/search_engines/template_url_service_sync_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698