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

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

Issue 8528010: Changes to pass the current isolate to all runtime and native calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 int total = 0; 340 int total = 0;
341 ApiLocalScope* scope = top_scope_; 341 ApiLocalScope* scope = top_scope_;
342 while (scope != NULL) { 342 while (scope != NULL) {
343 total += scope->zone().SizeInBytes(); 343 total += scope->zone().SizeInBytes();
344 scope = scope->previous(); 344 scope = scope->previous();
345 } 345 }
346 return total; 346 return total;
347 } 347 }
348 PersistentHandle* Null() { 348 PersistentHandle* Null() {
349 if (null_ == NULL) { 349 if (null_ == NULL) {
350 Zone zone; // Setup a VM zone as we are creating some handles. 350 Isolate* isolate = Isolate::Current();
351 HandleScope scope; // Setup a VM handle scope. 351 DARTSCOPE(isolate);
352 352
353 Object& null_object = Object::Handle(); 353 Object& null_object = Object::Handle();
354 null_ = persistent_handles().AllocateHandle(); 354 null_ = persistent_handles().AllocateHandle();
355 null_->set_raw(null_object); 355 null_->set_raw(null_object);
356 null_->set_callback(reinterpret_cast<void*>(&ProtectedHandleCallback)); 356 null_->set_callback(reinterpret_cast<void*>(&ProtectedHandleCallback));
357 } 357 }
358 return null_; 358 return null_;
359 } 359 }
360 PersistentHandle* True() { 360 PersistentHandle* True() {
361 if (true_ == NULL) { 361 if (true_ == NULL) {
362 Zone zone; // Setup a VM zone as we are creating some handles. 362 Isolate* isolate = Isolate::Current();
363 HandleScope scope; // Setup a VM handle scope. 363 DARTSCOPE(isolate);
364 364
365 const Object& true_object = Object::Handle(Bool::True()); 365 const Object& true_object = Object::Handle(Bool::True());
366 true_ = persistent_handles().AllocateHandle(); 366 true_ = persistent_handles().AllocateHandle();
367 true_->set_raw(true_object); 367 true_->set_raw(true_object);
368 true_->set_callback(reinterpret_cast<void*>(&ProtectedHandleCallback)); 368 true_->set_callback(reinterpret_cast<void*>(&ProtectedHandleCallback));
369 } 369 }
370 return true_; 370 return true_;
371 } 371 }
372 PersistentHandle* False() { 372 PersistentHandle* False() {
373 if (false_ == NULL) { 373 if (false_ == NULL) {
374 Zone zone; // Setup a VM zone as we are creating some handles. 374 Isolate* isolate = Isolate::Current();
375 HandleScope scope; // Setup a VM handle scope. 375 DARTSCOPE(isolate);
376 376
377 const Object& false_object = Object::Handle(Bool::False()); 377 const Object& false_object = Object::Handle(Bool::False());
378 false_ = persistent_handles().AllocateHandle(); 378 false_ = persistent_handles().AllocateHandle();
379 false_->set_raw(false_object); 379 false_->set_raw(false_object);
380 false_->set_callback(reinterpret_cast<void*>(&ProtectedHandleCallback)); 380 false_->set_callback(reinterpret_cast<void*>(&ProtectedHandleCallback));
381 } 381 }
382 return false_; 382 return false_;
383 } 383 }
384 384
385 private: 385 private:
386 PersistentHandles persistent_handles_; 386 PersistentHandles persistent_handles_;
387 ApiLocalScope* top_scope_; 387 ApiLocalScope* top_scope_;
388 388
389 // Persistent handles to important objects. 389 // Persistent handles to important objects.
390 PersistentHandle* null_; 390 PersistentHandle* null_;
391 PersistentHandle* true_; 391 PersistentHandle* true_;
392 PersistentHandle* false_; 392 PersistentHandle* false_;
393 393
394 DISALLOW_COPY_AND_ASSIGN(ApiState); 394 DISALLOW_COPY_AND_ASSIGN(ApiState);
395 }; 395 };
396 396
397 } // namespace dart 397 } // namespace dart
398 398
399 #endif // VM_DART_API_STATE_H_ 399 #endif // VM_DART_API_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698