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

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

Issue 2709703004: Clean up V8ObjectConstructor (Closed)
Patch Set: Rebase 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..9536093bf8465d4ed9b527387f9eb0882a96a270 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8ObjectConstructor.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8ObjectConstructor.cpp
@@ -25,40 +25,24 @@
#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 {
v8::MaybeLocal<v8::Object> V8ObjectConstructor::newInstance(
v8::Isolate* isolate,
- v8::Local<v8::Function> function) {
- ASSERT(!function.IsEmpty());
- ConstructorMode constructorMode(isolate);
- return V8ScriptRunner::instantiateObject(isolate, function);
-}
-
-v8::MaybeLocal<v8::Object> V8ObjectConstructor::newInstance(
- v8::Isolate* isolate,
v8::Local<v8::Function> function,
int argc,
v8::Local<v8::Value> argv[]) {
ASSERT(!function.IsEmpty());
+ TRACE_EVENT0("v8", "v8.newInstance");
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);
+ v8::MicrotasksScope microtasksScope(isolate,
+ v8::MicrotasksScope::kDoNotRunMicrotasks);
+ v8::MaybeLocal<v8::Object> result =
+ function->NewInstance(isolate->GetCurrentContext(), argc, argv);
+ CHECK(!isolate->IsDead());
+ return result;
}
void V8ObjectConstructor::isValidConstructorMode(

Powered by Google App Engine
This is Rietveld 408576698