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/core/script/dart_controller.h" | 5 #include "sky/engine/core/script/dart_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 void DartController::RunFromLibrary(const String& name, | 109 void DartController::RunFromLibrary(const String& name, |
110 DartLibraryProvider* library_provider) { | 110 DartLibraryProvider* library_provider) { |
111 DartState::Scope scope(dart_state()); | 111 DartState::Scope scope(dart_state()); |
112 CreateEmptyRootLibraryIfNeeded(); | 112 CreateEmptyRootLibraryIfNeeded(); |
113 | 113 |
114 DartLibraryLoader& loader = dart_state()->library_loader(); | 114 DartLibraryLoader& loader = dart_state()->library_loader(); |
115 loader.set_library_provider(library_provider); | 115 loader.set_library_provider(library_provider); |
116 | 116 |
117 DartDependencyCatcher dependency_catcher(loader); | 117 DartDependencyCatcher dependency_catcher(loader); |
118 loader.LoadLibrary(name); | 118 loader.LoadLibrary(name.toUTF8()); |
119 loader.WaitForDependencies(dependency_catcher.dependencies(), | 119 loader.WaitForDependencies(dependency_catcher.dependencies(), |
120 base::Bind(&DartController::DidLoadMainLibrary, | 120 base::Bind(&DartController::DidLoadMainLibrary, |
121 weak_factory_.GetWeakPtr(), name)); | 121 weak_factory_.GetWeakPtr(), name)); |
122 } | 122 } |
123 | 123 |
124 void DartController::CreateIsolateFor(PassOwnPtr<DOMDartState> state) { | 124 void DartController::CreateIsolateFor(PassOwnPtr<DOMDartState> state) { |
125 CHECK(kDartIsolateSnapshotBuffer); | 125 CHECK(kDartIsolateSnapshotBuffer); |
126 char* error = nullptr; | 126 char* error = nullptr; |
127 dom_dart_state_ = state; | 127 dom_dart_state_ = state; |
128 Dart_Isolate isolate = Dart_CreateIsolate( | 128 Dart_Isolate isolate = Dart_CreateIsolate( |
(...skipping 24 matching lines...) Expand all Loading... |
153 } | 153 } |
154 | 154 |
155 void DartController::InstallView(View* view) { | 155 void DartController::InstallView(View* view) { |
156 DartIsolateScope isolate_scope(dart_state()->isolate()); | 156 DartIsolateScope isolate_scope(dart_state()->isolate()); |
157 DartApiScope dart_api_scope; | 157 DartApiScope dart_api_scope; |
158 | 158 |
159 builtin_sky_->InstallView(view); | 159 builtin_sky_->InstallView(view); |
160 } | 160 } |
161 | 161 |
162 } // namespace blink | 162 } // namespace blink |
OLD | NEW |