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

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

Issue 1220193009: Migrate most uses of Isolate::current_zone to Thread::zone. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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 | « runtime/vm/coverage.cc ('k') | runtime/vm/debugger.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 "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 return Api::NewHandle(isolate, isolate->object_store()->sticky_error()); 432 return Api::NewHandle(isolate, isolate->object_store()->sticky_error());
433 } 433 }
434 434
435 435
436 Dart_Isolate Api::CastIsolate(Isolate* isolate) { 436 Dart_Isolate Api::CastIsolate(Isolate* isolate) {
437 return reinterpret_cast<Dart_Isolate>(isolate); 437 return reinterpret_cast<Dart_Isolate>(isolate);
438 } 438 }
439 439
440 440
441 Dart_Handle Api::NewError(const char* format, ...) { 441 Dart_Handle Api::NewError(const char* format, ...) {
442 Isolate* isolate = Isolate::Current(); 442 Thread* thread = Thread::Current();
443 Isolate* isolate = thread->isolate();
444 Zone* zone = thread->zone();
443 DARTSCOPE(isolate); 445 DARTSCOPE(isolate);
444 CHECK_CALLBACK_STATE(isolate); 446 CHECK_CALLBACK_STATE(isolate);
445 447
446 va_list args; 448 va_list args;
447 va_start(args, format); 449 va_start(args, format);
448 intptr_t len = OS::VSNPrint(NULL, 0, format, args); 450 intptr_t len = OS::VSNPrint(NULL, 0, format, args);
449 va_end(args); 451 va_end(args);
450 452
451 char* buffer = isolate->current_zone()->Alloc<char>(len + 1); 453 char* buffer = zone->Alloc<char>(len + 1);
452 va_list args2; 454 va_list args2;
453 va_start(args2, format); 455 va_start(args2, format);
454 OS::VSNPrint(buffer, (len + 1), format, args2); 456 OS::VSNPrint(buffer, (len + 1), format, args2);
455 va_end(args2); 457 va_end(args2);
456 458
457 const String& message = String::Handle(isolate, String::New(buffer)); 459 const String& message = String::Handle(zone, String::New(buffer));
458 return Api::NewHandle(isolate, ApiError::New(message)); 460 return Api::NewHandle(isolate, ApiError::New(message));
459 } 461 }
460 462
461 463
462 void Api::SetupAcquiredError(Isolate* isolate) { 464 void Api::SetupAcquiredError(Isolate* isolate) {
463 ASSERT(isolate != NULL); 465 ASSERT(isolate != NULL);
464 ApiState* state = isolate->api_state(); 466 ApiState* state = isolate->api_state();
465 ASSERT(state != NULL); 467 ASSERT(state != NULL);
466 state->SetupAcquiredError(); 468 state->SetupAcquiredError();
467 } 469 }
(...skipping 5319 matching lines...) Expand 10 before | Expand all | Expand 10 after
5787 ASSERT(stream != NULL); 5789 ASSERT(stream != NULL);
5788 TimelineEvent* event = stream->StartEvent(); 5790 TimelineEvent* event = stream->StartEvent();
5789 if (event != NULL) { 5791 if (event != NULL) {
5790 event->AsyncEnd(label, async_id); 5792 event->AsyncEnd(label, async_id);
5791 event->Complete(); 5793 event->Complete();
5792 } 5794 }
5793 return Api::Success(); 5795 return Api::Success();
5794 } 5796 }
5795 5797
5796 } // namespace dart 5798 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/coverage.cc ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698