Chromium Code Reviews| 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 |
|
haraken
2016/10/07 07:23:35
BTW, is there any scenario where we want to handle
bashi
2016/10/07 07:37:31
(Forgot to reply this...)
Yeah, if we don't have
|
| + TrackExceptionState exceptionState; |
| + m_callback->call( |
| + m_scriptState.get(), this, exceptionState, |
| + IDBObserverChanges::create(it->value, observations, observationIndex)); |
| } |
| DEFINE_TRACE(IDBObserver) { |