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

Side by Side Diff: sync/syncable/directory.cc

Issue 10916174: Implement a bag of chips for sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 "sync/syncable/directory.h" 5 #include "sync/syncable/directory.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/perftimer.h" 8 #include "base/perftimer.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 } 703 }
704 704
705 void Directory::set_store_birthday(const string& store_birthday) { 705 void Directory::set_store_birthday(const string& store_birthday) {
706 ScopedKernelLock lock(this); 706 ScopedKernelLock lock(this);
707 if (kernel_->persisted_info.store_birthday == store_birthday) 707 if (kernel_->persisted_info.store_birthday == store_birthday)
708 return; 708 return;
709 kernel_->persisted_info.store_birthday = store_birthday; 709 kernel_->persisted_info.store_birthday = store_birthday;
710 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY; 710 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
711 } 711 }
712 712
713 string Directory::bag_of_chips() const {
714 ScopedKernelLock lock(this);
715 return kernel_->persisted_info.bag_of_chips;
716 }
717
718 void Directory::set_bag_of_chips(const string& bag_of_chips) {
719 ScopedKernelLock lock(this);
720 if (kernel_->persisted_info.bag_of_chips == bag_of_chips)
721 return;
722 kernel_->persisted_info.bag_of_chips = bag_of_chips;
723 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
724 }
725
713 std::string Directory::GetNotificationState() const { 726 std::string Directory::GetNotificationState() const {
714 ScopedKernelLock lock(this); 727 ScopedKernelLock lock(this);
715 std::string notification_state = kernel_->persisted_info.notification_state; 728 std::string notification_state = kernel_->persisted_info.notification_state;
716 return notification_state; 729 return notification_state;
717 } 730 }
718 731
719 void Directory::SetNotificationState(const std::string& notification_state) { 732 void Directory::SetNotificationState(const std::string& notification_state) {
720 ScopedKernelLock lock(this); 733 ScopedKernelLock lock(this);
721 SetNotificationStateUnsafe(notification_state); 734 SetNotificationStateUnsafe(notification_state);
722 } 735 }
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 // There were no children in the linked list. 1234 // There were no children in the linked list.
1222 return NULL; 1235 return NULL;
1223 } 1236 }
1224 1237
1225 ScopedKernelLock::ScopedKernelLock(const Directory* dir) 1238 ScopedKernelLock::ScopedKernelLock(const Directory* dir)
1226 : scoped_lock_(dir->kernel_->mutex), dir_(const_cast<Directory*>(dir)) { 1239 : scoped_lock_(dir->kernel_->mutex), dir_(const_cast<Directory*>(dir)) {
1227 } 1240 }
1228 1241
1229 } // namespace syncable 1242 } // namespace syncable
1230 } // namespace syncer 1243 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698