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

Unified Diff: Source/bindings/dart/DartController.cpp

Issue 104433004: Enable VM service inside Dartium Renderer processes (Closed) Base URL: svn://svn.chromium.org/multivm/branches/1650/blink
Patch Set: Created 7 years 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/dart/DartController.cpp
diff --git a/Source/bindings/dart/DartController.cpp b/Source/bindings/dart/DartController.cpp
index 7890130f63e4ac3bdf5df39313e70033bb3914bc..de7baafe801de4d40fc61a6e9b053650f9bd0a3d 100644
--- a/Source/bindings/dart/DartController.cpp
+++ b/Source/bindings/dart/DartController.cpp
@@ -36,6 +36,7 @@
#include "DartDocument.h"
+#include "DartService.h"
#include "DartWindow.h"
#include "HTMLNames.h"
#include "bindings/dart/DartApplicationLoader.h"
@@ -222,16 +223,35 @@ Dart_Isolate DartController::createIsolate(const char* scriptURL, const char* en
return isolate;
}
+
void DartController::createDOMEnabledIsolateIfNeeded(const String& scriptURL, const String& entryPoint, Document* document)
{
if (m_isolate) {
Dart_EnterIsolate(m_isolate);
return;
}
+
+ bool shouldStartService = !getenv("DARTIUM_VMSERVICE");
Jacob 2013/12/05 22:59:58 remove this local variable and include this direct
Cutch 2013/12/05 23:09:37 Done.
+
// FIXME: proper error reporting.
char* errorMessage = 0;
m_isolate = createIsolate(scriptURL.utf8().data(), entryPoint.utf8().data(), document, true, &errorMessage);
ASSERT(m_isolate);
+ if (shouldStartService) {
+ // createIsolate exits with current isolate set to m_isolate, we need to
+ // exit it so we can startup the service.
+ Dart_ExitIsolate();
+
+ bool r = DartService::Start(document);
+ ASSERT(r);
+ ASSERT(!Dart_CurrentIsolate());
+
+ Dart_EnterIsolate(m_isolate);
+ Dart_EnterScope();
+ DartService::SendIsolateStartupMessage();
+ Dart_ExitScope();
+ }
+
}
void DartController::shutdownIsolate(Dart_Isolate isolate)
@@ -246,6 +266,8 @@ void DartController::shutdownIsolate(Dart_Isolate isolate)
for (DartIsolateDestructionObservers::iterator it = observers->begin(); it != observers->end(); ++it)
(*it)->isolateDestroyed();
Dart_ShutdownIsolate();
+ // Stop the service.
+ DartService::Stop();
delete domData;
}
@@ -414,6 +436,12 @@ Dart_Isolate DartController::createPureIsolateCallback(const char* scriptURL, co
Document* document = static_cast<Document*>(context);
Dart_Isolate isolate = createIsolate(scriptURL, entryPoint, document, false, errorMsg);
+ {
+ Dart_EnterScope();
+ DartService::SendIsolateStartupMessage();
+ Dart_ExitScope();
+ }
+
if (!isolate) {
// This triggers an exception in the caller.
*errorMsg = strdup("Isolate spawn failed.");
@@ -561,7 +589,7 @@ void DartController::initVMIfNeeded()
// FIXME(antonm): implement proper shutdown callback.
// FIXME(antonm): implement proper unhandled exception callback.
- Dart_Initialize(&createPureIsolateCallback, 0, 0, 0, openFileCallback, readFileCallback, writeFileCallback, closeFileCallback, generateEntropy);
+ Dart_Initialize(&createPureIsolateCallback, 0, 0, DartService::VmServiceShutdownCallback, openFileCallback, readFileCallback, writeFileCallback, closeFileCallback, generateEntropy);
hasBeenInitialized = true;
}

Powered by Google App Engine
This is Rietveld 408576698