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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8ObjectConstructor.cpp

Issue 2709703004: Clean up V8ObjectConstructor (Closed)
Patch Set: Created 3 years, 10 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/core/v8/V8ObjectConstructor.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ObjectConstructor.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ObjectConstructor.cpp
index c7c9fe020f421caac35e574149fd3aa161026d00..8d503346a37c78cb81aba325664e244ede5ce51f 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8ObjectConstructor.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8ObjectConstructor.cpp
@@ -25,9 +25,6 @@
#include "bindings/core/v8/V8ObjectConstructor.h"
#include "bindings/core/v8/V8Binding.h"
-#include "bindings/core/v8/V8ScriptRunner.h"
-#include "core/dom/Document.h"
-#include "core/frame/LocalFrame.h"
#include "platform/instrumentation/tracing/TraceEvent.h"
namespace blink {
@@ -37,7 +34,7 @@ v8::MaybeLocal<v8::Object> V8ObjectConstructor::newInstance(
v8::Local<v8::Function> function) {
ASSERT(!function.IsEmpty());
ConstructorMode constructorMode(isolate);
- return V8ScriptRunner::instantiateObject(isolate, function);
+ return instantiateObject(isolate, function);
}
v8::MaybeLocal<v8::Object> V8ObjectConstructor::newInstance(
@@ -47,18 +44,7 @@ v8::MaybeLocal<v8::Object> V8ObjectConstructor::newInstance(
v8::Local<v8::Value> argv[]) {
ASSERT(!function.IsEmpty());
ConstructorMode constructorMode(isolate);
- return V8ScriptRunner::instantiateObject(isolate, function, argc, argv);
-}
-
-v8::MaybeLocal<v8::Object> V8ObjectConstructor::newInstanceInDocument(
- v8::Isolate* isolate,
- v8::Local<v8::Function> function,
- int argc,
- v8::Local<v8::Value> argv[],
- Document* document) {
- ASSERT(!function.IsEmpty());
- return V8ScriptRunner::instantiateObjectInDocument(isolate, function,
- document, argc, argv);
+ return instantiateObject(isolate, function, argc, argv);
}
void V8ObjectConstructor::isValidConstructorMode(
@@ -71,4 +57,19 @@ void V8ObjectConstructor::isValidConstructorMode(
v8SetReturnValue(info, info.Holder());
}
+v8::MaybeLocal<v8::Object> V8ObjectConstructor::instantiateObject(
jbroman 2017/02/21 22:10:28 Why not go further and just inline this into newIn
adithyas 2017/02/21 22:37:41 Okay, done.
+ v8::Isolate* isolate,
+ v8::Local<v8::Function> function,
+ int argc,
+ v8::Local<v8::Value> argv[]) {
+ TRACE_EVENT0("v8", "v8.newInstance");
+
+ v8::MicrotasksScope microtasksScope(isolate,
+ v8::MicrotasksScope::kDoNotRunMicrotasks);
+ v8::MaybeLocal<v8::Object> result =
+ function->NewInstance(isolate->GetCurrentContext(), argc, argv);
+ crashIfIsolateIsDead(isolate);
+ return result;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698