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

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

Issue 2093813002: Allow null in Dart_SetRootLibrary. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months 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 | « no previous file | runtime/vm/dart_api_impl_test.cc » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "lib/stacktrace.h" 10 #include "lib/stacktrace.h"
(...skipping 5317 matching lines...) Expand 10 before | Expand all | Expand 10 after
5328 DART_EXPORT Dart_Handle Dart_RootLibrary() { 5328 DART_EXPORT Dart_Handle Dart_RootLibrary() {
5329 Thread* thread = Thread::Current(); 5329 Thread* thread = Thread::Current();
5330 Isolate* isolate = thread->isolate(); 5330 Isolate* isolate = thread->isolate();
5331 CHECK_ISOLATE(isolate); 5331 CHECK_ISOLATE(isolate);
5332 return Api::NewHandle(thread, isolate->object_store()->root_library()); 5332 return Api::NewHandle(thread, isolate->object_store()->root_library());
5333 } 5333 }
5334 5334
5335 5335
5336 DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library) { 5336 DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library) {
5337 DARTSCOPE(Thread::Current()); 5337 DARTSCOPE(Thread::Current());
5338 const Library& lib = Api::UnwrapLibraryHandle(Z, library); 5338 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(library));
5339 if (lib.IsNull()) { 5339 if (obj.IsNull() || obj.IsLibrary()) {
5340 RETURN_TYPE_ERROR(Z, library, Library); 5340 Library& lib = Library::Handle(Z);
5341 lib ^= obj.raw();
5342 T->isolate()->object_store()->set_root_library(lib);
5343 return library;
5341 } 5344 }
5342 Isolate* isolate = Isolate::Current(); 5345 RETURN_TYPE_ERROR(Z, library, Library);
5343 isolate->object_store()->set_root_library(lib);
5344 return library;
5345 } 5346 }
5346 5347
5347 5348
5348 DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, 5349 DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library,
5349 Dart_Handle class_name) { 5350 Dart_Handle class_name) {
5350 DARTSCOPE(Thread::Current()); 5351 DARTSCOPE(Thread::Current());
5351 const Library& lib = Api::UnwrapLibraryHandle(Z, library); 5352 const Library& lib = Api::UnwrapLibraryHandle(Z, library);
5352 if (lib.IsNull()) { 5353 if (lib.IsNull()) {
5353 RETURN_TYPE_ERROR(Z, library, Library); 5354 RETURN_TYPE_ERROR(Z, library, Library);
5354 } 5355 }
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
6439 6440
6440 DART_EXPORT bool Dart_IsPrecompiledRuntime() { 6441 DART_EXPORT bool Dart_IsPrecompiledRuntime() {
6441 #if defined(DART_PRECOMPILED_RUNTIME) 6442 #if defined(DART_PRECOMPILED_RUNTIME)
6442 return true; 6443 return true;
6443 #else 6444 #else
6444 return false; 6445 return false;
6445 #endif 6446 #endif
6446 } 6447 }
6447 6448
6448 } // namespace dart 6449 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698