OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #ifndef DatabaseTracker_h | 29 #ifndef DatabaseTracker_h |
30 #define DatabaseTracker_h | 30 #define DatabaseTracker_h |
31 | 31 |
32 #include "modules/webdatabase/DatabaseError.h" | 32 #include "modules/webdatabase/DatabaseError.h" |
33 #include "platform/heap/Handle.h" | 33 #include "platform/heap/Handle.h" |
34 #include "wtf/HashMap.h" | 34 #include "wtf/HashMap.h" |
35 #include "wtf/HashSet.h" | 35 #include "wtf/HashSet.h" |
36 #include "wtf/ThreadingPrimitives.h" | 36 #include "wtf/ThreadingPrimitives.h" |
37 #include "wtf/text/StringHash.h" | 37 #include "wtf/text/StringHash.h" |
38 #include "wtf/text/WTFString.h" | |
39 | 38 |
40 namespace blink { | 39 namespace blink { |
41 | 40 |
42 class Database; | 41 class Database; |
43 class DatabaseContext; | 42 class DatabaseContext; |
44 class OriginLock; | |
45 class SecurityOrigin; | 43 class SecurityOrigin; |
46 | 44 |
47 class DatabaseTracker { | 45 class DatabaseTracker { |
48 WTF_MAKE_NONCOPYABLE(DatabaseTracker); WTF_MAKE_FAST_ALLOCATED; | 46 WTF_MAKE_NONCOPYABLE(DatabaseTracker); WTF_MAKE_FAST_ALLOCATED; |
49 public: | 47 public: |
50 static DatabaseTracker& tracker(); | 48 static DatabaseTracker& tracker(); |
51 // This singleton will potentially be used from multiple worker threads and
the page's context thread simultaneously. To keep this safe, it's | 49 // This singleton will potentially be used from multiple worker threads and
the page's context thread simultaneously. To keep this safe, it's |
52 // currently using 4 locks. In order to avoid deadlock when taking multiple
locks, you must take them in the correct order: | 50 // currently using 4 locks. In order to avoid deadlock when taking multiple
locks, you must take them in the correct order: |
53 // m_databaseGuard before quotaManager if both locks are needed. | 51 // m_databaseGuard before quotaManager if both locks are needed. |
54 // m_openDatabaseMapGuard before quotaManager if both locks are needed. | 52 // m_openDatabaseMapGuard before quotaManager if both locks are needed. |
(...skipping 26 matching lines...) Expand all Loading... |
81 Mutex m_openDatabaseMapGuard; | 79 Mutex m_openDatabaseMapGuard; |
82 // This map contains raw pointers to a garbage-collected class. We can't | 80 // This map contains raw pointers to a garbage-collected class. We can't |
83 // make this traceable because it is updated by multiple database threads. | 81 // make this traceable because it is updated by multiple database threads. |
84 GC_PLUGIN_IGNORE("crbug.com/417990") | 82 GC_PLUGIN_IGNORE("crbug.com/417990") |
85 mutable OwnPtr<DatabaseOriginMap> m_openDatabaseMap; | 83 mutable OwnPtr<DatabaseOriginMap> m_openDatabaseMap; |
86 }; | 84 }; |
87 | 85 |
88 } // namespace blink | 86 } // namespace blink |
89 | 87 |
90 #endif // DatabaseTracker_h | 88 #endif // DatabaseTracker_h |
OLD | NEW |