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

Unified Diff: webkit/support/test_webidbfactory.cc

Issue 12230054: Make TestWebIDBFactory allocate a separate WebIDBFactory per thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/support/test_webidbfactory.h ('k') | webkit/support/test_webkit_platform_support.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/support/test_webidbfactory.cc
diff --git a/webkit/support/test_webidbfactory.cc b/webkit/support/test_webidbfactory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a320f6c14d25d083b0e17711b1bdaf9db86b10fc
--- /dev/null
+++ b/webkit/support/test_webidbfactory.cc
@@ -0,0 +1,67 @@
+// Copyright (c) 2013 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.
+
+#include "webkit/support/test_webidbfactory.h"
+
+#include "base/logging.h"
+#include "webkit/base/file_path_string_conversions.h"
+#include "webkit/support/webkit_support.h"
+
+TestWebIDBFactory::TestWebIDBFactory() {
+ // Create a new temp directory for Indexed DB storage, specific to this
+ // factory. If this fails, WebKit uses in-memory storage.
+ if (!indexed_db_dir_.CreateUniqueTempDir()) {
+ LOG(WARNING) << "Failed to create a temp dir for Indexed DB, "
+ "using in-memory storage.";
+ DCHECK(indexed_db_dir_.path().empty());
+ }
+}
+
+TestWebIDBFactory::~TestWebIDBFactory() {
+}
+
+void TestWebIDBFactory::getDatabaseNames(
+ WebKit::WebIDBCallbacks* callbacks,
+ const WebKit::WebSecurityOrigin& origin,
+ WebKit::WebFrame* frame,
+ const WebKit::WebString& data_dir) {
+ GetFactory()->getDatabaseNames(callbacks, origin, frame,
+ data_dir.isEmpty() ? GetDataDir() : data_dir);
+}
+
+void TestWebIDBFactory::open(
+ const WebKit::WebString& name,
+ long long version,
+ long long transaction_id,
+ WebKit::WebIDBCallbacks* callbacks,
+ WebKit::WebIDBDatabaseCallbacks* database_callbacks,
+ const WebKit::WebSecurityOrigin& origin,
+ WebKit::WebFrame* frame,
+ const WebKit::WebString& data_dir) {
+ GetFactory()->open(name, version, transaction_id, callbacks,
+ database_callbacks, origin, frame,
+ data_dir.isEmpty() ? GetDataDir() : data_dir);
+}
+
+void TestWebIDBFactory::deleteDatabase(const WebKit::WebString& name,
+ WebKit::WebIDBCallbacks* callbacks,
+ const WebKit::WebSecurityOrigin& origin,
+ WebKit::WebFrame* frame,
+ const WebKit::WebString& data_dir) {
+ GetFactory()->deleteDatabase(name, callbacks, origin, frame,
+ data_dir.isEmpty() ? GetDataDir() : data_dir);
+}
+
+WebKit::WebIDBFactory* TestWebIDBFactory::GetFactory() {
+ WebKit::WebIDBFactory* factory = factories_.Get();
+ if (!factory) {
+ factory = WebKit::WebIDBFactory::create();
+ factories_.Set(factory);
+ }
+ return factory;
+}
+
+WebKit::WebString TestWebIDBFactory::GetDataDir() const {
+ return webkit_base::FilePathToWebString(indexed_db_dir_.path());
+}
« no previous file with comments | « webkit/support/test_webidbfactory.h ('k') | webkit/support/test_webkit_platform_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698