| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/sync/syncable/syncable.h" | 5 #include "chrome/browser/sync/syncable/syncable.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 DCHECK_EQ(static_cast<DirectoryBackingStore*>(NULL), store_); | 253 DCHECK_EQ(static_cast<DirectoryBackingStore*>(NULL), store_); |
| 254 FilePath db_path(file_path); | 254 FilePath db_path(file_path); |
| 255 file_util::AbsolutePath(&db_path); | 255 file_util::AbsolutePath(&db_path); |
| 256 store_ = CreateBackingStore(name, db_path); | 256 store_ = CreateBackingStore(name, db_path); |
| 257 | 257 |
| 258 KernelLoadInfo info; | 258 KernelLoadInfo info; |
| 259 // Temporary indices before kernel_ initialized in case Load fails. We 0(1) | 259 // Temporary indices before kernel_ initialized in case Load fails. We 0(1) |
| 260 // swap these later. | 260 // swap these later. |
| 261 MetahandlesIndex metas_bucket; | 261 MetahandlesIndex metas_bucket; |
| 262 DirOpenResult result = store_->Load(&metas_bucket, &info); | 262 DirOpenResult result = store_->Load(&metas_bucket, &info); |
| 263 if (OPENED != result) | 263 if (OPENED != result) { |
| 264 // XXX need to free all the crap in metas_bucket here. |
| 264 return result; | 265 return result; |
| 266 } |
| 265 | 267 |
| 266 kernel_ = new Kernel(db_path, name, info); | 268 kernel_ = new Kernel(db_path, name, info); |
| 267 kernel_->metahandles_index->swap(metas_bucket); | 269 kernel_->metahandles_index->swap(metas_bucket); |
| 268 InitializeIndices(); | 270 InitializeIndices(); |
| 269 return OPENED; | 271 return OPENED; |
| 270 } | 272 } |
| 271 | 273 |
| 272 void Directory::Close() { | 274 void Directory::Close() { |
| 273 if (store_) | 275 if (store_) |
| 274 delete store_; | 276 delete store_; |
| (...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 return s << std::dec; | 1581 return s << std::dec; |
| 1580 } | 1582 } |
| 1581 | 1583 |
| 1582 FastDump& operator<<(FastDump& dump, const syncable::Blob& blob) { | 1584 FastDump& operator<<(FastDump& dump, const syncable::Blob& blob) { |
| 1583 if (blob.empty()) | 1585 if (blob.empty()) |
| 1584 return dump; | 1586 return dump; |
| 1585 string buffer(HexEncode(&blob[0], blob.size())); | 1587 string buffer(HexEncode(&blob[0], blob.size())); |
| 1586 dump.out_->sputn(buffer.c_str(), buffer.size()); | 1588 dump.out_->sputn(buffer.c_str(), buffer.size()); |
| 1587 return dump; | 1589 return dump; |
| 1588 } | 1590 } |
| OLD | NEW |