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

Side by Side Diff: components/sync/engine/attachments/on_disk_attachment_store.cc

Issue 2855953002: leveldb: Add DBTracker for exposing databases to Chrome's memory-infra. (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/sync/engine/attachments/on_disk_attachment_store.h" 5 #include "components/sync/engine/attachments/on_disk_attachment_store.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 base::FilePath leveldb_path = path.Append(kLeveldbDirectory); 358 base::FilePath leveldb_path = path.Append(kLeveldbDirectory);
359 359
360 leveldb::DB* db_raw; 360 leveldb::DB* db_raw;
361 std::unique_ptr<leveldb::DB> db; 361 std::unique_ptr<leveldb::DB> db;
362 leveldb::Options options; 362 leveldb::Options options;
363 options.create_if_missing = true; 363 options.create_if_missing = true;
364 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; 364 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue;
365 // TODO(pavely): crbug/424287 Consider adding info_log, block_cache and 365 // TODO(pavely): crbug/424287 Consider adding info_log, block_cache and
366 // filter_policy to options. 366 // filter_policy to options.
367 leveldb::Status status = 367 leveldb::Status status =
368 leveldb::DB::Open(options, leveldb_path.AsUTF8Unsafe(), &db_raw); 368 leveldb_env::DBRegistry::Open(options, leveldb_path.AsUTF8Unsafe(), &db_ra w);
369 if (!status.ok()) { 369 if (!status.ok()) {
370 DVLOG(1) << "DB::Open failed: status=" << status.ToString() 370 DVLOG(1) << "DB::Open failed: status=" << status.ToString()
371 << ", path=" << path.AsUTF8Unsafe(); 371 << ", path=" << path.AsUTF8Unsafe();
372 return AttachmentStore::UNSPECIFIED_ERROR; 372 return AttachmentStore::UNSPECIFIED_ERROR;
373 } 373 }
374 374
375 db.reset(db_raw); 375 db.reset(db_raw);
376 376
377 attachment_store_pb::StoreMetadata metadata; 377 attachment_store_pb::StoreMetadata metadata;
378 status = ReadStoreMetadata(db.get(), &metadata); 378 status = ReadStoreMetadata(db.get(), &metadata);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 return key; 531 return key;
532 } 532 }
533 533
534 AttachmentMetadata OnDiskAttachmentStore::MakeAttachmentMetadata( 534 AttachmentMetadata OnDiskAttachmentStore::MakeAttachmentMetadata(
535 const AttachmentId& attachment_id, 535 const AttachmentId& attachment_id,
536 const attachment_store_pb::RecordMetadata& record_metadata) { 536 const attachment_store_pb::RecordMetadata& record_metadata) {
537 return AttachmentMetadata(attachment_id, record_metadata.attachment_size()); 537 return AttachmentMetadata(attachment_id, record_metadata.attachment_size());
538 } 538 }
539 539
540 } // namespace syncer 540 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698