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/rand_util.h" |
9 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
10 #include "crypto/random.h" | |
11 #include "dart/runtime/include/dart_api.h" | 11 #include "dart/runtime/include/dart_api.h" |
12 #include "dart/runtime/include/dart_native_api.h" | 12 #include "dart/runtime/include/dart_native_api.h" |
13 #include "mojo/dart/embedder/builtin.h" | 13 #include "mojo/dart/embedder/builtin.h" |
14 #include "mojo/dart/embedder/dart_controller.h" | 14 #include "mojo/dart/embedder/dart_controller.h" |
15 #include "mojo/dart/embedder/dart_debugger.h" | 15 #include "mojo/dart/embedder/dart_debugger.h" |
16 #include "mojo/dart/embedder/isolate_data.h" | 16 #include "mojo/dart/embedder/isolate_data.h" |
17 #include "mojo/dart/embedder/vmservice.h" | 17 #include "mojo/dart/embedder/vmservice.h" |
18 #include "mojo/public/c/system/core.h" | 18 #include "mojo/public/c/system/core.h" |
19 | 19 |
20 namespace mojo { | 20 namespace mojo { |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 result = Dart_RunLoop(); | 651 result = Dart_RunLoop(); |
652 DART_CHECK_VALID(result); | 652 DART_CHECK_VALID(result); |
653 | 653 |
654 Dart_ExitScope(); | 654 Dart_ExitScope(); |
655 Dart_ShutdownIsolate(); | 655 Dart_ShutdownIsolate(); |
656 Dart_Cleanup(); | 656 Dart_Cleanup(); |
657 return true; | 657 return true; |
658 } | 658 } |
659 | 659 |
660 static bool generateEntropy(uint8_t* buffer, intptr_t length) { | 660 static bool generateEntropy(uint8_t* buffer, intptr_t length) { |
661 crypto::RandBytes(reinterpret_cast<void*>(buffer), length); | 661 base::RandBytes(reinterpret_cast<void*>(buffer), length); |
662 return true; | 662 return true; |
663 } | 663 } |
664 | 664 |
665 bool DartController::Initialize( | 665 bool DartController::Initialize( |
666 DartControllerServiceConnector* service_connector, | 666 DartControllerServiceConnector* service_connector, |
667 bool strict_compilation) { | 667 bool strict_compilation) { |
668 service_connector_ = service_connector; | 668 service_connector_ = service_connector; |
669 strict_compilation_ = strict_compilation; | 669 strict_compilation_ = strict_compilation; |
670 InitVmIfNeeded(generateEntropy, nullptr, 0); | 670 InitVmIfNeeded(generateEntropy, nullptr, 0); |
671 return true; | 671 return true; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 741 |
742 void DartController::Shutdown() { | 742 void DartController::Shutdown() { |
743 StopHandleWatcherIsolate(); | 743 StopHandleWatcherIsolate(); |
744 Dart_Cleanup(); | 744 Dart_Cleanup(); |
745 service_isolate_running_ = false; | 745 service_isolate_running_ = false; |
746 initialized_ = false; | 746 initialized_ = false; |
747 } | 747 } |
748 | 748 |
749 } // namespace apps | 749 } // namespace apps |
750 } // namespace mojo | 750 } // namespace mojo |
OLD | NEW |