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

Issue 10905033: contacts: Add ContactMap class. (Closed)

Created:
8 years, 3 months ago by Daniel Erat
Modified:
8 years, 3 months ago
Reviewers:
satorux1, sky
CC:
chromium-reviews, derat+watch_chromium.org, oshima+watch_chromium.org, stevenjb+watch_chromium.org, nkostylev+watch_chromium.org, davemoore+watch_chromium.org, tfarina
Visibility:
Public.

Description

contacts: Add ContactMap class. This is a simple map from contact ID to Contact object. I'm moving the merging code from GoogleContactStore into it, and making both GoogleContactStore and FakeContactDatabase (which formerly had ugly code that used a vector of contacts) use it. A later change will make GoogleContactStore drop deleted contacts (hanging on to them indefinitely seems ugly). While working on that, I noticed that FakeContactDatabase's vector is lacking for supporting that and figured that it'd be best to make it share GoogleContactStore's existing merging code. BUG=128805 TEST=none TBR=sky@chromium.org Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=155634

Patch Set 1 #

Patch Set 2 : explicitly include string #

Total comments: 8

Patch Set 3 : merge #

Patch Set 4 : apply review feedback #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+298 lines, -78 lines) Patch
A chrome/browser/chromeos/contacts/contact_map.h View 1 2 3 1 chunk +72 lines, -0 lines 4 comments Download
A chrome/browser/chromeos/contacts/contact_map.cc View 1 2 3 1 chunk +68 lines, -0 lines 2 comments Download
A chrome/browser/chromeos/contacts/contact_map_unittest.cc View 1 2 3 1 chunk +107 lines, -0 lines 2 comments Download
M chrome/browser/chromeos/contacts/contact_test_util.h View 2 chunks +6 lines, -1 line 0 comments Download
M chrome/browser/chromeos/contacts/contact_test_util.cc View 2 chunks +10 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/contacts/fake_contact_database.h View 3 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/contacts/fake_contact_database.cc View 1 2 3 5 chunks +12 lines, -22 lines 0 comments Download
M chrome/browser/chromeos/contacts/google_contact_store.h View 3 chunks +1 line, -7 lines 0 comments Download
M chrome/browser/chromeos/contacts/google_contact_store.cc View 1 2 3 3 chunks +8 lines, -41 lines 0 comments Download
M chrome/browser/chromeos/contacts/google_contact_store_unittest.cc View 5 chunks +8 lines, -5 lines 0 comments Download
M chrome/chrome_browser_chromeos.gypi View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
Daniel Erat
8 years, 3 months ago (2012-08-30 23:25:33 UTC) #1
satorux1
LGTM with nits. sorry for the belated response. I'm back to work http://codereview.chromium.org/10905033/diff/4001/chrome/browser/chromeos/contacts/contact_map.cc File chrome/browser/chromeos/contacts/contact_map.cc ...
8 years, 3 months ago (2012-09-06 17:16:48 UTC) #2
Daniel Erat
Thanks! http://codereview.chromium.org/10905033/diff/4001/chrome/browser/chromeos/contacts/contact_map.cc File chrome/browser/chromeos/contacts/contact_map.cc (right): http://codereview.chromium.org/10905033/diff/4001/chrome/browser/chromeos/contacts/contact_map.cc#newcode25 chrome/browser/chromeos/contacts/contact_map.cc:25: void ContactMap::Merge(scoped_ptr<ScopedVector<Contact> > updated_contacts, On 2012/09/06 17:16:48, satorux1 ...
8 years, 3 months ago (2012-09-09 14:51:30 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/derat@chromium.org/10905033/4003
8 years, 3 months ago (2012-09-09 14:52:13 UTC) #4
commit-bot: I haz the power
Presubmit check for 10905033-4003 failed and returned exit status 1. Running presubmit commit checks ...
8 years, 3 months ago (2012-09-09 14:52:18 UTC) #5
Daniel Erat
TBR sky for *.gypi
8 years, 3 months ago (2012-09-09 14:53:35 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/derat@chromium.org/10905033/4003
8 years, 3 months ago (2012-09-09 14:53:51 UTC) #7
commit-bot: I haz the power
Change committed as 155634
8 years, 3 months ago (2012-09-09 18:23:25 UTC) #8
tfarina
https://chromiumcodereview.appspot.com/10905033/diff/4003/chrome/browser/chromeos/contacts/contact_map.h File chrome/browser/chromeos/contacts/contact_map.h (right): https://chromiumcodereview.appspot.com/10905033/diff/4003/chrome/browser/chromeos/contacts/contact_map.h#newcode48 chrome/browser/chromeos/contacts/contact_map.h:48: const Contact* Find(const std::string& contact_id) const; nit: may be ...
8 years, 3 months ago (2012-09-09 19:01:10 UTC) #9
tfarina
https://chromiumcodereview.appspot.com/10905033/diff/4003/chrome/browser/chromeos/contacts/contact_map_unittest.cc File chrome/browser/chromeos/contacts/contact_map_unittest.cc (right): https://chromiumcodereview.appspot.com/10905033/diff/4003/chrome/browser/chromeos/contacts/contact_map_unittest.cc#newcode17 chrome/browser/chromeos/contacts/contact_map_unittest.cc:17: typedef testing::Test ContactMapTest; this is not necessary if you ...
8 years, 3 months ago (2012-09-09 19:04:29 UTC) #10
tfarina
https://chromiumcodereview.appspot.com/10905033/diff/4003/chrome/browser/chromeos/contacts/contact_map.cc File chrome/browser/chromeos/contacts/contact_map.cc (right): https://chromiumcodereview.appspot.com/10905033/diff/4003/chrome/browser/chromeos/contacts/contact_map.cc#newcode22 chrome/browser/chromeos/contacts/contact_map.cc:22: contacts_.clear(); STLDeleteValues already does this for you, no?
8 years, 3 months ago (2012-09-09 19:20:49 UTC) #11
Daniel Erat
8 years, 3 months ago (2012-09-10 15:01:43 UTC) #12
https://chromiumcodereview.appspot.com/10905033/diff/4003/chrome/browser/chro...
File chrome/browser/chromeos/contacts/contact_map.cc (right):

https://chromiumcodereview.appspot.com/10905033/diff/4003/chrome/browser/chro...
chrome/browser/chromeos/contacts/contact_map.cc:22: contacts_.clear();
On 2012/09/09 19:20:49, tfarina wrote:
> STLDeleteValues already does this for you, no?

Thanks, this was unexpected to me.  Done.

https://chromiumcodereview.appspot.com/10905033/diff/4003/chrome/browser/chro...
File chrome/browser/chromeos/contacts/contact_map.h (right):

https://chromiumcodereview.appspot.com/10905033/diff/4003/chrome/browser/chro...
chrome/browser/chromeos/contacts/contact_map.h:48: const Contact* Find(const
std::string& contact_id) const;
On 2012/09/09 19:01:10, tfarina wrote:
> nit: may be GetContactById?

Since this is really just a glorified wrapper around STL map, I prefer using the
same method names.

https://chromiumcodereview.appspot.com/10905033/diff/4003/chrome/browser/chro...
chrome/browser/chromeos/contacts/contact_map.h:51: void Clear();
On 2012/09/09 19:01:10, tfarina wrote:
> nit: may be DeleteAll()?

Same here.

https://chromiumcodereview.appspot.com/10905033/diff/4003/chrome/browser/chro...
File chrome/browser/chromeos/contacts/contact_map_unittest.cc (right):

https://chromiumcodereview.appspot.com/10905033/diff/4003/chrome/browser/chro...
chrome/browser/chromeos/contacts/contact_map_unittest.cc:17: typedef
testing::Test ContactMapTest;
On 2012/09/09 19:04:29, tfarina wrote:
> this is not necessary if you use TEST() macro!

Thanks, done.

Powered by Google App Engine
This is Rietveld 408576698