| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
| 10 #include "crypto/random.h" | 10 #include "crypto/random.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 const std::string& script_uri, | 253 const std::string& script_uri, |
| 254 const std::string& package_root, | 254 const std::string& package_root, |
| 255 char** error) { | 255 char** error) { |
| 256 IsolateData* isolate_data = new IsolateData( | 256 IsolateData* isolate_data = new IsolateData( |
| 257 dart_app, | 257 dart_app, |
| 258 strict_compilation, | 258 strict_compilation, |
| 259 callbacks, | 259 callbacks, |
| 260 script, | 260 script, |
| 261 script_uri, | 261 script_uri, |
| 262 package_root); | 262 package_root); |
| 263 Dart_Isolate isolate = Dart_CreateIsolate( | 263 Dart_Isolate isolate = |
| 264 script_uri.c_str(), "main", isolate_snapshot_buffer, isolate_data, error); | 264 Dart_CreateIsolate(script_uri.c_str(), "main", isolate_snapshot_buffer, |
| 265 nullptr, isolate_data, error); |
| 265 if (isolate == nullptr) { | 266 if (isolate == nullptr) { |
| 266 delete isolate_data; | 267 delete isolate_data; |
| 267 return nullptr; | 268 return nullptr; |
| 268 } | 269 } |
| 269 | 270 |
| 270 Dart_EnterScope(); | 271 Dart_EnterScope(); |
| 271 | 272 |
| 272 Dart_IsolateSetStrictCompilation(strict_compilation); | 273 Dart_IsolateSetStrictCompilation(strict_compilation); |
| 273 | 274 |
| 274 // Set up the library tag handler for this isolate. | 275 // Set up the library tag handler for this isolate. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 Dart_ShutdownIsolate(); | 346 Dart_ShutdownIsolate(); |
| 346 return nullptr; | 347 return nullptr; |
| 347 } | 348 } |
| 348 | 349 |
| 349 return isolate; | 350 return isolate; |
| 350 } | 351 } |
| 351 | 352 |
| 352 Dart_Isolate DartController::IsolateCreateCallback(const char* script_uri, | 353 Dart_Isolate DartController::IsolateCreateCallback(const char* script_uri, |
| 353 const char* main, | 354 const char* main, |
| 354 const char* package_root, | 355 const char* package_root, |
| 356 Dart_IsolateFlags* flags, |
| 355 void* callback_data, | 357 void* callback_data, |
| 356 char** error) { | 358 char** error) { |
| 357 IsolateData* parent_isolate_data = | 359 IsolateData* parent_isolate_data = |
| 358 reinterpret_cast<IsolateData*>(callback_data); | 360 reinterpret_cast<IsolateData*>(callback_data); |
| 359 std::string script_uri_string; | 361 std::string script_uri_string; |
| 360 std::string package_root_string; | 362 std::string package_root_string; |
| 361 | 363 |
| 362 if (script_uri == nullptr) { | 364 if (script_uri == nullptr) { |
| 363 if (callback_data == nullptr) { | 365 if (callback_data == nullptr) { |
| 364 *error = strdup("Invalid 'callback_data' - Unable to spawn new isolate"); | 366 *error = strdup("Invalid 'callback_data' - Unable to spawn new isolate"); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 | 752 |
| 751 void DartController::Shutdown() { | 753 void DartController::Shutdown() { |
| 752 StopHandleWatcherIsolate(); | 754 StopHandleWatcherIsolate(); |
| 753 Dart_Cleanup(); | 755 Dart_Cleanup(); |
| 754 service_isolate_running_ = false; | 756 service_isolate_running_ = false; |
| 755 initialized_ = false; | 757 initialized_ = false; |
| 756 } | 758 } |
| 757 | 759 |
| 758 } // namespace apps | 760 } // namespace apps |
| 759 } // namespace mojo | 761 } // namespace mojo |
| OLD | NEW |