| Index: sky/engine/core/script/dart_controller.cc
|
| diff --git a/sky/engine/core/script/dart_controller.cc b/sky/engine/core/script/dart_controller.cc
|
| index e03cb3435de57e626d29c91ecb6e5e2abd3ae53e..b0b1639438d308ad14b950e83a1418d6fab395e8 100644
|
| --- a/sky/engine/core/script/dart_controller.cc
|
| +++ b/sky/engine/core/script/dart_controller.cc
|
| @@ -52,7 +52,7 @@ static const char* kCheckedModeArgs[] = {
|
| extern const uint8_t* kDartVmIsolateSnapshotBuffer;
|
| extern const uint8_t* kDartIsolateSnapshotBuffer;
|
|
|
| -DartController::DartController() {
|
| +DartController::DartController() : weak_factory_(this) {
|
| }
|
|
|
| DartController::~DartController() {
|
| @@ -107,6 +107,24 @@ Dart_Handle DartController::CreateLibrary(AbstractModule* module,
|
| return library;
|
| }
|
|
|
| +void DartController::DidLoadMainLibrary(KURL url) {
|
| + DCHECK(Dart_CurrentIsolate() == dart_state()->isolate());
|
| + DartApiScope dart_api_scope;
|
| +
|
| + Dart_Handle library = Dart_LookupLibrary(
|
| + StringToDart(dart_state(), url.string()));
|
| + CHECK(!LogIfError(library));
|
| + DartInvokeAppField(library, ToDart("main"), 0, nullptr);
|
| +}
|
| +
|
| +void DartController::LoadMainLibrary(const KURL& url) {
|
| + DartLoader& loader = dart_state()->loader();
|
| + DartDependencyCatcher dependency_catcher(loader);
|
| + loader.LoadLibrary(url);
|
| + loader.WaitForDependencies(dependency_catcher.dependencies(),
|
| + base::Bind(&DartController::DidLoadMainLibrary, weak_factory_.GetWeakPtr(), url));
|
| +}
|
| +
|
| void DartController::LoadScriptInModule(
|
| AbstractModule* module,
|
| const String& source,
|
|
|