| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/core/script/dart_controller.h" | 6 #include "sky/engine/core/script/dart_controller.h" |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 DartApiScope api_scope; | 307 DartApiScope api_scope; |
| 308 LogIfError(Dart_HandleMessage()); | 308 LogIfError(Dart_HandleMessage()); |
| 309 } | 309 } |
| 310 | 310 |
| 311 static void MessageNotifyCallback(Dart_Isolate dest_isolate) { | 311 static void MessageNotifyCallback(Dart_Isolate dest_isolate) { |
| 312 DCHECK(Platform::current()); | 312 DCHECK(Platform::current()); |
| 313 Platform::current()->mainThreadTaskRunner()->PostTask(FROM_HERE, | 313 Platform::current()->mainThreadTaskRunner()->PostTask(FROM_HERE, |
| 314 base::Bind(&CallHandleMessage, DartState::From(dest_isolate)->GetWeakPtr()
)); | 314 base::Bind(&CallHandleMessage, DartState::From(dest_isolate)->GetWeakPtr()
)); |
| 315 } | 315 } |
| 316 | 316 |
| 317 void DartController::CreateIsolateFor(PassOwnPtr<DOMDartState> state, | 317 void DartController::CreateIsolateFor(PassOwnPtr<DOMDartState> state) { |
| 318 const KURL& url) { | |
| 319 CHECK(kDartIsolateSnapshotBuffer); | 318 CHECK(kDartIsolateSnapshotBuffer); |
| 320 char* error = nullptr; | 319 char* error = nullptr; |
| 321 dom_dart_state_ = state; | 320 dom_dart_state_ = state; |
| 322 Dart_Isolate isolate = Dart_CreateIsolate( | 321 Dart_Isolate isolate = Dart_CreateIsolate( |
| 323 url.string().utf8().data(), "main", kDartIsolateSnapshotBuffer, | 322 dom_dart_state_->url().string().utf8().data(), "main", |
| 323 kDartIsolateSnapshotBuffer, |
| 324 static_cast<DartState*>(dom_dart_state_.get()), &error); | 324 static_cast<DartState*>(dom_dart_state_.get()), &error); |
| 325 Dart_SetMessageNotifyCallback(MessageNotifyCallback); | 325 Dart_SetMessageNotifyCallback(MessageNotifyCallback); |
| 326 CHECK(isolate) << error; | 326 CHECK(isolate) << error; |
| 327 dom_dart_state_->set_isolate(isolate); | 327 dom_dart_state_->set_isolate(isolate); |
| 328 Dart_SetGcCallbacks(DartGCPrologue, DartGCEpilogue); | 328 Dart_SetGcCallbacks(DartGCPrologue, DartGCEpilogue); |
| 329 CHECK(!LogIfError(Dart_SetLibraryTagHandler(LibraryTagHandler))); | 329 CHECK(!LogIfError(Dart_SetLibraryTagHandler(LibraryTagHandler))); |
| 330 | 330 |
| 331 { | 331 { |
| 332 DartApiScope apiScope; | 332 DartApiScope apiScope; |
| 333 | 333 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 nullptr, // Isolate interrupt callback. | 384 nullptr, // Isolate interrupt callback. |
| 385 UnhandledExceptionCallback, IsolateShutdownCallback, | 385 UnhandledExceptionCallback, IsolateShutdownCallback, |
| 386 // File IO callbacks. | 386 // File IO callbacks. |
| 387 nullptr, nullptr, nullptr, nullptr, nullptr)); | 387 nullptr, nullptr, nullptr, nullptr, nullptr)); |
| 388 // Wait for load port- ensures handle watcher and service isolates are | 388 // Wait for load port- ensures handle watcher and service isolates are |
| 389 // running. | 389 // running. |
| 390 Dart_ServiceWaitForLoadPort(); | 390 Dart_ServiceWaitForLoadPort(); |
| 391 } | 391 } |
| 392 | 392 |
| 393 } // namespace blink | 393 } // namespace blink |
| OLD | NEW |