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

Unified Diff: third_party/WebKit/Source/bindings/modules/v8/custom/V8IDBObserverCustom.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/bindings/modules/v8/custom/V8IDBObserverCustom.cpp
diff --git a/third_party/WebKit/Source/bindings/modules/v8/custom/V8IDBObserverCustom.cpp b/third_party/WebKit/Source/bindings/modules/v8/custom/V8IDBObserverCustom.cpp
index a3d4e48d73ef923772049742b3bd8b4f5de7f624..f4d8fdf45fa315025f75477a972f6a5899f98ea4 100644
--- a/third_party/WebKit/Source/bindings/modules/v8/custom/V8IDBObserverCustom.cpp
+++ b/third_party/WebKit/Source/bindings/modules/v8/custom/V8IDBObserverCustom.cpp
@@ -8,7 +8,8 @@
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8DOMWrapper.h"
-#include "bindings/modules/v8/V8IDBObserverCallback.h"
+#include "bindings/core/v8/V8PrivateProperty.h"
+#include "bindings/modules/v8/IDBObserverCallback.h"
#include "bindings/modules/v8/V8IDBObserverInit.h"
namespace blink {
@@ -44,13 +45,18 @@ void V8IDBObserver::constructorCustom(
if (exceptionState.hadException())
return;
+ v8::Local<v8::Function> v8Callback = v8::Local<v8::Function>::Cast(info[0]);
IDBObserverCallback* callback =
- new V8IDBObserverCallback(v8::Local<v8::Function>::Cast(info[0]), wrapper,
- ScriptState::current(info.GetIsolate()));
- IDBObserver* observer = IDBObserver::create(*callback, idbObserverInit);
+ IDBObserverCallback::create(info.GetIsolate(), v8Callback);
+ IDBObserver* observer = IDBObserver::create(
+ ScriptState::forReceiverObject(info), callback, idbObserverInit);
if (exceptionState.hadException())
return;
DCHECK(observer);
+ // TODO(bashi): Don't set private property (and remove this custom
+ // constructor) when we can call setWrapperReference() correctly.
+ V8PrivateProperty::getIDBObserverCallback(info.GetIsolate())
+ .set(info.GetIsolate()->GetCurrentContext(), wrapper, v8Callback);
v8SetReturnValue(info,
V8DOMWrapper::associateObjectWithWrapper(
info.GetIsolate(), observer, &wrapperTypeInfo, wrapper));

Powered by Google App Engine
This is Rietveld 408576698