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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/support/test_webidbfactory.h ('k') | webkit/support/test_webkit_platform_support.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "webkit/support/test_webidbfactory.h"
6
7 #include "base/logging.h"
8 #include "webkit/base/file_path_string_conversions.h"
9 #include "webkit/support/webkit_support.h"
10
11 TestWebIDBFactory::TestWebIDBFactory() {
12 // Create a new temp directory for Indexed DB storage, specific to this
13 // factory. If this fails, WebKit uses in-memory storage.
14 if (!indexed_db_dir_.CreateUniqueTempDir()) {
15 LOG(WARNING) << "Failed to create a temp dir for Indexed DB, "
16 "using in-memory storage.";
17 DCHECK(indexed_db_dir_.path().empty());
18 }
19 }
20
21 TestWebIDBFactory::~TestWebIDBFactory() {
22 }
23
24 void TestWebIDBFactory::getDatabaseNames(
25 WebKit::WebIDBCallbacks* callbacks,
26 const WebKit::WebSecurityOrigin& origin,
27 WebKit::WebFrame* frame,
28 const WebKit::WebString& data_dir) {
29 GetFactory()->getDatabaseNames(callbacks, origin, frame,
30 data_dir.isEmpty() ? GetDataDir() : data_dir);
31 }
32
33 void TestWebIDBFactory::open(
34 const WebKit::WebString& name,
35 long long version,
36 long long transaction_id,
37 WebKit::WebIDBCallbacks* callbacks,
38 WebKit::WebIDBDatabaseCallbacks* database_callbacks,
39 const WebKit::WebSecurityOrigin& origin,
40 WebKit::WebFrame* frame,
41 const WebKit::WebString& data_dir) {
42 GetFactory()->open(name, version, transaction_id, callbacks,
43 database_callbacks, origin, frame,
44 data_dir.isEmpty() ? GetDataDir() : data_dir);
45 }
46
47 void TestWebIDBFactory::deleteDatabase(const WebKit::WebString& name,
48 WebKit::WebIDBCallbacks* callbacks,
49 const WebKit::WebSecurityOrigin& origin,
50 WebKit::WebFrame* frame,
51 const WebKit::WebString& data_dir) {
52 GetFactory()->deleteDatabase(name, callbacks, origin, frame,
53 data_dir.isEmpty() ? GetDataDir() : data_dir);
54 }
55
56 WebKit::WebIDBFactory* TestWebIDBFactory::GetFactory() {
57 WebKit::WebIDBFactory* factory = factories_.Get();
58 if (!factory) {
59 factory = WebKit::WebIDBFactory::create();
60 factories_.Set(factory);
61 }
62 return factory;
63 }
64
65 WebKit::WebString TestWebIDBFactory::GetDataDir() const {
66 return webkit_base::FilePathToWebString(indexed_db_dir_.path());
67 }
OLDNEW
« 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