OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
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 22 matching lines...) Expand all Loading... |
33 #include "core/dom/ExecutionContext.h" | 33 #include "core/dom/ExecutionContext.h" |
34 #include "core/events/EventQueue.h" | 34 #include "core/events/EventQueue.h" |
35 #include "modules/IndexedDBNames.h" | 35 #include "modules/IndexedDBNames.h" |
36 #include "modules/indexeddb/IDBDatabase.h" | 36 #include "modules/indexeddb/IDBDatabase.h" |
37 #include "modules/indexeddb/IDBEventDispatcher.h" | 37 #include "modules/indexeddb/IDBEventDispatcher.h" |
38 #include "modules/indexeddb/IDBIndex.h" | 38 #include "modules/indexeddb/IDBIndex.h" |
39 #include "modules/indexeddb/IDBObjectStore.h" | 39 #include "modules/indexeddb/IDBObjectStore.h" |
40 #include "modules/indexeddb/IDBOpenDBRequest.h" | 40 #include "modules/indexeddb/IDBOpenDBRequest.h" |
41 #include "modules/indexeddb/IDBTracing.h" | 41 #include "modules/indexeddb/IDBTracing.h" |
42 #include "wtf/PtrUtil.h" | 42 #include "wtf/PtrUtil.h" |
| 43 |
43 #include <memory> | 44 #include <memory> |
44 | 45 |
45 using blink::WebIDBDatabase; | 46 using blink::WebIDBDatabase; |
46 | 47 |
47 namespace blink { | 48 namespace blink { |
48 | 49 |
| 50 IDBTransaction* IDBTransaction::createObserver( |
| 51 ExecutionContext* executionContext, |
| 52 int64_t id, |
| 53 const HashSet<String>& scope, |
| 54 IDBDatabase* db) { |
| 55 DCHECK(!scope.isEmpty()) << "Observer transactions must operate on a " |
| 56 "well-defined set of stores"; |
| 57 IDBTransaction* transaction = |
| 58 new IDBTransaction(executionContext, id, scope, db); |
| 59 return transaction; |
| 60 } |
| 61 |
49 IDBTransaction* IDBTransaction::createNonVersionChange( | 62 IDBTransaction* IDBTransaction::createNonVersionChange( |
50 ScriptState* scriptState, | 63 ScriptState* scriptState, |
51 int64_t id, | 64 int64_t id, |
52 const HashSet<String>& scope, | 65 const HashSet<String>& scope, |
53 WebIDBTransactionMode mode, | 66 WebIDBTransactionMode mode, |
54 IDBDatabase* db) { | 67 IDBDatabase* db) { |
55 DCHECK_NE(mode, WebIDBTransactionModeVersionChange); | 68 DCHECK_NE(mode, WebIDBTransactionModeVersionChange); |
56 DCHECK(!scope.isEmpty()) << "Non-version transactions should operate on a " | 69 DCHECK(!scope.isEmpty()) << "Non-version transactions should operate on a " |
57 "well-defined set of stores"; | 70 "well-defined set of stores"; |
58 return new IDBTransaction(scriptState, id, scope, mode, db); | 71 return new IDBTransaction(scriptState, id, scope, mode, db); |
(...skipping 25 matching lines...) Expand all Loading... |
84 | 97 |
85 private: | 98 private: |
86 explicit DeactivateTransactionTask(IDBTransaction* transaction) | 99 explicit DeactivateTransactionTask(IDBTransaction* transaction) |
87 : m_transaction(transaction) {} | 100 : m_transaction(transaction) {} |
88 | 101 |
89 Persistent<IDBTransaction> m_transaction; | 102 Persistent<IDBTransaction> m_transaction; |
90 }; | 103 }; |
91 | 104 |
92 } // namespace | 105 } // namespace |
93 | 106 |
| 107 IDBTransaction::IDBTransaction(ExecutionContext* executionContext, |
| 108 int64_t id, |
| 109 const HashSet<String>& scope, |
| 110 IDBDatabase* db) |
| 111 : ContextLifecycleObserver(executionContext), |
| 112 m_id(id), |
| 113 m_database(db), |
| 114 m_mode(WebIDBTransactionModeReadOnly), |
| 115 m_scope(scope), |
| 116 m_state(Active) { |
| 117 DCHECK(m_database); |
| 118 DCHECK(!m_scope.isEmpty()) << "Observer transactions must operate " |
| 119 "on a well-defined set of stores"; |
| 120 m_database->transactionCreated(this); |
| 121 } |
| 122 |
94 IDBTransaction::IDBTransaction(ScriptState* scriptState, | 123 IDBTransaction::IDBTransaction(ScriptState* scriptState, |
95 int64_t id, | 124 int64_t id, |
96 const HashSet<String>& scope, | 125 const HashSet<String>& scope, |
97 WebIDBTransactionMode mode, | 126 WebIDBTransactionMode mode, |
98 IDBDatabase* db) | 127 IDBDatabase* db) |
99 : ContextLifecycleObserver(scriptState->getExecutionContext()), | 128 : ContextLifecycleObserver(scriptState->getExecutionContext()), |
100 m_id(id), | 129 m_id(id), |
101 m_database(db), | 130 m_database(db), |
102 m_mode(mode), | 131 m_mode(mode), |
103 m_scope(scope) { | 132 m_scope(scope) { |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 IDBObjectStore* objectStore = it.key; | 596 IDBObjectStore* objectStore = it.key; |
568 objectStore->clearIndexCache(); | 597 objectStore->clearIndexCache(); |
569 } | 598 } |
570 m_oldStoreMetadata.clear(); | 599 m_oldStoreMetadata.clear(); |
571 | 600 |
572 m_deletedIndexes.clear(); | 601 m_deletedIndexes.clear(); |
573 m_deletedObjectStores.clear(); | 602 m_deletedObjectStores.clear(); |
574 } | 603 } |
575 | 604 |
576 } // namespace blink | 605 } // namespace blink |
OLD | NEW |