Home | History | Annotate | Download | only in syncable

Lines Matching refs:kernel_

274   DCHECK(kernel_ == NULL);
275 kernel_ = new Kernel(FilePath(), name, KernelLoadInfo());
349 Directory::Directory() : kernel_(NULL), store_(NULL) {
364 MetahandlesIndex::iterator it = kernel_->metahandles_index->begin();
365 for (; it != kernel_->metahandles_index->end(); ++it) {
368 kernel_->parent_id_child_index);
369 InitializeIndexEntry<IdIndexer>(entry, kernel_->ids_index);
370 InitializeIndexEntry<ClientTagIndexer>(entry, kernel_->client_tag_index);
372 kernel_->unsynced_metahandles->insert(entry->ref(META_HANDLE));
374 kernel_->unapplied_update_metahandles->insert(entry->ref(META_HANDLE));
392 // Temporary indices before kernel_ initialized in case Load fails. We 0(1)
399 kernel_ = new Kernel(db_path, name, info);
400 kernel_->metahandles_index->swap(metas_bucket);
409 if (kernel_) {
410 bool del = !base::subtle::NoBarrier_AtomicIncrement(&kernel_->refcount, -1);
413 delete kernel_;
414 kernel_ = NULL;
425 DCHECK(kernel_);
427 kernel_->needle.put(ID, id);
428 IdsIndex::iterator id_found = kernel_->ids_index->find(&kernel_->needle);
429 if (id_found != kernel_->ids_index->end()) {
437 DCHECK(kernel_);
439 kernel_->needle.put(UNIQUE_CLIENT_TAG, tag);
440 ClientTagIndex::iterator found = kernel_->client_tag_index->find(
441 &kernel_->needle);
442 if (found != kernel_->client_tag_index->end()) {
450 DCHECK(kernel_);
456 MetahandlesIndex& set = *kernel_->metahandles_index;
473 kernel_->needle.put(META_HANDLE, metahandle);
475 kernel_->metahandles_index->find(&kernel_->needle);
476 if (found != kernel_->metahandles_index->end()) {
528 CHECK(kernel_->metahandles_index->insert(entry).second) << error;
531 CHECK(kernel_->parent_id_child_index->insert(entry).second) << error;
533 CHECK(kernel_->ids_index->insert(entry).second) << error;
546 ScopedIndexUpdater<IdIndexer> updater_a(lock, entry, kernel_->ids_index);
548 kernel_->parent_id_child_index);
561 kernel_->parent_id_child_index);
567 kernel_->transaction_mutex.AssertAcquired();
568 kernel_->dirty_metahandles->clear();
578 CHECK_EQ(kernel_->dirty_metahandles->count(handle), 0U);
580 CHECK(!kernel_->unsynced_metahandles->count(handle));
581 CHECK(!kernel_->unapplied_update_metahandles->count(handle));
590 // Deep copy dirty entries from kernel_->metahandles_index into snapshot and
593 for (MetahandleSet::const_iterator i = kernel_->dirty_metahandles->begin();
594 i != kernel_->dirty_metahandles->end(); ++i) {
602 DCHECK_EQ(1U, kernel_->dirty_metahandles->count(*i));
611 snapshot->metahandles_to_purge.swap(*(kernel_->metahandles_to_purge));
614 snapshot->kernel_info = kernel_->persisted_info;
620 snapshot->kernel_info_status = kernel_->info_status;
622 kernel_->info_status = KERNEL_SHARE_INFO_VALID;
629 base::AutoLock scoped_lock(kernel_->save_changes_mutex);
648 kernel_->flushed_metahandles.Push(0); // Begin flush marker
652 kernel_->needle.put(META_HANDLE, i->ref(META_HANDLE));
654 kernel_->metahandles_index->find(&kernel_->needle);
655 EntryKernel* entry = (found == kernel_->metahandles_index->end() ?
662 kernel_->flushed_metahandles.Push(handle);
663 num_erased = kernel_->ids_index->erase(entry);
665 num_erased = kernel_->metahandles_index->erase(entry);
669 num_erased = kernel_->client_tag_index->erase(entry);
671 CHECK(!kernel_->parent_id_child_index->count(entry));
690 MetahandlesIndex::iterator it = kernel_->metahandles_index->begin();
691 while (it != kernel_->metahandles_index->end()) {
702 kernel_->metahandles_to_purge->insert(handle);
706 num_erased = kernel_->ids_index->erase(entry);
708 num_erased = kernel_->client_tag_index->erase(entry);
710 num_erased = kernel_->unsynced_metahandles->erase(handle);
712 num_erased = kernel_->unapplied_update_metahandles->erase(handle);
714 num_erased = kernel_->parent_id_child_index->erase(entry);
716 kernel_->metahandles_index->erase(it++);
727 kernel_->persisted_info.reset_download_progress(*it);
735 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
744 kernel_->needle.put(META_HANDLE, i->ref(META_HANDLE));
746 kernel_->metahandles_index->find(&kernel_->needle);
747 if (found != kernel_->metahandles_index->end()) {
748 (*found)->mark_dirty(kernel_->dirty_metahandles);
752 kernel_->metahandles_to_purge->insert(snapshot.metahandles_to_purge.begin(),
761 kernel_->persisted_info.download_progress[model_type]);
768 kernel_->persisted_info.download_progress[model_type].SerializeToString(
776 kernel_->persisted_info.download_progress[model_type].CopyFrom(new_progress);
777 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
782 return kernel_->persisted_info.initial_sync_ended[type];
787 return kernel_->persisted_info.autofill_migration_state;
793 return kernel_->persisted_info.autofill_migration_debug_info;
800 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
812 debug_info = kernel_->persisted_info.autofill_migration_debug_info;
820 kernel_->persisted_info.autofill_migration_debug_info;
828 kernel_->persisted_info.autofill_migration_debug_info;
841 if (state == kernel_->persisted_info.autofill_migration_state) {
844 kernel_->persisted_info.autofill_migration_state = state;
847 kernel_->persisted_info.autofill_migration_debug_info;
851 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
861 if (kernel_->persisted_info.initial_sync_ended[type] == x)
863 kernel_->persisted_info.initial_sync_ended.set(type, x);
864 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
869 if (notification_state == kernel_->persisted_info.notification_state)
871 kernel_->persisted_info.notification_state = notification_state;
872 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
877 return kernel_->persisted_info.store_birthday;
882 if (kernel_->persisted_info.store_birthday == store_birthday)
884 kernel_->persisted_info.store_birthday = store_birthday;
885 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
890 std::string notification_state = kernel_->persisted_info.notification_state;
902 return kernel_->cache_guid;
910 for (i = kernel_->metahandles_index->begin();
911 i != kernel_->metahandles_index->end();
921 copy(kernel_->unsynced_metahandles->begin(),
922 kernel_->unsynced_metahandles->end(), back_inserter(*result));
927 return kernel_->unsynced_metahandles->size();
934 copy(kernel_->unapplied_update_metahandles->begin(),
935 kernel_->unapplied_update_metahandles->end(),
1090 DCHECK(!kernel_->change_listener_);
1091 kernel_->change_listener_ = listener;
1098 : scoped_lock_(dir->kernel_->mutex), dir_(const_cast<Directory*>(dir)) {
1123 : directory_(directory), dirkernel_(directory->kernel_), name_(name),
1259 kernel_ = trans->directory()->GetEntryById(id);
1264 kernel_ = trans->directory()->GetEntryByClientTag(tag);
1269 kernel_ = trans->directory()->GetEntryByServerTag(tag);
1274 kernel_ = trans->directory()->GetEntryByHandle(metahandle);
1282 return dir()->ComputePrevIdFromServerPosition(kernel_, parent_id);
1289 entry_info->Set("kernel", kernel_->ToValue());
1304 DCHECK(kernel_);
1305 return kernel_->ref(field);
1366 kernel_ = new EntryKernel;
1367 ZeroFields(kernel_, BEGIN_FIELDS);
1368 kernel_->put(ID, trans->directory_->NextId());
1369 kernel_->put(META_HANDLE, trans->directory_->NextMetahandle());
1370 kernel_->mark_dirty(trans->directory_->kernel_->dirty_metahandles);
1371 kernel_->put(PARENT_ID, parent_id);
1372 kernel_->put(NON_UNIQUE_NAME, name);
1374 kernel_->put(CTIME, now);
1375 kernel_->put(MTIME, now);
1377 kernel_->put(BASE_VERSION, CHANGES_VERSION);
1378 trans->directory()->InsertEntry(kernel_);
1380 kernel_->put(IS_DEL, true);
1381 trans->SaveOriginal(kernel_);
1382 kernel_->put(IS_DEL, false);
1390 kernel_ = NULL; // already have an item with this ID.
1393 kernel_ = new EntryKernel;
1394 ZeroFields(kernel_, BEGIN_FIELDS);
1395 kernel_->put(ID, id);
1396 kernel_->put(META_HANDLE, trans->directory_->NextMetahandle());
1397 kernel_->mark_dirty(trans->directory_->kernel_->dirty_metahandles);
1398 kernel_->put(IS_DEL, true);
1400 kernel_->put(BASE_VERSION, CHANGES_VERSION);
1401 trans->directory()->InsertEntry(kernel_);
1402 trans->SaveOriginal(kernel_);
1407 trans->SaveOriginal(kernel_);
1413 trans->SaveOriginal(kernel_);
1419 trans->SaveOriginal(kernel_);
1425 trans->SaveOriginal(kernel_);
1429 DCHECK(kernel_);
1430 if (is_del == kernel_->ref(IS_DEL)) {
1440 ScopedIndexUpdater<ParentIdAndHandleIndexer> updater(lock, kernel_,
1441 dir()->kernel_->parent_id_child_index);
1443 kernel_->put(IS_DEL, is_del);
1444 kernel_->mark_dirty(dir()->kernel_->dirty_metahandles);
1454 DCHECK(kernel_);
1455 if (kernel_->ref(field) != value) {
1458 ScopedIndexUpdater<ParentIdAndHandleIndexer> updater(lock, kernel_,
1459 dir()->kernel_->parent_id_child_index);
1460 kernel_->put(field, value);
1462 kernel_->put(field, value);
1464 kernel_->mark_dirty(dir()->kernel_->dirty_metahandles);
1470 DCHECK(kernel_);
1471 if (kernel_->ref(field) != value) {
1473 if (!dir()->ReindexId(kernel_, value))
1479 kernel_->put(field, value);
1481 kernel_->mark_dirty(dir()->kernel_->dirty_metahandles);
1487 dir()->ReindexParentId(kernel_, parent_id);
1488 kernel_->mark_dirty(dir()->kernel_->dirty_metahandles);
1492 DCHECK(kernel_);
1493 if (kernel_->ref(field) != value) {
1494 kernel_->put(field, value);
1495 kernel_->mark_dirty(dir()->kernel_->dirty_metahandles);
1506 DCHECK(kernel_);
1509 if (kernel_->ref(field).SerializeAsString() != value.SerializeAsString()) {
1510 kernel_->put(field, value);
1511 kernel_->mark_dirty(dir()->kernel_->dirty_metahandles);
1517 DCHECK(kernel_);
1518 if (kernel_->ref(field) != value) {
1519 kernel_->put(field, value);
1520 kernel_->mark_dirty(GetDirtyIndexHelper());
1526 return dir()->kernel_->dirty_metahandles;
1531 string old_tag = kernel_->ref(UNIQUE_CLIENT_TAG);
1539 EntryKernel lookup_kernel_ = *kernel_;
1542 (dir()->kernel_->client_tag_index->count(&lookup_kernel_) > 0);
1549 ScopedIndexUpdater<ClientTagIndexer> index_updater(lock, kernel_,
1550 dir()->kernel_->client_tag_index);
1551 kernel_->put(UNIQUE_CLIENT_TAG, new_tag);
1552 kernel_->mark_dirty(dir()->kernel_->dirty_metahandles);
1558 DCHECK(kernel_);
1563 if (kernel_->ref(field) != value) {
1564 kernel_->put(field, value);
1565 kernel_->mark_dirty(dir()->kernel_->dirty_metahandles);
1571 DCHECK(kernel_);
1572 if (kernel_->ref(field) != value) {
1575 index = dir()->kernel_->unsynced_metahandles;
1577 index = dir()->kernel_->unapplied_update_metahandles;
1581 CHECK(index->insert(kernel_->ref(META_HANDLE)).second);
1583 CHECK_EQ(1U, index->erase(kernel_->ref(META_HANDLE)));
1584 kernel_->put(field, value);
1585 kernel_->mark_dirty(dir()->kernel_->dirty_metahandles);
1592 dir()->UnlinkEntryFromOrder(kernel_, write_transaction(), &lock);
1604 entry->mark_dirty(kernel_->dirty_metahandles);
1619 previous_entry->mark_dirty(kernel_->dirty_metahandles);
1628 next_entry->mark_dirty(kernel_->dirty_metahandles);
1678 DCHECK(kernel_);
1679 kernel_->put(field, value);
1688 int64 metahandle = (kernel_->next_metahandle)++;
1698 result = (kernel_->persisted_info.next_id)--;
1699 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
1836 EntryKernel* const kernel = entry.kernel_;
1880 kernel_->needle.put(PARENT_ID, parent_id);
1881 kernel_->needle.put(SERVER_POSITION_IN_PARENT, position_in_parent);
1882 kernel_->needle.put(ID, item_id_for_tiebreaking);
1883 return kernel_->parent_id_child_index->lower_bound(&kernel_->needle);