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

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

Issue 2397363002: Replace hand-written IDBObserverCallback with auto-generated code (Closed)
Patch Set: rebase Created 4 years, 2 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/IDBObserver.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObserver.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBObserver.cpp
index 30f18a761ed6231acd9f4aaaee84030a2d8b7aa2..88ea10eb6f41547522b4750fe40a3405a1d5108c 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBObserver.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBObserver.cpp
@@ -5,12 +5,12 @@
#include "modules/indexeddb/IDBObserver.h"
#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/modules/v8/IDBObserverCallback.h"
#include "bindings/modules/v8/ToV8ForModules.h"
#include "bindings/modules/v8/V8BindingForModules.h"
#include "core/dom/ExceptionCode.h"
#include "modules/IndexedDBNames.h"
#include "modules/indexeddb/IDBDatabase.h"
-#include "modules/indexeddb/IDBObserverCallback.h"
#include "modules/indexeddb/IDBObserverChanges.h"
#include "modules/indexeddb/IDBObserverInit.h"
#include "modules/indexeddb/IDBTransaction.h"
@@ -18,14 +18,17 @@
namespace blink {
-IDBObserver* IDBObserver::create(IDBObserverCallback& callback,
+IDBObserver* IDBObserver::create(ScriptState* scriptState,
+ IDBObserverCallback* callback,
const IDBObserverInit& options) {
- return new IDBObserver(callback, options);
+ return new IDBObserver(scriptState, callback, options);
}
-IDBObserver::IDBObserver(IDBObserverCallback& callback,
+IDBObserver::IDBObserver(ScriptState* scriptState,
+ IDBObserverCallback* callback,
const IDBObserverInit& options)
- : m_callback(&callback),
+ : m_scriptState(scriptState),
+ m_callback(callback),
m_transaction(options.transaction()),
m_values(options.values()),
m_noRecords(options.noRecords()) {
@@ -99,9 +102,12 @@ void IDBObserver::onChange(int32_t id,
const WebVector<int32_t>& observationIndex) {
auto it = m_observerIds.find(id);
DCHECK(it != m_observerIds.end());
- m_callback->handleChanges(
- *IDBObserverChanges::create(it->value, observations, observationIndex),
- *this);
+ // TODO(bashi): Make sure that using TrackExceptionState is OK.
+ // crbug.com/653769
+ TrackExceptionState exceptionState;
+ m_callback->call(
+ m_scriptState.get(), this, exceptionState,
+ IDBObserverChanges::create(it->value, observations, observationIndex));
}
DEFINE_TRACE(IDBObserver) {
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBObserver.h ('k') | third_party/WebKit/Source/modules/indexeddb/IDBObserver.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698