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

Side by Side Diff: chrome/browser/chromeos/contacts/contact_database.cc

Issue 10896031: contacts: Add ContactManagerInterface::GetWeakPtr(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: apply review feedback Created 8 years, 3 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 | « no previous file | chrome/browser/chromeos/contacts/contact_database_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/chromeos/contacts/contact_database.h" 5 #include "chrome/browser/chromeos/contacts/contact_database.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 213 }
214 214
215 void ContactDatabase::SaveContactsFromTaskRunner( 215 void ContactDatabase::SaveContactsFromTaskRunner(
216 scoped_ptr<ContactPointers> contacts, 216 scoped_ptr<ContactPointers> contacts,
217 scoped_ptr<UpdateMetadata> metadata, 217 scoped_ptr<UpdateMetadata> metadata,
218 bool is_full_update, 218 bool is_full_update,
219 bool* success) { 219 bool* success) {
220 DCHECK(IsRunByTaskRunner()); 220 DCHECK(IsRunByTaskRunner());
221 DCHECK(success); 221 DCHECK(success);
222 VLOG(1) << "Saving " << contacts->size() << " contact(s) to database as " 222 VLOG(1) << "Saving " << contacts->size() << " contact(s) to database as "
223 << (is_full_update ? "full" : "partial") << " update"; 223 << (is_full_update ? "full" : "incremental") << " update";
224 224
225 *success = false; 225 *success = false;
226 226
227 // If we're doing a full update, find all of the existing keys first so we can 227 // If we're doing a full update, find all of the existing keys first so we can
228 // delete ones that aren't present in the new set of contacts. 228 // delete ones that aren't present in the new set of contacts.
229 std::set<std::string> keys_to_delete; 229 std::set<std::string> keys_to_delete;
230 if (is_full_update) { 230 if (is_full_update) {
231 leveldb::ReadOptions options; 231 leveldb::ReadOptions options;
232 scoped_ptr<leveldb::Iterator> db_iterator(db_->NewIterator(options)); 232 scoped_ptr<leveldb::Iterator> db_iterator(db_->NewIterator(options));
233 db_iterator->SeekToFirst(); 233 db_iterator->SeekToFirst();
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 db_iterator->Next(); 324 db_iterator->Next();
325 } 325 }
326 326
327 *success = true; 327 *success = true;
328 UMA_HISTOGRAM_ENUMERATION("Contacts.DatabaseLoadResult", 328 UMA_HISTOGRAM_ENUMERATION("Contacts.DatabaseLoadResult",
329 HISTOGRAM_LOAD_RESULT_SUCCESS, 329 HISTOGRAM_LOAD_RESULT_SUCCESS,
330 HISTOGRAM_LOAD_RESULT_MAX_VALUE); 330 HISTOGRAM_LOAD_RESULT_MAX_VALUE);
331 } 331 }
332 332
333 } // namespace contacts 333 } // namespace contacts
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/contacts/contact_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698