| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "platform/weborigin/SecurityOriginHash.h" | 43 #include "platform/weborigin/SecurityOriginHash.h" |
| 44 #include "public/platform/Platform.h" | 44 #include "public/platform/Platform.h" |
| 45 #include "public/platform/WebDatabaseObserver.h" | 45 #include "public/platform/WebDatabaseObserver.h" |
| 46 #include "wtf/Assertions.h" | 46 #include "wtf/Assertions.h" |
| 47 #include "wtf/StdLibExtras.h" | 47 #include "wtf/StdLibExtras.h" |
| 48 | 48 |
| 49 namespace blink { | 49 namespace blink { |
| 50 | 50 |
| 51 static void databaseClosed(DatabaseBackendBase* database) | 51 static void databaseClosed(DatabaseBackendBase* database) |
| 52 { | 52 { |
| 53 if (blink::Platform::current()->databaseObserver()) { | 53 if (Platform::current()->databaseObserver()) { |
| 54 blink::Platform::current()->databaseObserver()->databaseClosed( | 54 Platform::current()->databaseObserver()->databaseClosed( |
| 55 createDatabaseIdentifierFromSecurityOrigin(database->securityOrigin(
)), | 55 createDatabaseIdentifierFromSecurityOrigin(database->securityOrigin(
)), |
| 56 database->stringIdentifier()); | 56 database->stringIdentifier()); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 DatabaseTracker& DatabaseTracker::tracker() | 60 DatabaseTracker& DatabaseTracker::tracker() |
| 61 { | 61 { |
| 62 AtomicallyInitializedStatic(DatabaseTracker&, tracker = *new DatabaseTracker
()); | 62 AtomicallyInitializedStatic(DatabaseTracker&, tracker = *new DatabaseTracker
()); |
| 63 return tracker; | 63 return tracker; |
| 64 } | 64 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 ExecutionContext* executionContext = database->databaseContext()->executionC
ontext(); | 162 ExecutionContext* executionContext = database->databaseContext()->executionC
ontext(); |
| 163 if (!executionContext->isContextThread()) | 163 if (!executionContext->isContextThread()) |
| 164 executionContext->postTask(NotifyDatabaseObserverOnCloseTask::create(dat
abase)); | 164 executionContext->postTask(NotifyDatabaseObserverOnCloseTask::create(dat
abase)); |
| 165 else | 165 else |
| 166 databaseClosed(database); | 166 databaseClosed(database); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void DatabaseTracker::prepareToOpenDatabase(DatabaseBackendBase* database) | 169 void DatabaseTracker::prepareToOpenDatabase(DatabaseBackendBase* database) |
| 170 { | 170 { |
| 171 ASSERT(database->databaseContext()->executionContext()->isContextThread()); | 171 ASSERT(database->databaseContext()->executionContext()->isContextThread()); |
| 172 if (blink::Platform::current()->databaseObserver()) { | 172 if (Platform::current()->databaseObserver()) { |
| 173 blink::Platform::current()->databaseObserver()->databaseOpened( | 173 Platform::current()->databaseObserver()->databaseOpened( |
| 174 createDatabaseIdentifierFromSecurityOrigin(database->securityOrigin(
)), | 174 createDatabaseIdentifierFromSecurityOrigin(database->securityOrigin(
)), |
| 175 database->stringIdentifier(), | 175 database->stringIdentifier(), |
| 176 database->displayName(), | 176 database->displayName(), |
| 177 database->estimatedSize()); | 177 database->estimatedSize()); |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 | 180 |
| 181 void DatabaseTracker::failedToOpenDatabase(DatabaseBackendBase* database) | 181 void DatabaseTracker::failedToOpenDatabase(DatabaseBackendBase* database) |
| 182 { | 182 { |
| 183 ExecutionContext* executionContext = database->databaseContext()->executionC
ontext(); | 183 ExecutionContext* executionContext = database->databaseContext()->executionC
ontext(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 DatabaseSet::iterator found = databaseSet->find(database); | 284 DatabaseSet::iterator found = databaseSet->find(database); |
| 285 if (found == databaseSet->end()) | 285 if (found == databaseSet->end()) |
| 286 return; | 286 return; |
| 287 } | 287 } |
| 288 | 288 |
| 289 // And we have to call closeImmediately() without our collection lock being
held. | 289 // And we have to call closeImmediately() without our collection lock being
held. |
| 290 database->closeImmediately(); | 290 database->closeImmediately(); |
| 291 } | 291 } |
| 292 | 292 |
| 293 } | 293 } // namespace blink |
| OLD | NEW |