OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "modules/webdatabase/SQLTransactionClient.h" | 31 #include "modules/webdatabase/SQLTransactionClient.h" |
32 | 32 |
33 #include "core/dom/CrossThreadTask.h" | 33 #include "core/dom/CrossThreadTask.h" |
34 #include "core/dom/ExecutionContext.h" | 34 #include "core/dom/ExecutionContext.h" |
35 #include "modules/webdatabase/Database.h" | 35 #include "modules/webdatabase/Database.h" |
36 #include "modules/webdatabase/DatabaseContext.h" | 36 #include "modules/webdatabase/DatabaseContext.h" |
37 #include "platform/weborigin/DatabaseIdentifier.h" | |
38 #include "platform/weborigin/SecurityOrigin.h" | 37 #include "platform/weborigin/SecurityOrigin.h" |
39 #include "public/platform/Platform.h" | 38 #include "public/platform/Platform.h" |
40 #include "public/platform/WebDatabaseObserver.h" | 39 #include "public/platform/WebDatabaseObserver.h" |
| 40 #include "public/platform/WebSecurityOrigin.h" |
41 #include "public/platform/WebTraceLocation.h" | 41 #include "public/platform/WebTraceLocation.h" |
42 #include "wtf/Functional.h" | 42 #include "wtf/Functional.h" |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 static void databaseModified(const String& originIdentifier, const String& datab
aseName) | 46 namespace { |
| 47 |
| 48 void databaseModified(const WebSecurityOrigin& origin, const String& databaseNam
e) |
47 { | 49 { |
48 if (Platform::current()->databaseObserver()) | 50 if (Platform::current()->databaseObserver()) |
49 Platform::current()->databaseObserver()->databaseModified(originIdentifi
er, databaseName); | 51 Platform::current()->databaseObserver()->databaseModified(origin, databa
seName); |
50 } | 52 } |
51 | 53 |
| 54 void databaseModifiedCrossThread(const String& originString, const String& datab
aseName) |
| 55 { |
| 56 databaseModified(WebSecurityOrigin::createFromString(originString), database
Name); |
| 57 } |
| 58 |
| 59 } // namespace |
| 60 |
52 void SQLTransactionClient::didCommitWriteTransaction(Database* database) | 61 void SQLTransactionClient::didCommitWriteTransaction(Database* database) |
53 { | 62 { |
54 String originIdentifier = createDatabaseIdentifierFromSecurityOrigin(databas
e->getSecurityOrigin()); | |
55 String databaseName = database->stringIdentifier(); | 63 String databaseName = database->stringIdentifier(); |
56 ExecutionContext* executionContext = database->getDatabaseContext()->getExec
utionContext(); | 64 ExecutionContext* executionContext = database->getDatabaseContext()->getExec
utionContext(); |
57 if (!executionContext->isContextThread()) { | 65 if (!executionContext->isContextThread()) { |
58 executionContext->postTask(BLINK_FROM_HERE, createCrossThreadTask(&datab
aseModified, originIdentifier, databaseName)); | 66 executionContext->postTask(BLINK_FROM_HERE, createCrossThreadTask(&datab
aseModifiedCrossThread, executionContext->getSecurityOrigin()->toString(), datab
aseName)); |
59 } else { | 67 } else { |
60 databaseModified(originIdentifier, databaseName); | 68 databaseModified(WebSecurityOrigin(executionContext->getSecurityOrigin()
), databaseName); |
61 } | 69 } |
62 } | 70 } |
63 | 71 |
64 bool SQLTransactionClient::didExceedQuota(Database* database) | 72 bool SQLTransactionClient::didExceedQuota(Database* database) |
65 { | 73 { |
66 // Chromium does not allow users to manually change the quota for an origin
(for now, at least). | 74 // Chromium does not allow users to manually change the quota for an origin
(for now, at least). |
67 // Don't do anything. | 75 // Don't do anything. |
68 ASSERT(database->getDatabaseContext()->getExecutionContext()->isContextThrea
d()); | 76 ASSERT(database->getDatabaseContext()->getExecutionContext()->isContextThrea
d()); |
69 return false; | 77 return false; |
70 } | 78 } |
71 | 79 |
72 } // namespace blink | 80 } // namespace blink |
OLD | NEW |