| 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 21 matching lines...) Expand all Loading... |
| 32 #include "core/dom/ExceptionCode.h" | 32 #include "core/dom/ExceptionCode.h" |
| 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" |
| 43 #include <memory> |
| 42 | 44 |
| 43 using blink::WebIDBDatabase; | 45 using blink::WebIDBDatabase; |
| 44 | 46 |
| 45 namespace blink { | 47 namespace blink { |
| 46 | 48 |
| 47 IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, con
st HashSet<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* d
b) | 49 IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, con
st HashSet<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* d
b) |
| 48 { | 50 { |
| 49 IDBOpenDBRequest* openDBRequest = nullptr; | 51 IDBOpenDBRequest* openDBRequest = nullptr; |
| 50 IDBTransaction* transaction = new IDBTransaction(scriptState, id, objectStor
eNames, mode, db, openDBRequest, IDBDatabaseMetadata()); | 52 IDBTransaction* transaction = new IDBTransaction(scriptState, id, objectStor
eNames, mode, db, openDBRequest, IDBDatabaseMetadata()); |
| 51 transaction->suspendIfNeeded(); | 53 transaction->suspendIfNeeded(); |
| 52 return transaction; | 54 return transaction; |
| 53 } | 55 } |
| 54 | 56 |
| 55 IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, IDB
Database* db, IDBOpenDBRequest* openDBRequest, const IDBDatabaseMetadata& previo
usMetadata) | 57 IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, IDB
Database* db, IDBOpenDBRequest* openDBRequest, const IDBDatabaseMetadata& previo
usMetadata) |
| 56 { | 58 { |
| 57 IDBTransaction* transaction = new IDBTransaction(scriptState, id, HashSet<St
ring>(), WebIDBTransactionModeVersionChange, db, openDBRequest, previousMetadata
); | 59 IDBTransaction* transaction = new IDBTransaction(scriptState, id, HashSet<St
ring>(), WebIDBTransactionModeVersionChange, db, openDBRequest, previousMetadata
); |
| 58 transaction->suspendIfNeeded(); | 60 transaction->suspendIfNeeded(); |
| 59 return transaction; | 61 return transaction; |
| 60 } | 62 } |
| 61 | 63 |
| 62 namespace { | 64 namespace { |
| 63 | 65 |
| 64 class DeactivateTransactionTask : public V8PerIsolateData::EndOfScopeTask { | 66 class DeactivateTransactionTask : public V8PerIsolateData::EndOfScopeTask { |
| 65 public: | 67 public: |
| 66 static PassOwnPtr<DeactivateTransactionTask> create(IDBTransaction* transact
ion) | 68 static std::unique_ptr<DeactivateTransactionTask> create(IDBTransaction* tra
nsaction) |
| 67 { | 69 { |
| 68 return adoptPtr(new DeactivateTransactionTask(transaction)); | 70 return wrapUnique(new DeactivateTransactionTask(transaction)); |
| 69 } | 71 } |
| 70 | 72 |
| 71 void run() override | 73 void run() override |
| 72 { | 74 { |
| 73 m_transaction->setActive(false); | 75 m_transaction->setActive(false); |
| 74 m_transaction.clear(); | 76 m_transaction.clear(); |
| 75 } | 77 } |
| 76 | 78 |
| 77 private: | 79 private: |
| 78 explicit DeactivateTransactionTask(IDBTransaction* transaction) | 80 explicit DeactivateTransactionTask(IDBTransaction* transaction) |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 event->setTarget(this); | 423 event->setTarget(this); |
| 422 eventQueue->enqueueEvent(event); | 424 eventQueue->enqueueEvent(event); |
| 423 } | 425 } |
| 424 | 426 |
| 425 WebIDBDatabase* IDBTransaction::backendDB() const | 427 WebIDBDatabase* IDBTransaction::backendDB() const |
| 426 { | 428 { |
| 427 return m_database->backend(); | 429 return m_database->backend(); |
| 428 } | 430 } |
| 429 | 431 |
| 430 } // namespace blink | 432 } // namespace blink |
| OLD | NEW |