Commit 3ba65193 authored by Daniel Murphy's avatar Daniel Murphy Committed by Commit Bot

[Session Storage] Deleting database on startup for Andriod

R: mek@chromium.org
Bug: 770307
Change-Id: If5dfbdb3064e1b4f336680d45dfcff1d1ef27add
Reviewed-on: https://chromium-review.googlesource.com/775674
Commit-Queue: Daniel Murphy <dmurph@chromium.org>
Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517628}
parent 8920fab7
......@@ -13,6 +13,7 @@
#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "content/browser/dom_storage/dom_storage_area.h"
#include "content/browser/dom_storage/dom_storage_namespace.h"
#include "content/browser/dom_storage/dom_storage_task_runner.h"
......@@ -204,7 +205,14 @@ TEST_F(DOMStorageContextImplTest, PersistentIds) {
EXPECT_EQ(kClonedPersistentId, cloned_area->persistent_namespace_id_);
}
// Disable this test on Android as on Android we always delete our old session
// storage on startup. This is because we don't do any session restoration for
// the android system. See crbug.com/770307.
#if defined(OS_ANDROID)
TEST_F(DOMStorageContextImplTest, DISABLED_DeleteSessionStorage) {
#else
TEST_F(DOMStorageContextImplTest, DeleteSessionStorage) {
#endif
// Create a DOMStorageContextImpl which will save sessionStorage on disk.
context_->Shutdown();
context_ =
......
......@@ -17,6 +17,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/process_memory_dump.h"
#include "build/build_config.h"
#include "third_party/leveldatabase/env_chromium.h"
#include "third_party/leveldatabase/leveldb_chrome.h"
#include "third_party/leveldatabase/src/include/leveldb/db.h"
......@@ -458,7 +459,15 @@ leveldb::Status SessionStorageDatabase::TryToOpen(
// memory allocation in RAM from a log file recovery.
options.write_buffer_size = 64 * 1024;
options.block_cache = leveldb_chrome::GetSharedWebBlockCache();
return leveldb_env::OpenDB(options, file_path_.AsUTF8Unsafe(), db);
std::string db_name = file_path_.AsUTF8Unsafe();
#if defined(OS_ANDROID)
// On Android there is no support for session storage restoring, and since
// the restoring code is responsible for database cleanup, we must manually
// delete the old database here before we open it.
leveldb::DestroyDB(db_name, options);
#endif
return leveldb_env::OpenDB(options, db_name, db);
}
bool SessionStorageDatabase::IsOpen() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment