| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2011 Google, Inc. All Rights Reserved. | 3 * Copyright (C) 2011 Google, Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // because the database closing process may still make use of this context. | 127 // because the database closing process may still make use of this context. |
| 128 // It is not safe to just delete the context here. | 128 // It is not safe to just delete the context here. |
| 129 void DatabaseContext::contextDestroyed() | 129 void DatabaseContext::contextDestroyed() |
| 130 { | 130 { |
| 131 RefPtrWillBeRawPtr<DatabaseContext> protector(this); | 131 RefPtrWillBeRawPtr<DatabaseContext> protector(this); |
| 132 stopDatabases(); | 132 stopDatabases(); |
| 133 DatabaseManager::manager().unregisterDatabaseContext(this); | 133 DatabaseManager::manager().unregisterDatabaseContext(this); |
| 134 ActiveDOMObject::contextDestroyed(); | 134 ActiveDOMObject::contextDestroyed(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 // stop() is from stopActiveDOMObjects() which indicates that the owner LocalFra
me | 137 // stop() is from stopActiveDOMObjects() which indicates that the owner |
| 138 // or WorkerThread is shutting down. Initiate the orderly shutdown by stopping | 138 // LocalFrame is shutting down. Initiate the orderly shutdown by stopping the |
| 139 // the associated databases. | 139 // associated databases. |
| 140 void DatabaseContext::stop() | 140 void DatabaseContext::stop() |
| 141 { | 141 { |
| 142 stopDatabases(); | 142 stopDatabases(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 DatabaseContext* DatabaseContext::backend() | 145 DatabaseContext* DatabaseContext::backend() |
| 146 { | 146 { |
| 147 return this; | 147 return this; |
| 148 } | 148 } |
| 149 | 149 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 180 if (m_databaseThread && !m_hasRequestedTermination) { | 180 if (m_databaseThread && !m_hasRequestedTermination) { |
| 181 TaskSynchronizer sync; | 181 TaskSynchronizer sync; |
| 182 m_databaseThread->requestTermination(&sync); | 182 m_databaseThread->requestTermination(&sync); |
| 183 m_hasRequestedTermination = true; | 183 m_hasRequestedTermination = true; |
| 184 sync.waitForTaskCompletion(); | 184 sync.waitForTaskCompletion(); |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 bool DatabaseContext::allowDatabaseAccess() const | 188 bool DatabaseContext::allowDatabaseAccess() const |
| 189 { | 189 { |
| 190 if (executionContext()->isDocument()) | 190 return toDocument(executionContext())->isActive(); |
| 191 return toDocument(executionContext())->isActive(); | |
| 192 ASSERT(executionContext()->isWorkerGlobalScope()); | |
| 193 // allowDatabaseAccess is not yet implemented for workers. | |
| 194 return true; | |
| 195 } | 191 } |
| 196 | 192 |
| 197 SecurityOrigin* DatabaseContext::securityOrigin() const | 193 SecurityOrigin* DatabaseContext::securityOrigin() const |
| 198 { | 194 { |
| 199 return executionContext()->securityOrigin(); | 195 return executionContext()->securityOrigin(); |
| 200 } | 196 } |
| 201 | 197 |
| 202 bool DatabaseContext::isContextThread() const | 198 bool DatabaseContext::isContextThread() const |
| 203 { | 199 { |
| 204 return executionContext()->isContextThread(); | 200 return executionContext()->isContextThread(); |
| 205 } | 201 } |
| 206 | 202 |
| 207 } // namespace blink | 203 } // namespace blink |
| OLD | NEW |