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

Side by Side Diff: components/leveldb_proto/leveldb_database.cc

Issue 1420003004: Wipe out offline page data on clearing cookie and site data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address more feedback Created 5 years, 1 month 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
« no previous file with comments | « components/leveldb_proto/leveldb_database.h ('k') | components/leveldb_proto/proto_database.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/leveldb_proto/leveldb_database.h" 5 #include "components/leveldb_proto/leveldb_database.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "third_party/leveldatabase/env_chromium.h" 16 #include "third_party/leveldatabase/env_chromium.h"
17 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" 17 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h"
18 #include "third_party/leveldatabase/src/include/leveldb/db.h" 18 #include "third_party/leveldatabase/src/include/leveldb/db.h"
19 #include "third_party/leveldatabase/src/include/leveldb/env.h" 19 #include "third_party/leveldatabase/src/include/leveldb/env.h"
20 #include "third_party/leveldatabase/src/include/leveldb/iterator.h" 20 #include "third_party/leveldatabase/src/include/leveldb/iterator.h"
21 #include "third_party/leveldatabase/src/include/leveldb/options.h" 21 #include "third_party/leveldatabase/src/include/leveldb/options.h"
22 #include "third_party/leveldatabase/src/include/leveldb/slice.h" 22 #include "third_party/leveldatabase/src/include/leveldb/slice.h"
23 #include "third_party/leveldatabase/src/include/leveldb/status.h" 23 #include "third_party/leveldatabase/src/include/leveldb/status.h"
24 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" 24 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h"
25 25
26 namespace leveldb_proto { 26 namespace leveldb_proto {
27 27
28 // static
29 bool LevelDB::Destroy(const base::FilePath& database_dir) {
30 const leveldb::Status s =
31 leveldb::DestroyDB(database_dir.AsUTF8Unsafe(), leveldb::Options());
32 return s.ok();
33 }
34
28 LevelDB::LevelDB(const char* client_name) : open_histogram_(nullptr) { 35 LevelDB::LevelDB(const char* client_name) : open_histogram_(nullptr) {
29 // Used in lieu of UMA_HISTOGRAM_ENUMERATION because the histogram name is 36 // Used in lieu of UMA_HISTOGRAM_ENUMERATION because the histogram name is
30 // not a constant. 37 // not a constant.
31 open_histogram_ = base::LinearHistogram::FactoryGet( 38 open_histogram_ = base::LinearHistogram::FactoryGet(
32 std::string("LevelDB.Open.") + client_name, 1, 39 std::string("LevelDB.Open.") + client_name, 1,
33 leveldb_env::LEVELDB_STATUS_MAX, leveldb_env::LEVELDB_STATUS_MAX + 1, 40 leveldb_env::LEVELDB_STATUS_MAX, leveldb_env::LEVELDB_STATUS_MAX + 1,
34 base::Histogram::kUmaTargetedHistogramFlag); 41 base::Histogram::kUmaTargetedHistogramFlag);
35 } 42 }
36 43
37 LevelDB::~LevelDB() { 44 LevelDB::~LevelDB() {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 scoped_ptr<leveldb::Iterator> db_iterator(db_->NewIterator(options)); 118 scoped_ptr<leveldb::Iterator> db_iterator(db_->NewIterator(options));
112 for (db_iterator->SeekToFirst(); db_iterator->Valid(); db_iterator->Next()) { 119 for (db_iterator->SeekToFirst(); db_iterator->Valid(); db_iterator->Next()) {
113 leveldb::Slice value_slice = db_iterator->value(); 120 leveldb::Slice value_slice = db_iterator->value();
114 std::string entry(value_slice.data(), value_slice.size()); 121 std::string entry(value_slice.data(), value_slice.size());
115 entries->push_back(entry); 122 entries->push_back(entry);
116 } 123 }
117 return true; 124 return true;
118 } 125 }
119 126
120 } // namespace leveldb_proto 127 } // namespace leveldb_proto
OLDNEW
« no previous file with comments | « components/leveldb_proto/leveldb_database.h ('k') | components/leveldb_proto/proto_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698