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

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..9c143dbf9f5ff053ca387455a726ca1b0123ed31 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"
@@ -232,6 +233,30 @@ void DartController::createDOMEnabledIsolateIfNeeded(const String& scriptURL, co
char* errorMessage = 0;
m_isolate = createIsolate(scriptURL.utf8().data(), entryPoint.utf8().data(), document, true, &errorMessage);
ASSERT(m_isolate);
+ ASSERT(Dart_CurrentIsolate() == m_isolate);
Jacob 2013/12/04 20:39:52 why is this assert here?
Cutch 2013/12/04 21:20:50 It was just verifying my assumption. Removed.
+ Dart_ExitIsolate();
+
+ bool r = DartService::Start(document);
Jacob 2013/12/04 20:39:52 can you add a flag that controls whether the DartS
Cutch 2013/12/04 21:20:50 Done.
+ ASSERT(r);
+ ASSERT(Dart_CurrentIsolate());
+
+ Dart_EnterIsolate(m_isolate);
siva 2013/12/13 21:48:22 Why not move the EnterScope/ExitScope stuff to Sen
+ Dart_EnterScope();
+ DartService::SendIsolateStartupMessage();
+ Dart_ExitScope();
+
+ {
+ // The following is only used for testing and will be removed.
Jacob 2013/12/04 20:39:52 add a fixme for code that should be removed.
Cutch 2013/12/04 21:20:50 Done.
+ Dart_EnterScope();
+ Dart_Handle html =
+ Dart_LookupLibrary(Dart_NewStringFromCString("dart:html"));
+ ASSERT(!Dart_IsError(html));
+ Dart_Handle res = Dart_SetField(html,
+ Dart_NewStringFromCString("myPort"),
+ Dart_NewSendPort(DartService::GetRequestPort()));
+ ASSERT(!Dart_IsError(res));
+ Dart_ExitScope();
+ }
}
void DartController::shutdownIsolate(Dart_Isolate isolate)
@@ -290,7 +315,6 @@ void DartController::clearWindowShell()
if (m_isolate) {
Dart_EnterIsolate(m_isolate);
DartUtilities::disposeWeakPersistentHandles();
-
shutdownIsolate(m_isolate);
m_isolate = 0;
}
@@ -414,6 +438,9 @@ Dart_Isolate DartController::createPureIsolateCallback(const char* scriptURL, co
Document* document = static_cast<Document*>(context);
Dart_Isolate isolate = createIsolate(scriptURL, entryPoint, document, false, errorMsg);
siva 2013/12/13 21:48:22 Ditto comment about Enter/Exit Scope
+ Dart_EnterScope();
+ DartService::SendIsolateStartupMessage();
Jacob 2013/12/04 20:39:52 put enterscope, exit scope in { } by convention
Cutch 2013/12/04 21:20:50 Done.
+ Dart_ExitScope();
if (!isolate) {
// This triggers an exception in the caller.
*errorMsg = strdup("Isolate spawn failed.");
@@ -549,7 +576,6 @@ void DartController::initVMIfNeeded()
static bool hasBeenInitialized = false;
if (hasBeenInitialized)
return;
-
char flagsProp[DartUtilities::PROP_VALUE_MAX_LEN];
int propLen = DartUtilities::getProp(
"DART_FLAGS", flagsProp, DartUtilities::PROP_VALUE_MAX_LEN);
@@ -561,7 +587,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);
siva 2013/12/13 21:48:22 You should have a generic shutdown callback and i
hasBeenInitialized = true;
}

Powered by Google App Engine
This is Rietveld 408576698