Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / sync / syncable / in_memory_directory_backing_store.cc
blob6e847eedbe93aa04b19ee7b053bc89ab9c1d317d
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
3 // found in the LICENSE file.
5 #include "sync/syncable/in_memory_directory_backing_store.h"
7 namespace syncer {
8 namespace syncable {
10 InMemoryDirectoryBackingStore::InMemoryDirectoryBackingStore(
11 const std::string& dir_name)
12 : DirectoryBackingStore(dir_name),
13 consistent_cache_guid_requested_(false) {
16 DirOpenResult InMemoryDirectoryBackingStore::Load(
17 Directory::MetahandlesMap* handles_map,
18 JournalIndex* delete_journals,
19 MetahandleSet* metahandles_to_purge,
20 Directory::KernelLoadInfo* kernel_load_info) {
21 if (!IsOpen()) {
22 if (!OpenInMemory())
23 return FAILED_OPEN_DATABASE;
26 if (!InitializeTables())
27 return FAILED_OPEN_DATABASE;
29 if (consistent_cache_guid_requested_) {
30 if (!db()->Execute(
31 "UPDATE share_info "
32 "SET cache_guid = 'IrcjZ2jyzHDV9Io4+zKcXQ=='")) {
33 return FAILED_OPEN_DATABASE;
37 if (!LoadEntries(handles_map, metahandles_to_purge))
38 return FAILED_DATABASE_CORRUPT;
39 if (!LoadDeleteJournals(delete_journals))
40 return FAILED_DATABASE_CORRUPT;
41 if (!LoadInfo(kernel_load_info))
42 return FAILED_DATABASE_CORRUPT;
43 if (!VerifyReferenceIntegrity(handles_map))
44 return FAILED_DATABASE_CORRUPT;
46 return OPENED;
49 } // namespace syncable
50 } // namespace syncer