diff options
author | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-15 20:44:51 +0000 |
---|---|---|
committer | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-15 20:44:51 +0000 |
commit | 24737a92363d9cec8c87f4d69f79163ae850afb6 (patch) | |
tree | 39da6fcdb8066e886510eba71177ed7a27e1028e /webkit/dom_storage | |
parent | 2c7d23f639f3d6aa1c0c840d230c9a5e1cb0ca63 (diff) | |
download | chromium_src-24737a92363d9cec8c87f4d69f79163ae850afb6.zip chromium_src-24737a92363d9cec8c87f4d69f79163ae850afb6.tar.gz chromium_src-24737a92363d9cec8c87f4d69f79163ae850afb6.tar.bz2 |
Automate more Better Session Restore tests.
This also makes libdom_storage a component instead of a static library.
BUG=153260
Review URL: https://chromiumcodereview.appspot.com/11088005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161951 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/dom_storage')
-rw-r--r-- | webkit/dom_storage/dom_storage_area.cc | 12 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_area.h | 5 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_cached_area.h | 4 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_context.h | 5 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_database.h | 3 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_database_adapter.h | 3 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_export.h | 29 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_host.h | 3 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_map.h | 3 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_namespace.h | 3 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_session.h | 3 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_task_runner.h | 9 | ||||
-rw-r--r-- | webkit/dom_storage/local_storage_database_adapter.h | 4 | ||||
-rw-r--r-- | webkit/dom_storage/session_storage_database.h | 3 | ||||
-rw-r--r-- | webkit/dom_storage/webkit_dom_storage.gypi | 8 |
15 files changed, 78 insertions, 19 deletions
diff --git a/webkit/dom_storage/dom_storage_area.cc b/webkit/dom_storage/dom_storage_area.cc index 734edff..e9afa12 100644 --- a/webkit/dom_storage/dom_storage_area.cc +++ b/webkit/dom_storage/dom_storage_area.cc @@ -24,7 +24,8 @@ using webkit_database::DatabaseUtil; namespace dom_storage { -static const int kCommitTimerSeconds = 1; +// Non-const for testing. +static int commit_timer_seconds = 1; DomStorageArea::CommitBatch::CommitBatch() : clear_all_first(false) { @@ -250,6 +251,11 @@ void DomStorageArea::Shutdown() { DCHECK(success); } +// static +void DomStorageArea::DisableCommitDelayForTesting() { + commit_timer_seconds = 0; +} + void DomStorageArea::InitialImportIfNeeded() { if (is_initial_import_done_) return; @@ -274,7 +280,7 @@ DomStorageArea::CommitBatch* DomStorageArea::CreateCommitBatchIfNeeded() { task_runner_->PostDelayedTask( FROM_HERE, base::Bind(&DomStorageArea::OnCommitTimer, this), - base::TimeDelta::FromSeconds(kCommitTimerSeconds)); + base::TimeDelta::FromSeconds(commit_timer_seconds)); } } return commit_batch_.get(); @@ -325,7 +331,7 @@ void DomStorageArea::OnCommitComplete() { task_runner_->PostDelayedTask( FROM_HERE, base::Bind(&DomStorageArea::OnCommitTimer, this), - base::TimeDelta::FromSeconds(kCommitTimerSeconds)); + base::TimeDelta::FromSeconds(commit_timer_seconds)); } } diff --git a/webkit/dom_storage/dom_storage_area.h b/webkit/dom_storage/dom_storage_area.h index 7a17901..ebb4735 100644 --- a/webkit/dom_storage/dom_storage_area.h +++ b/webkit/dom_storage/dom_storage_area.h @@ -12,6 +12,7 @@ #include "base/nullable_string16.h" #include "base/string16.h" #include "googleurl/src/gurl.h" +#include "webkit/dom_storage/dom_storage_export.h" #include "webkit/dom_storage/dom_storage_types.h" namespace dom_storage { @@ -24,7 +25,7 @@ class SessionStorageDatabase; // Container for a per-origin Map of key/value pairs potentially // backed by storage on disk and lazily commits changes to disk. // See class comments for DomStorageContext for a larger overview. -class DomStorageArea +class DOM_STORAGE_EXPORT DomStorageArea : public base::RefCountedThreadSafe<DomStorageArea> { public: @@ -78,6 +79,8 @@ class DomStorageArea // no longer do anything. void Shutdown(); + static void DisableCommitDelayForTesting(); + private: friend class DomStorageAreaTest; FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DomStorageAreaBasics); diff --git a/webkit/dom_storage/dom_storage_cached_area.h b/webkit/dom_storage/dom_storage_cached_area.h index fc1968e..3dee745 100644 --- a/webkit/dom_storage/dom_storage_cached_area.h +++ b/webkit/dom_storage/dom_storage_cached_area.h @@ -11,6 +11,7 @@ #include "base/memory/weak_ptr.h" #include "base/nullable_string16.h" #include "googleurl/src/gurl.h" +#include "webkit/dom_storage/dom_storage_export.h" namespace dom_storage { @@ -23,7 +24,8 @@ class DomStorageProxy; // first access and changes are written to the backend thru the |proxy|. // Mutations originating in other processes are applied to the cache via // the ApplyMutation method. -class DomStorageCachedArea : public base::RefCounted<DomStorageCachedArea> { +class DOM_STORAGE_EXPORT DomStorageCachedArea : + public base::RefCounted<DomStorageCachedArea> { public: DomStorageCachedArea(int64 namespace_id, const GURL& origin, DomStorageProxy* proxy); diff --git a/webkit/dom_storage/dom_storage_context.h b/webkit/dom_storage/dom_storage_context.h index d2b94d4..05f663f 100644 --- a/webkit/dom_storage/dom_storage_context.h +++ b/webkit/dom_storage/dom_storage_context.h @@ -17,6 +17,7 @@ #include "base/observer_list.h" #include "base/time.h" #include "googleurl/src/gurl.h" +#include "webkit/dom_storage/dom_storage_export.h" class FilePath; class NullableString16; @@ -56,10 +57,10 @@ class SessionStorageDatabase; // Classes intended to be used by an embedder are DomStorageContext, // DomStorageHost, and DomStorageSession. The other classes are for // internal consumption. -class DomStorageContext +class DOM_STORAGE_EXPORT DomStorageContext : public base::RefCountedThreadSafe<DomStorageContext> { public: - struct UsageInfo { + struct DOM_STORAGE_EXPORT UsageInfo { GURL origin; size_t data_size; base::Time last_modified; diff --git a/webkit/dom_storage/dom_storage_database.h b/webkit/dom_storage/dom_storage_database.h index 2804ddd..6cf2fed 100644 --- a/webkit/dom_storage/dom_storage_database.h +++ b/webkit/dom_storage/dom_storage_database.h @@ -13,13 +13,14 @@ #include "base/nullable_string16.h" #include "base/string16.h" #include "sql/connection.h" +#include "webkit/dom_storage/dom_storage_export.h" #include "webkit/dom_storage/dom_storage_types.h" namespace dom_storage { // Represents a SQLite based backing for DOM storage data. This // class is designed to be used on a single thread. -class DomStorageDatabase { +class DOM_STORAGE_EXPORT DomStorageDatabase { public: static FilePath GetJournalFilePath(const FilePath& database_path); diff --git a/webkit/dom_storage/dom_storage_database_adapter.h b/webkit/dom_storage/dom_storage_database_adapter.h index 8ed8f70..c75a0c1 100644 --- a/webkit/dom_storage/dom_storage_database_adapter.h +++ b/webkit/dom_storage/dom_storage_database_adapter.h @@ -9,11 +9,12 @@ // the per-origin DomStorageDatabases for localStorage and // SessionStorageDatabase which stores multiple origins. +#include "webkit/dom_storage/dom_storage_export.h" #include "webkit/dom_storage/dom_storage_types.h" namespace dom_storage { -class DomStorageDatabaseAdapter { +class DOM_STORAGE_EXPORT DomStorageDatabaseAdapter { public: virtual ~DomStorageDatabaseAdapter() {} virtual void ReadAllValues(ValuesMap* result) = 0; diff --git a/webkit/dom_storage/dom_storage_export.h b/webkit/dom_storage/dom_storage_export.h new file mode 100644 index 0000000..34a2914 --- /dev/null +++ b/webkit/dom_storage/dom_storage_export.h @@ -0,0 +1,29 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_EXPORT_H_ +#define WEBKIT_DOM_STORAGE_DOM_STORAGE_EXPORT_H_ + +#if defined(COMPONENT_BUILD) +#if defined(WIN32) + +#if defined(DOM_STORAGE_IMPLEMENTATION) +#define DOM_STORAGE_EXPORT __declspec(dllexport) +#else +#define DOM_STORAGE_EXPORT __declspec(dllimport) +#endif // defined(DOM_STORAGE_IMPLEMENTATION) + +#else // defined(WIN32) +#if defined(DOM_STORAGE_IMPLEMENTATION) +#define DOM_STORAGE_EXPORT __attribute__((visibility("default"))) +#else +#define DOM_STORAGE_EXPORT +#endif +#endif + +#else // defined(COMPONENT_BUILD) +#define DOM_STORAGE_EXPORT +#endif + +#endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_EXPORT_H_ diff --git a/webkit/dom_storage/dom_storage_host.h b/webkit/dom_storage/dom_storage_host.h index 80f8e63..03611dc 100644 --- a/webkit/dom_storage/dom_storage_host.h +++ b/webkit/dom_storage/dom_storage_host.h @@ -10,6 +10,7 @@ #include "base/memory/ref_counted.h" #include "base/nullable_string16.h" #include "base/string16.h" +#include "webkit/dom_storage/dom_storage_export.h" #include "webkit/dom_storage/dom_storage_types.h" class GURL; @@ -26,7 +27,7 @@ class DomStorageArea; // This class is single threaded, and performs blocking file reads/writes, // so it shouldn't be used on chrome's IO thread. // See class comments for DomStorageContext for a larger overview. -class DomStorageHost { +class DOM_STORAGE_EXPORT DomStorageHost { public: explicit DomStorageHost(DomStorageContext* context); ~DomStorageHost(); diff --git a/webkit/dom_storage/dom_storage_map.h b/webkit/dom_storage/dom_storage_map.h index 86d955b..e712be7 100644 --- a/webkit/dom_storage/dom_storage_map.h +++ b/webkit/dom_storage/dom_storage_map.h @@ -10,6 +10,7 @@ #include "base/memory/ref_counted.h" #include "base/nullable_string16.h" #include "base/string16.h" +#include "webkit/dom_storage/dom_storage_export.h" #include "webkit/dom_storage/dom_storage_types.h" namespace dom_storage { @@ -17,7 +18,7 @@ namespace dom_storage { // A wrapper around a std::map that adds refcounting and // tracks the size in bytes of the keys/values, enforcing a quota. // See class comments for DomStorageContext for a larger overview. -class DomStorageMap +class DOM_STORAGE_EXPORT DomStorageMap : public base::RefCountedThreadSafe<DomStorageMap> { public: explicit DomStorageMap(size_t quota); diff --git a/webkit/dom_storage/dom_storage_namespace.h b/webkit/dom_storage/dom_storage_namespace.h index f1c0c07..9a0c028 100644 --- a/webkit/dom_storage/dom_storage_namespace.h +++ b/webkit/dom_storage/dom_storage_namespace.h @@ -10,6 +10,7 @@ #include "base/basictypes.h" #include "base/file_path.h" #include "base/memory/ref_counted.h" +#include "webkit/dom_storage/dom_storage_export.h" class GURL; @@ -21,7 +22,7 @@ class SessionStorageDatabase; // Container for the set of per-origin Areas. // See class comments for DomStorageContext for a larger overview. -class DomStorageNamespace +class DOM_STORAGE_EXPORT DomStorageNamespace : public base::RefCountedThreadSafe<DomStorageNamespace> { public: // Constructor for a LocalStorage namespace with id of 0 diff --git a/webkit/dom_storage/dom_storage_session.h b/webkit/dom_storage/dom_storage_session.h index 1f5294e..efb9131 100644 --- a/webkit/dom_storage/dom_storage_session.h +++ b/webkit/dom_storage/dom_storage_session.h @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" +#include "webkit/dom_storage/dom_storage_export.h" namespace dom_storage { @@ -18,7 +19,7 @@ class DomStorageContext; // storage namespace and provides an interface to Clone() an // existing session storage namespace. It may be used on any thread. // See class comments for DomStorageContext for a larger overview. -class DomStorageSession +class DOM_STORAGE_EXPORT DomStorageSession : public base::RefCountedThreadSafe<DomStorageSession> { public: // Constructs a |DomStorageSession| and allocates new IDs for it. diff --git a/webkit/dom_storage/dom_storage_task_runner.h b/webkit/dom_storage/dom_storage_task_runner.h index 165c694..290e649 100644 --- a/webkit/dom_storage/dom_storage_task_runner.h +++ b/webkit/dom_storage/dom_storage_task_runner.h @@ -9,6 +9,7 @@ #include "base/sequenced_task_runner.h" #include "base/threading/sequenced_worker_pool.h" #include "base/time.h" +#include "webkit/dom_storage/dom_storage_export.h" namespace base { class MessageLoopProxy; @@ -25,7 +26,7 @@ namespace dom_storage { // TODO(michaeln): Skip tasks for reading during shutdown. // * Internal tasks related to committing changes to disk are performed as // shutdown-blocking commit sequence tasks. -class DomStorageTaskRunner : public base::TaskRunner { +class DOM_STORAGE_EXPORT DomStorageTaskRunner : public base::TaskRunner { public: enum SequenceID { PRIMARY_SEQUENCE, @@ -65,7 +66,8 @@ class DomStorageTaskRunner : public base::TaskRunner { // A derived class used in chromium that utilizes a SequenceWorkerPool // under dom_storage specific SequenceTokens. The |delayed_task_loop| // is used to delay scheduling on the worker pool. -class DomStorageWorkerPoolTaskRunner : public DomStorageTaskRunner { +class DOM_STORAGE_EXPORT DomStorageWorkerPoolTaskRunner : + public DomStorageTaskRunner { public: DomStorageWorkerPoolTaskRunner( base::SequencedWorkerPool* sequenced_worker_pool, @@ -103,7 +105,8 @@ class DomStorageWorkerPoolTaskRunner : public DomStorageTaskRunner { // There is no distinction between [non]-shutdown-blocking or // the primary sequence vs the commit sequence in the mock, // all tasks are scheduled on |message_loop| with zero delay. -class MockDomStorageTaskRunner : public DomStorageTaskRunner { +class DOM_STORAGE_EXPORT MockDomStorageTaskRunner : + public DomStorageTaskRunner { public: explicit MockDomStorageTaskRunner(base::MessageLoopProxy* message_loop); diff --git a/webkit/dom_storage/local_storage_database_adapter.h b/webkit/dom_storage/local_storage_database_adapter.h index 3f36894..db6f9d4 100644 --- a/webkit/dom_storage/local_storage_database_adapter.h +++ b/webkit/dom_storage/local_storage_database_adapter.h @@ -7,6 +7,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" +#include "webkit/dom_storage/dom_storage_export.h" #include "webkit/dom_storage/dom_storage_database_adapter.h" class FilePath; @@ -15,7 +16,8 @@ namespace dom_storage { class DomStorageDatabase; -class LocalStorageDatabaseAdapter : public DomStorageDatabaseAdapter { +class DOM_STORAGE_EXPORT LocalStorageDatabaseAdapter : + public DomStorageDatabaseAdapter { public: explicit LocalStorageDatabaseAdapter(const FilePath& path); virtual ~LocalStorageDatabaseAdapter(); diff --git a/webkit/dom_storage/session_storage_database.h b/webkit/dom_storage/session_storage_database.h index 8eab8e7..b8de0a5 100644 --- a/webkit/dom_storage/session_storage_database.h +++ b/webkit/dom_storage/session_storage_database.h @@ -13,6 +13,7 @@ #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" #include "third_party/leveldatabase/src/include/leveldb/status.h" +#include "webkit/dom_storage/dom_storage_export.h" #include "webkit/dom_storage/dom_storage_types.h" class GURL; @@ -31,7 +32,7 @@ namespace dom_storage { // Only one thread is allowed to call the public functions other than // ReadAreaValues. Other threads area allowed to call ReadAreaValues. -class SessionStorageDatabase : +class DOM_STORAGE_EXPORT SessionStorageDatabase : public base::RefCountedThreadSafe<SessionStorageDatabase> { public: explicit SessionStorageDatabase(const FilePath& file_path); diff --git a/webkit/dom_storage/webkit_dom_storage.gypi b/webkit/dom_storage/webkit_dom_storage.gypi index 22ec711..b5fca2c 100644 --- a/webkit/dom_storage/webkit_dom_storage.gypi +++ b/webkit/dom_storage/webkit_dom_storage.gypi @@ -6,14 +6,19 @@ 'targets': [ { 'target_name': 'dom_storage', - 'type': 'static_library', + 'type': '<(component)', 'variables': { 'enable_wexit_time_destructors': 1, }, + 'defines': ['DOM_STORAGE_IMPLEMENTATION'], 'dependencies': [ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/sql/sql.gyp:sql', '<(DEPTH)/third_party/leveldatabase/leveldatabase.gyp:leveldatabase', '<(DEPTH)/third_party/sqlite/sqlite.gyp:sqlite', + '<(DEPTH)/webkit/support/webkit_support.gyp:database', '<(DEPTH)/webkit/support/webkit_support.gyp:quota', + '<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit', + 'fileapi', + 'glue', ], 'sources': [ 'dom_storage_area.cc', @@ -25,6 +30,7 @@ 'dom_storage_database.cc', 'dom_storage_database.h', 'dom_storage_database_adapter.h', + 'dom_storage_export.h', 'dom_storage_host.cc', 'dom_storage_host.h', 'dom_storage_map.cc', |