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

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

Issue 1482243006: VM: Small clean up and const-ness fix for Thread/OSThread constants. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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/bin/thread_win.cc ('k') | runtime/vm/os_thread.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) 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 "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 DECLARE_FLAG(bool, verify_handles); 57 DECLARE_FLAG(bool, verify_handles);
58 #if defined(DART_NO_SNAPSHOT) 58 #if defined(DART_NO_SNAPSHOT)
59 DEFINE_FLAG(bool, check_function_fingerprints, true, 59 DEFINE_FLAG(bool, check_function_fingerprints, true,
60 "Check function fingerprints"); 60 "Check function fingerprints");
61 #endif // defined(DART_NO_SNAPSHOT). 61 #endif // defined(DART_NO_SNAPSHOT).
62 DEFINE_FLAG(bool, trace_api, false, 62 DEFINE_FLAG(bool, trace_api, false,
63 "Trace invocation of API calls (debug mode only)"); 63 "Trace invocation of API calls (debug mode only)");
64 DEFINE_FLAG(bool, verify_acquired_data, false, 64 DEFINE_FLAG(bool, verify_acquired_data, false,
65 "Verify correct API acquire/release of typed data."); 65 "Verify correct API acquire/release of typed data.");
66 66
67 ThreadLocalKey Api::api_native_key_ = OSThread::kUnsetThreadLocalKey; 67 ThreadLocalKey Api::api_native_key_ = kUnsetThreadLocalKey;
68 Dart_Handle Api::true_handle_ = NULL; 68 Dart_Handle Api::true_handle_ = NULL;
69 Dart_Handle Api::false_handle_ = NULL; 69 Dart_Handle Api::false_handle_ = NULL;
70 Dart_Handle Api::null_handle_ = NULL; 70 Dart_Handle Api::null_handle_ = NULL;
71 Dart_Handle Api::empty_string_handle_ = NULL; 71 Dart_Handle Api::empty_string_handle_ = NULL;
72 72
73 73
74 const char* CanonicalFunction(const char* func) { 74 const char* CanonicalFunction(const char* func) {
75 if (strncmp(func, "dart::", 6) == 0) { 75 if (strncmp(func, "dart::", 6) == 0) {
76 return func + 6; 76 return func + 6;
77 } else { 77 } else {
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 477
478 ApiLocalScope* Api::TopScope(Thread* thread) { 478 ApiLocalScope* Api::TopScope(Thread* thread) {
479 ASSERT(thread != NULL); 479 ASSERT(thread != NULL);
480 ApiLocalScope* scope = thread->api_top_scope(); 480 ApiLocalScope* scope = thread->api_top_scope();
481 ASSERT(scope != NULL); 481 ASSERT(scope != NULL);
482 return scope; 482 return scope;
483 } 483 }
484 484
485 485
486 void Api::InitOnce() { 486 void Api::InitOnce() {
487 ASSERT(api_native_key_ == OSThread::kUnsetThreadLocalKey); 487 ASSERT(api_native_key_ == kUnsetThreadLocalKey);
488 api_native_key_ = OSThread::CreateThreadLocal(); 488 api_native_key_ = OSThread::CreateThreadLocal();
489 ASSERT(api_native_key_ != OSThread::kUnsetThreadLocalKey); 489 ASSERT(api_native_key_ != kUnsetThreadLocalKey);
490 } 490 }
491 491
492 492
493 static Dart_Handle InitNewReadOnlyApiHandle(RawObject* raw) { 493 static Dart_Handle InitNewReadOnlyApiHandle(RawObject* raw) {
494 ASSERT(raw->IsVMHeapObject()); 494 ASSERT(raw->IsVMHeapObject());
495 LocalHandle* ref = Dart::AllocateReadOnlyApiHandle(); 495 LocalHandle* ref = Dart::AllocateReadOnlyApiHandle();
496 ref->set_raw(raw); 496 ref->set_raw(raw);
497 return ref->apiHandle(); 497 return ref->apiHandle();
498 } 498 }
499 499
(...skipping 5418 matching lines...) Expand 10 before | Expand all | Expand 10 after
5918 ApiReallocate); 5918 ApiReallocate);
5919 writer.WriteFullSnapshot(); 5919 writer.WriteFullSnapshot();
5920 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); 5920 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize();
5921 *isolate_snapshot_size = writer.IsolateSnapshotSize(); 5921 *isolate_snapshot_size = writer.IsolateSnapshotSize();
5922 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); 5922 *instructions_snapshot_size = writer.InstructionsSnapshotSize();
5923 5923
5924 return Api::Success(); 5924 return Api::Success();
5925 } 5925 }
5926 5926
5927 } // namespace dart 5927 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/thread_win.cc ('k') | runtime/vm/os_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698