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

Side by Side Diff: runtime/vm/dart_api_state.h

Issue 259143002: Minor cleanup. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 #ifndef VM_DART_API_STATE_H_ 5 #ifndef VM_DART_API_STATE_H_
6 #define VM_DART_API_STATE_H_ 6 #define VM_DART_API_STATE_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 9
10 #include "platform/thread.h" 10 #include "platform/thread.h"
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // Allocates a persistent handle, these have to be destroyed explicitly 451 // Allocates a persistent handle, these have to be destroyed explicitly
452 // by calling FreeHandle. 452 // by calling FreeHandle.
453 PersistentHandle* AllocateHandle() { 453 PersistentHandle* AllocateHandle() {
454 PersistentHandle* handle; 454 PersistentHandle* handle;
455 if (free_list_ != NULL) { 455 if (free_list_ != NULL) {
456 handle = free_list_; 456 handle = free_list_;
457 free_list_ = handle->Next(); 457 free_list_ = handle->Next();
458 } else { 458 } else {
459 handle = reinterpret_cast<PersistentHandle*>(AllocateScopedHandle()); 459 handle = reinterpret_cast<PersistentHandle*>(AllocateScopedHandle());
460 } 460 }
461 handle->set_raw(NULL); 461 handle->set_raw(Object::null());
462 return handle; 462 return handle;
463 } 463 }
464 464
465 void FreeHandle(PersistentHandle* handle) { 465 void FreeHandle(PersistentHandle* handle) {
466 handle->FreeHandle(free_list()); 466 handle->FreeHandle(free_list());
467 set_free_list(handle); 467 set_free_list(handle);
468 } 468 }
469 469
470 // Validate if passed in handle is a Persistent Handle. 470 // Validate if passed in handle is a Persistent Handle.
471 bool IsValidHandle(Dart_PersistentHandle object) const { 471 bool IsValidHandle(Dart_PersistentHandle object) const {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 visitor); 522 visitor);
523 } 523 }
524 524
525 // Allocates a persistent handle, these have to be destroyed explicitly 525 // Allocates a persistent handle, these have to be destroyed explicitly
526 // by calling FreeHandle. 526 // by calling FreeHandle.
527 FinalizablePersistentHandle* AllocateHandle() { 527 FinalizablePersistentHandle* AllocateHandle() {
528 FinalizablePersistentHandle* handle; 528 FinalizablePersistentHandle* handle;
529 if (free_list_ != NULL) { 529 if (free_list_ != NULL) {
530 handle = free_list_; 530 handle = free_list_;
531 free_list_ = handle->Next(); 531 free_list_ = handle->Next();
532 handle->set_raw(Object::null());
532 } else { 533 } else {
533 handle = reinterpret_cast<FinalizablePersistentHandle*>( 534 handle = reinterpret_cast<FinalizablePersistentHandle*>(
534 AllocateScopedHandle()); 535 AllocateScopedHandle());
536 handle->Clear();
535 } 537 }
536 handle->Clear();
537 return handle; 538 return handle;
538 } 539 }
539 540
540 void FreeHandle(FinalizablePersistentHandle* handle) { 541 void FreeHandle(FinalizablePersistentHandle* handle) {
541 handle->FreeHandle(free_list()); 542 handle->FreeHandle(free_list());
542 set_free_list(handle); 543 set_free_list(handle);
543 } 544 }
544 545
545 // Validate if passed in handle is a Persistent Handle. 546 // Validate if passed in handle is a Persistent Handle.
546 bool IsValidHandle(Dart_WeakPersistentHandle object) const { 547 bool IsValidHandle(Dart_WeakPersistentHandle object) const {
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 Zone* zone_; 938 Zone* zone_;
938 939
939 friend class ApiState; 940 friend class ApiState;
940 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakReferenceSetBuilder); 941 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakReferenceSetBuilder);
941 }; 942 };
942 943
943 944
944 } // namespace dart 945 } // namespace dart
945 946
946 #endif // VM_DART_API_STATE_H_ 947 #endif // VM_DART_API_STATE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698