Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(961)

Side by Side Diff: runtime/vm/bootstrap.cc

Issue 1473403003: Move ApiLocalScope out of class ApiState into class Thread so that the API local handles and zone e… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-patch Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/benchmark_test.cc ('k') | runtime/vm/dart_api_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/bootstrap.h" 5 #include "vm/bootstrap.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/bootstrap_natives.h" 9 #include "vm/bootstrap_natives.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 174 }
175 } 175 }
176 return error.raw(); 176 return error.raw();
177 } 177 }
178 178
179 179
180 static Dart_Handle LoadPartSource(Thread* thread, 180 static Dart_Handle LoadPartSource(Thread* thread,
181 const Library& lib, 181 const Library& lib,
182 const String& uri) { 182 const String& uri) {
183 Zone* zone = thread->zone(); 183 Zone* zone = thread->zone();
184 Isolate* isolate = thread->isolate();
185 const String& part_source = String::Handle( 184 const String& part_source = String::Handle(
186 zone, GetLibrarySource(lib, uri, false)); 185 zone, GetLibrarySource(lib, uri, false));
187 const String& lib_uri = String::Handle(zone, lib.url()); 186 const String& lib_uri = String::Handle(zone, lib.url());
188 if (part_source.IsNull()) { 187 if (part_source.IsNull()) {
189 return Api::NewError("Unable to read part file '%s' of library '%s'", 188 return Api::NewError("Unable to read part file '%s' of library '%s'",
190 uri.ToCString(), lib_uri.ToCString()); 189 uri.ToCString(), lib_uri.ToCString());
191 } 190 }
192 191
193 // Prepend the library URI to form a unique script URI for the part. 192 // Prepend the library URI to form a unique script URI for the part.
194 const Array& strings = Array::Handle(zone, Array::New(3)); 193 const Array& strings = Array::Handle(zone, Array::New(3));
195 strings.SetAt(0, lib_uri); 194 strings.SetAt(0, lib_uri);
196 strings.SetAt(1, Symbols::Slash()); 195 strings.SetAt(1, Symbols::Slash());
197 strings.SetAt(2, uri); 196 strings.SetAt(2, uri);
198 const String& part_uri = String::Handle(zone, String::ConcatAll(strings)); 197 const String& part_uri = String::Handle(zone, String::ConcatAll(strings));
199 198
200 // Create a script object and compile the part. 199 // Create a script object and compile the part.
201 const Script& part_script = Script::Handle( 200 const Script& part_script = Script::Handle(
202 zone, Script::New(part_uri, part_source, RawScript::kSourceTag)); 201 zone, Script::New(part_uri, part_source, RawScript::kSourceTag));
203 const Error& error = Error::Handle(zone, Compile(lib, part_script)); 202 const Error& error = Error::Handle(zone, Compile(lib, part_script));
204 return Api::NewHandle(isolate, error.raw()); 203 return Api::NewHandle(thread, error.raw());
205 } 204 }
206 205
207 206
208 static Dart_Handle BootstrapLibraryTagHandler(Dart_LibraryTag tag, 207 static Dart_Handle BootstrapLibraryTagHandler(Dart_LibraryTag tag,
209 Dart_Handle library, 208 Dart_Handle library,
210 Dart_Handle uri) { 209 Dart_Handle uri) {
211 Thread* thread = Thread::Current(); 210 Thread* thread = Thread::Current();
212 Zone* zone = thread->zone(); 211 Zone* zone = thread->zone();
213 if (!Dart_IsLibrary(library)) { 212 if (!Dart_IsLibrary(library)) {
214 return Api::NewError("not a library"); 213 return Api::NewError("not a library");
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 Compiler::CompileClass(cls); 349 Compiler::CompileClass(cls);
351 } 350 }
352 351
353 // Restore the library tag handler for the isolate. 352 // Restore the library tag handler for the isolate.
354 isolate->set_library_tag_handler(saved_tag_handler); 353 isolate->set_library_tag_handler(saved_tag_handler);
355 354
356 return error.raw(); 355 return error.raw();
357 } 356 }
358 357
359 } // namespace dart 358 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/benchmark_test.cc ('k') | runtime/vm/dart_api_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698