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

Side by Side Diff: runtime/lib/bool.cc

Issue 24975002: - Implement a first cut for const String.env in the VM to allow (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/lib/bool_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #include "vm/bootstrap_natives.h"
6
7 #include "include/dart_api.h"
8 #include "vm/dart_api_impl.h"
9 #include "vm/isolate.h"
10 #include "vm/native_entry.h"
11 #include "vm/object.h"
12
13 namespace dart {
14
15 DEFINE_NATIVE_ENTRY(Boolean_fromEnvironment, 3) {
16 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(1));
17 GET_NATIVE_ARGUMENT(Integer, default_value, arguments->NativeArgAt(2));
18 // Call the embedder to supply us with the environment.
19 Dart_EnvironmentCallback callback = isolate->environment_callback();
20 if (callback != NULL) {
21 Dart_Handle result = callback(kBoolEnvironment,
22 Api::NewHandle(isolate, name.raw()));
23 if (!Dart_IsError(result)) {
24 const Object& value = Object::Handle(isolate, Api::UnwrapHandle(result));
25 if (value.IsBool()) {
26 return value.raw();
27 }
28 }
29 }
30 return default_value.raw();
31 }
32
33 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/lib/bool_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698