OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 namespace WebCore { | 32 namespace WebCore { |
33 | 33 |
34 DatabaseBackendSync::DatabaseBackendSync(DatabaseContext* databaseContext, const
String& name, const String& expectedVersion, const String& displayName, unsigne
d long estimatedSize) | 34 DatabaseBackendSync::DatabaseBackendSync(DatabaseContext* databaseContext, const
String& name, const String& expectedVersion, const String& displayName, unsigne
d long estimatedSize) |
35 : DatabaseBackendBase(databaseContext, name, expectedVersion, displayName, e
stimatedSize, DatabaseType::Sync) | 35 : DatabaseBackendBase(databaseContext, name, expectedVersion, displayName, e
stimatedSize, DatabaseType::Sync) |
36 { | 36 { |
37 } | 37 } |
38 | 38 |
39 DatabaseBackendSync::~DatabaseBackendSync() | 39 DatabaseBackendSync::~DatabaseBackendSync() |
40 { | 40 { |
| 41 #if !ENABLE(OILPAN) |
41 // SQLite is "multi-thread safe", but each database handle can only be used | 42 // SQLite is "multi-thread safe", but each database handle can only be used |
42 // on a single thread at a time. | 43 // on a single thread at a time. |
43 // | 44 // |
44 // For DatabaseBackendSync, we open the SQLite database on the script contex
t | 45 // For DatabaseBackendSync, we open the SQLite database on the script contex
t |
45 // thread. And hence we should also close it on that same thread. This means | 46 // thread. And hence we should also close it on that same thread. This means |
46 // that the SQLite database need to be closed here in the destructor. | 47 // that the SQLite database need to be closed here in the destructor. |
47 if (opened()) { | 48 if (opened()) { |
48 ASSERT(m_databaseContext->isContextThread()); | 49 ASSERT(m_databaseContext->isContextThread()); |
49 closeDatabase(); | 50 closeDatabase(); |
50 } | 51 } |
| 52 #endif |
| 53 ASSERT(!opened()); |
51 } | 54 } |
52 | 55 |
53 void DatabaseBackendSync::trace(Visitor* visitor) | 56 void DatabaseBackendSync::trace(Visitor* visitor) |
54 { | 57 { |
55 DatabaseBackendBase::trace(visitor); | 58 DatabaseBackendBase::trace(visitor); |
56 } | 59 } |
57 | 60 |
58 bool DatabaseBackendSync::openAndVerifyVersion(bool setVersionInNewDatabase, Dat
abaseError& error, String& errorMessage) | 61 bool DatabaseBackendSync::openAndVerifyVersion(bool setVersionInNewDatabase, Dat
abaseError& error, String& errorMessage) |
59 { | 62 { |
60 DatabaseTracker::tracker().prepareToOpenDatabase(this); | 63 DatabaseTracker::tracker().prepareToOpenDatabase(this); |
61 return performOpenAndVerify(setVersionInNewDatabase, error, errorMessage); | 64 return performOpenAndVerify(setVersionInNewDatabase, error, errorMessage); |
62 } | 65 } |
63 | 66 |
64 } // namespace WebCore | 67 } // namespace WebCore |
OLD | NEW |