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

Unified Diff: third_party/WebKit/Source/bindings/modules/v8/V8IDBObserverCallback.cpp

Issue 2125213002: [IndexedDB] Propogating changes to observers : Renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lifetime
Patch Set: Implements Map in IDBObserverChanges idl Created 4 years, 5 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/bindings/modules/v8/V8IDBObserverCallback.cpp
diff --git a/third_party/WebKit/Source/bindings/modules/v8/V8IDBObserverCallback.cpp b/third_party/WebKit/Source/bindings/modules/v8/V8IDBObserverCallback.cpp
index dd61fb10df142e256e12b35b2ff431034889a96f..46bc36163fcc5fc4e2f22445157a6701207db2e4 100644
--- a/third_party/WebKit/Source/bindings/modules/v8/V8IDBObserverCallback.cpp
+++ b/third_party/WebKit/Source/bindings/modules/v8/V8IDBObserverCallback.cpp
@@ -5,9 +5,12 @@
#include "bindings/modules/v8/V8IDBObserverCallback.h"
#include "bindings/core/v8/ScriptController.h"
+#include "bindings/core/v8/ToV8.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8PrivateProperty.h"
#include "bindings/modules/v8/V8IDBObserver.h"
+#include "bindings/modules/v8/V8IDBObserverChanges.h"
+#include "wtf/Assertions.h"
namespace blink {
@@ -24,6 +27,39 @@ V8IDBObserverCallback::~V8IDBObserverCallback()
{
}
+void V8IDBObserverCallback::handleEvent(IDBObserverChanges& changes, IDBObserver& observer)
+{
+ if (!canInvokeCallback())
+ return;
+
+ if (!m_scriptState->contextIsValid())
+ return;
+ ScriptState::Scope scope(m_scriptState.get());
+
+ if (m_callback.isEmpty())
+ return;
+ v8::Local<v8::Value> observerHandle = toV8(&observer, m_scriptState->context()->Global(), m_scriptState->isolate());
+ if (observerHandle.IsEmpty()) {
+ if (!isScriptControllerTerminating())
+ CRASH();
+ return;
+ }
+
+ if (!observerHandle->IsObject())
+ return;
+
+ v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandle);
+ v8::Local<v8::Value> changesHandle = toV8(&changes, m_scriptState->context()->Global(), m_scriptState->isolate());
+ if (changesHandle.IsEmpty()) {
+ return;
+ }
+ v8::Local<v8::Value> argv[] = { changesHandle };
+
+ v8::TryCatch exceptionCatcher(m_scriptState->isolate());
+ exceptionCatcher.SetVerbose(true);
+ V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), thisObject, 1, argv, m_scriptState->isolate());
+}
+
DEFINE_TRACE(V8IDBObserverCallback)
{
IDBObserverCallback::trace(visitor);

Powered by Google App Engine
This is Rietveld 408576698