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

Side by Side Diff: components/leveldb/leveldb_service_impl.cc

Issue 2625873004: Delete and try to recreate localstorage database on invalid schema version. (Closed)
Patch Set: fix windows build Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/leveldb_service_impl.h" 5 #include "components/leveldb/leveldb_service_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "components/leveldb/env_mojo.h" 10 #include "components/leveldb/env_mojo.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 if (s.ok()) { 86 if (s.ok()) {
87 mojo::MakeStrongBinding(base::MakeUnique<LevelDBDatabaseImpl>( 87 mojo::MakeStrongBinding(base::MakeUnique<LevelDBDatabaseImpl>(
88 std::move(env), base::WrapUnique(db)), 88 std::move(env), base::WrapUnique(db)),
89 std::move(database)); 89 std::move(database));
90 } 90 }
91 91
92 callback.Run(LeveldbStatusToError(s)); 92 callback.Run(LeveldbStatusToError(s));
93 } 93 }
94 94
95 void LevelDBServiceImpl::Destroy(filesystem::mojom::DirectoryPtr directory,
96 const std::string& dbname,
97 const DestroyCallback& callback) {
98 leveldb::Options options;
99 // Register our directory with the file thread.
100 LevelDBMojoProxy::OpaqueDir* dir =
101 thread_->RegisterDirectory(std::move(directory));
102 std::unique_ptr<MojoEnv> env_mojo(new MojoEnv(thread_, dir));
103 options.env = env_mojo.get();
104 callback.Run(LeveldbStatusToError(leveldb::DestroyDB(dbname, options)));
105 }
106
95 } // namespace leveldb 107 } // namespace leveldb
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698