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

Unified Diff: Source/bindings/v8/V8GCController.cpp

Issue 15294004: Implement V8ScriptRunner::compileAndRunInternalScript() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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: Source/bindings/v8/V8GCController.cpp
diff --git a/Source/bindings/v8/V8GCController.cpp b/Source/bindings/v8/V8GCController.cpp
index fc53af3a550380da85782aa3f3a16158c512c709..c2f21131afd3c5b5a8d168427d0a6993051c2b4f 100644
--- a/Source/bindings/v8/V8GCController.cpp
+++ b/Source/bindings/v8/V8GCController.cpp
@@ -34,6 +34,7 @@
#include "V8MessagePort.h"
#include "V8MutationObserver.h"
#include "V8Node.h"
+#include "V8ScriptRunner.h"
#include "bindings/v8/RetainedDOMInfo.h"
#include "bindings/v8/V8AbstractEventListener.h"
#include "bindings/v8/V8Binding.h"
@@ -415,28 +416,9 @@ void V8GCController::hintForCollectGarbage()
v8::V8::IdleNotification(longIdlePauseInMS);
}
-void V8GCController::collectGarbage()
+void V8GCController::collectGarbage(v8::Isolate* isolate)
{
- v8::Isolate* isolate = v8::Isolate::GetCurrent();
- v8::HandleScope handleScope(isolate);
-
- ScopedPersistent<v8::Context> context;
- context.set(v8::Context::New(isolate));
- if (context.isEmpty())
- return;
-
- {
- v8::Context::Scope scope(context.get());
- v8::Local<v8::String> source = v8::String::New("if (gc) gc();");
- v8::Local<v8::String> name = v8::String::New("gc");
- v8::Handle<v8::Script> script = v8::Script::Compile(source, name);
- if (!script.IsEmpty()) {
- V8RecursionScope::MicrotaskSuppression scope;
- script->Run();
- }
- }
-
- context.clear();
+ V8ScriptRunner::compileAndRunInternalScript(v8String("if (gc) gc();", isolate), isolate);
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698