Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp

Issue 2601983002: [IndexedDB] Adding transaction and value support to observers (Closed)
Patch Set: fixed bit check Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp
index 7efb5056a6ec0411888cf7f1faa27a85436c41f2..f0a84e102cc89607d1002902742884e00bc7e001 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp
@@ -41,12 +41,25 @@
#include "modules/indexeddb/IDBOpenDBRequest.h"
#include "modules/indexeddb/IDBTracing.h"
#include "wtf/PtrUtil.h"
+
#include <memory>
using blink::WebIDBDatabase;
namespace blink {
+IDBTransaction* IDBTransaction::createObserver(
+ ExecutionContext* executionContext,
+ int64_t id,
+ const HashSet<String>& scope,
+ IDBDatabase* db) {
+ DCHECK(!scope.isEmpty()) << "Observer transactions must operate on a "
+ "well-defined set of stores";
+ IDBTransaction* transaction =
+ new IDBTransaction(executionContext, id, scope, db);
+ return transaction;
+}
+
IDBTransaction* IDBTransaction::createNonVersionChange(
ScriptState* scriptState,
int64_t id,
@@ -92,6 +105,22 @@ class DeactivateTransactionTask : public V8PerIsolateData::EndOfScopeTask {
} // namespace
+IDBTransaction::IDBTransaction(ExecutionContext* executionContext,
+ int64_t id,
+ const HashSet<String>& scope,
+ IDBDatabase* db)
+ : ContextLifecycleObserver(executionContext),
+ m_id(id),
+ m_database(db),
+ m_mode(WebIDBTransactionModeReadOnly),
+ m_scope(scope),
+ m_state(Active) {
+ DCHECK(m_database);
+ DCHECK(!m_scope.isEmpty()) << "Observer transactions must operate "
+ "on a well-defined set of stores";
+ m_database->transactionCreated(this);
+}
+
IDBTransaction::IDBTransaction(ScriptState* scriptState,
int64_t id,
const HashSet<String>& scope,

Powered by Google App Engine
This is Rietveld 408576698