OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 void DatabaseServer::closeDatabasesImmediately(const String& originIdentifier, c
onst String& name) | 43 void DatabaseServer::closeDatabasesImmediately(const String& originIdentifier, c
onst String& name) |
44 { | 44 { |
45 DatabaseTracker::tracker().closeDatabasesImmediately(originIdentifier, name)
; | 45 DatabaseTracker::tracker().closeDatabasesImmediately(originIdentifier, name)
; |
46 } | 46 } |
47 | 47 |
48 void DatabaseServer::interruptAllDatabasesForContext(const DatabaseContext* cont
ext) | 48 void DatabaseServer::interruptAllDatabasesForContext(const DatabaseContext* cont
ext) |
49 { | 49 { |
50 DatabaseTracker::tracker().interruptAllDatabasesForContext(context); | 50 DatabaseTracker::tracker().interruptAllDatabasesForContext(context); |
51 } | 51 } |
52 | 52 |
53 PassRefPtrWillBeRawPtr<DatabaseBackendBase> DatabaseServer::openDatabase(RefPtr<
DatabaseContext>& backendContext, | 53 PassRefPtrWillBeRawPtr<DatabaseBackendBase> DatabaseServer::openDatabase(Databas
eContext* backendContext, |
54 DatabaseType type, const String& name, const String& expectedVersion, const
String& displayName, | 54 DatabaseType type, const String& name, const String& expectedVersion, const
String& displayName, |
55 unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError &er
ror, String& errorMessage) | 55 unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError &er
ror, String& errorMessage) |
56 { | 56 { |
57 RefPtrWillBeRawPtr<DatabaseBackendBase> database = nullptr; | 57 RefPtrWillBeRawPtr<DatabaseBackendBase> database = nullptr; |
58 if (DatabaseTracker::tracker().canEstablishDatabase(backendContext.get(), na
me, displayName, estimatedSize, error)) | 58 if (DatabaseTracker::tracker().canEstablishDatabase(backendContext, name, di
splayName, estimatedSize, error)) |
59 database = createDatabase(backendContext, type, name, expectedVersion, d
isplayName, estimatedSize, setVersionInNewDatabase, error, errorMessage); | 59 database = createDatabase(backendContext, type, name, expectedVersion, d
isplayName, estimatedSize, setVersionInNewDatabase, error, errorMessage); |
60 return database.release(); | 60 return database.release(); |
61 } | 61 } |
62 | 62 |
63 PassRefPtrWillBeRawPtr<DatabaseBackendBase> DatabaseServer::createDatabase(RefPt
r<DatabaseContext>& backendContext, | 63 PassRefPtrWillBeRawPtr<DatabaseBackendBase> DatabaseServer::createDatabase(Datab
aseContext* backendContext, |
64 DatabaseType type, const String& name, const String& expectedVersion, const
String& displayName, | 64 DatabaseType type, const String& name, const String& expectedVersion, const
String& displayName, |
65 unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError& er
ror, String& errorMessage) | 65 unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError& er
ror, String& errorMessage) |
66 { | 66 { |
67 RefPtrWillBeRawPtr<DatabaseBackendBase> database = nullptr; | 67 RefPtrWillBeRawPtr<DatabaseBackendBase> database = nullptr; |
68 switch (type) { | 68 switch (type) { |
69 case DatabaseType::Async: | 69 case DatabaseType::Async: |
70 database = adoptRefWillBeNoop(new Database(backendContext, name, expecte
dVersion, displayName, estimatedSize)); | 70 database = adoptRefWillBeNoop(new Database(backendContext, name, expecte
dVersion, displayName, estimatedSize)); |
71 break; | 71 break; |
72 case DatabaseType::Sync: | 72 case DatabaseType::Sync: |
73 database = adoptRefWillBeNoop(new DatabaseSync(backendContext, name, exp
ectedVersion, displayName, estimatedSize)); | 73 database = adoptRefWillBeNoop(new DatabaseSync(backendContext, name, exp
ectedVersion, displayName, estimatedSize)); |
74 } | 74 } |
75 | 75 |
76 if (!database->openAndVerifyVersion(setVersionInNewDatabase, error, errorMes
sage)) | 76 if (!database->openAndVerifyVersion(setVersionInNewDatabase, error, errorMes
sage)) |
77 return nullptr; | 77 return nullptr; |
78 return database.release(); | 78 return database.release(); |
79 } | 79 } |
80 | 80 |
81 } // namespace WebCore | 81 } // namespace WebCore |
OLD | NEW |