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 10 matching lines...) Expand all Loading... |
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "modules/indexeddb/IDBTransaction.h" | 27 #include "modules/indexeddb/IDBTransaction.h" |
28 | 28 |
29 #include "bindings/core/v8/ExceptionState.h" | 29 #include "bindings/core/v8/ExceptionState.h" |
30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 31 #include "bindings/core/v8/V8PerIsolateData.h" |
31 #include "core/dom/ExecutionContext.h" | 32 #include "core/dom/ExecutionContext.h" |
32 #include "core/events/EventQueue.h" | 33 #include "core/events/EventQueue.h" |
33 #include "core/inspector/ScriptCallStack.h" | 34 #include "core/inspector/ScriptCallStack.h" |
34 #include "modules/IndexedDBNames.h" | 35 #include "modules/IndexedDBNames.h" |
35 #include "modules/indexeddb/IDBDatabase.h" | 36 #include "modules/indexeddb/IDBDatabase.h" |
36 #include "modules/indexeddb/IDBEventDispatcher.h" | 37 #include "modules/indexeddb/IDBEventDispatcher.h" |
37 #include "modules/indexeddb/IDBIndex.h" | 38 #include "modules/indexeddb/IDBIndex.h" |
38 #include "modules/indexeddb/IDBObjectStore.h" | 39 #include "modules/indexeddb/IDBObjectStore.h" |
39 #include "modules/indexeddb/IDBOpenDBRequest.h" | 40 #include "modules/indexeddb/IDBOpenDBRequest.h" |
40 #include "modules/indexeddb/IDBPendingTransactionMonitor.h" | |
41 #include "modules/indexeddb/IDBTracing.h" | 41 #include "modules/indexeddb/IDBTracing.h" |
42 | 42 |
43 using blink::WebIDBDatabase; | 43 using blink::WebIDBDatabase; |
44 | 44 |
45 namespace blink { | 45 namespace blink { |
46 | 46 |
47 IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, con
st Vector<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* db
) | 47 IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, con
st Vector<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* db
) |
48 { | 48 { |
49 IDBOpenDBRequest* openDBRequest = 0; | 49 IDBOpenDBRequest* openDBRequest = 0; |
50 IDBTransaction* transaction = adoptRefCountedGarbageCollectedWillBeNoop(new
IDBTransaction(scriptState, id, objectStoreNames, mode, db, openDBRequest, IDBDa
tabaseMetadata())); | 50 IDBTransaction* transaction = adoptRefCountedGarbageCollectedWillBeNoop(new
IDBTransaction(scriptState, id, objectStoreNames, mode, db, openDBRequest, IDBDa
tabaseMetadata())); |
(...skipping 19 matching lines...) Expand all Loading... |
70 , m_hasPendingActivity(true) | 70 , m_hasPendingActivity(true) |
71 , m_contextStopped(false) | 71 , m_contextStopped(false) |
72 , m_previousMetadata(previousMetadata) | 72 , m_previousMetadata(previousMetadata) |
73 { | 73 { |
74 if (mode == WebIDBTransactionModeVersionChange) { | 74 if (mode == WebIDBTransactionModeVersionChange) { |
75 // Not active until the callback. | 75 // Not active until the callback. |
76 m_state = Inactive; | 76 m_state = Inactive; |
77 } | 77 } |
78 | 78 |
79 if (m_state == Active) | 79 if (m_state == Active) |
80 IDBPendingTransactionMonitor::from(*scriptState->executionContext()).add
NewTransaction(*this); | 80 V8PerIsolateData::from(scriptState->isolate())->ensureIDBPendingTransact
ionMonitor()->addNewTransaction(*this); |
81 m_database->transactionCreated(this); | 81 m_database->transactionCreated(this); |
82 } | 82 } |
83 | 83 |
84 IDBTransaction::~IDBTransaction() | 84 IDBTransaction::~IDBTransaction() |
85 { | 85 { |
86 ASSERT(m_state == Finished || m_contextStopped); | 86 ASSERT(m_state == Finished || m_contextStopped); |
87 ASSERT(m_requestList.isEmpty() || m_contextStopped); | 87 ASSERT(m_requestList.isEmpty() || m_contextStopped); |
88 } | 88 } |
89 | 89 |
90 void IDBTransaction::trace(Visitor* visitor) | 90 void IDBTransaction::trace(Visitor* visitor) |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 event->setTarget(this); | 372 event->setTarget(this); |
373 eventQueue->enqueueEvent(event); | 373 eventQueue->enqueueEvent(event); |
374 } | 374 } |
375 | 375 |
376 WebIDBDatabase* IDBTransaction::backendDB() const | 376 WebIDBDatabase* IDBTransaction::backendDB() const |
377 { | 377 { |
378 return m_database->backend(); | 378 return m_database->backend(); |
379 } | 379 } |
380 | 380 |
381 } // namespace blink | 381 } // namespace blink |
OLD | NEW |