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

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

Issue 128733002: Refactor service usage in Dartium (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1700
Patch Set: Created 6 years, 11 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/dart/DartController.cpp
diff --git a/Source/bindings/dart/DartController.cpp b/Source/bindings/dart/DartController.cpp
index ecbbfd9316979729d251191f755674f4fefbe168..663472de2b6c9077c320e30bc272554a936129ce 100644
--- a/Source/bindings/dart/DartController.cpp
+++ b/Source/bindings/dart/DartController.cpp
@@ -254,19 +254,19 @@ 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);
- if (getenv("DARTIUM_VMSERVICE")) {
+ if (true) {
Jacob 2014/01/08 18:47:10 remove if (true) {
Cutch 2014/01/10 21:34:26 Done.
// createIsolate exits with current isolate set to m_isolate, we need to
// exit it so we can startup the service.
Dart_ExitIsolate();
-
+ // Start the service.
bool result = DartService::Start(document);
UNUSED_PARAM(result);
ASSERT(result);
ASSERT(!Dart_CurrentIsolate());
-
+ // Register DOM isolate with service.
Dart_EnterIsolate(m_isolate);
Dart_EnterScope();
- DartService::SendIsolateStartupMessage();
+ Dart_RegisterWithService();
Dart_ExitScope();
}
@@ -284,8 +284,6 @@ 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;
}
@@ -408,6 +406,22 @@ private:
String m_url;
};
+
+void DartController::shutdownIsolateCallback(void* data)
Jacob 2014/01/08 18:47:10 The method name seems generic while the behavior i
Cutch 2014/01/10 21:34:26 This method was registered as the isolate shutdown
+{
+ Dart_UnregisterFromService();
+}
+
siva 2014/01/10 00:10:13 See comment in other CL, we need to see if it make
+
+Dart_Isolate DartController::createServiceIsolateCallback(void* callbackData, char** error)
+{
+ Document* document = static_cast<Document*>(callbackData);
+ Dart_Isolate serviceIsolate = DartController::createIsolate("dart:vmservice_dartium", "main", document, true, error);
Jacob 2014/01/08 18:47:10 As the package is internal only, change the name f
Cutch 2014/01/10 21:34:26 This isn't a library that a user could ever encoun
+ Dart_ExitIsolate();
+ return serviceIsolate;
+}
+
+
Dart_Isolate DartController::createPureIsolateCallback(const char* scriptURL, const char* entryPoint, void* data, char** errorMsg)
{
bool isSpawnUri = scriptURL ? true : false;
@@ -451,7 +465,7 @@ Dart_Isolate DartController::createPureIsolateCallback(const char* scriptURL, co
Dart_Isolate isolate = createIsolate(scriptURL, entryPoint, document, false, errorMsg);
{
Dart_EnterScope();
- DartService::SendIsolateStartupMessage();
+ Dart_RegisterWithService();
Dart_ExitScope();
}
@@ -600,9 +614,8 @@ void DartController::initVMIfNeeded()
setDartFlags(0);
}
- // FIXME(antonm): implement proper shutdown callback.
// FIXME(antonm): implement proper unhandled exception callback.
- Dart_Initialize(&createPureIsolateCallback, 0, 0, DartService::VmServiceShutdownCallback, openFileCallback, readFileCallback, writeFileCallback, closeFileCallback, generateEntropy);
+ Dart_Initialize(&createPureIsolateCallback, 0, 0, shutdownIsolateCallback, openFileCallback, readFileCallback, writeFileCallback, closeFileCallback, generateEntropy, createServiceIsolateCallback);
hasBeenInitialized = true;
}

Powered by Google App Engine
This is Rietveld 408576698