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

Side by Side Diff: webkit/tools/test_shell/simple_database_system.h

Issue 404013: Fixes a crash source in test_shell when running DB tests.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | « no previous file | webkit/tools/test_shell/simple_database_system.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #ifndef WEBKIT_TOOLS_TEST_SHELL_SIMPLE_DATABASE_SYSTEM_H_ 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_SIMPLE_DATABASE_SYSTEM_H_
6 #define WEBKIT_TOOLS_TEST_SHELL_SIMPLE_DATABASE_SYSTEM_H_ 6 #define WEBKIT_TOOLS_TEST_SHELL_SIMPLE_DATABASE_SYSTEM_H_
7 7
8 #include "base/file_path.h"
9 #include "base/hash_tables.h"
10 #include "base/lock.h"
8 #include "base/platform_file.h" 11 #include "base/platform_file.h"
9 #include "base/ref_counted.h" 12 #include "base/ref_counted.h"
10 #include "base/scoped_temp_dir.h" 13 #include "base/scoped_temp_dir.h"
11 #include "base/string16.h" 14 #include "base/string16.h"
12 #include "third_party/WebKit/WebKit/chromium/public/WebDatabaseObserver.h" 15 #include "third_party/WebKit/WebKit/chromium/public/WebDatabaseObserver.h"
13 #include "webkit/database/database_tracker.h" 16 #include "webkit/database/database_tracker.h"
14 17
15 class SimpleDatabaseSystem : public webkit_database::DatabaseTracker::Observer, 18 class SimpleDatabaseSystem : public webkit_database::DatabaseTracker::Observer,
16 public WebKit::WebDatabaseObserver { 19 public WebKit::WebDatabaseObserver {
17 public: 20 public:
(...skipping 26 matching lines...) Expand all
44 int64 space_available); 47 int64 space_available);
45 48
46 // WebDatabaseObserver implementation 49 // WebDatabaseObserver implementation
47 virtual void databaseOpened(const WebKit::WebDatabase& database); 50 virtual void databaseOpened(const WebKit::WebDatabase& database);
48 virtual void databaseModified(const WebKit::WebDatabase& database); 51 virtual void databaseModified(const WebKit::WebDatabase& database);
49 virtual void databaseClosed(const WebKit::WebDatabase& database); 52 virtual void databaseClosed(const WebKit::WebDatabase& database);
50 53
51 void ClearAllDatabases(); 54 void ClearAllDatabases();
52 55
53 private: 56 private:
57 // The calls that come from the database tracker run on the main thread.
58 // Therefore, we can only call DatabaseUtil::GetFullFilePathForVfsFile()
59 // on the main thread. However, the VFS calls run on the DB thread and
60 // they need to crack VFS file paths. To resolve this problem, we store
61 // a map of vfs_file_names to file_paths. The map is updated on the main
62 // thread on each DatabaseOpened() call that comes from the database
63 // tracker, and is read on the DB thread by each VFS call.
64 void SetFullFilePathsForVfsFile(const string16& origin_identifier,
65 const string16& database_name);
66 FilePath GetFullFilePathForVfsFile(const string16& vfs_file_name);
67
54 static SimpleDatabaseSystem* instance_; 68 static SimpleDatabaseSystem* instance_;
55 69
56 ScopedTempDir temp_dir_; 70 ScopedTempDir temp_dir_;
57 71
58 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; 72 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_;
73
74 Lock file_names_lock_;
75 base::hash_map<string16, FilePath> file_names_;
59 }; 76 };
60 77
61 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_DATABASE_SYSTEM_H_ 78 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_DATABASE_SYSTEM_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/tools/test_shell/simple_database_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698