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

Side by Side Diff: vm/isolate_linux.cc

Issue 8673002: - Refactor the isolate callback mechanism to also include creation of the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « vm/isolate.cc ('k') | vm/isolate_macos.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) 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 #include <errno.h> 5 #include <errno.h>
6 #include <pthread.h> 6 #include <pthread.h>
7 7
8 #include "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 10
(...skipping 11 matching lines...) Expand all
22 pthread_key_t isolate_key = PTHREAD_KEY_UNSET; 22 pthread_key_t isolate_key = PTHREAD_KEY_UNSET;
23 23
24 24
25 void Isolate::SetCurrent(Isolate* current) { 25 void Isolate::SetCurrent(Isolate* current) {
26 ASSERT(isolate_key != PTHREAD_KEY_UNSET); 26 ASSERT(isolate_key != PTHREAD_KEY_UNSET);
27 int result = pthread_setspecific(isolate_key, current); 27 int result = pthread_setspecific(isolate_key, current);
28 VALIDATE_PTHREAD_RESULT(result); 28 VALIDATE_PTHREAD_RESULT(result);
29 } 29 }
30 30
31 31
32 // Empty isolate init callback which is registered before VM isolate creation.
33 static void* VMIsolateInitCallback(void* data) {
34 return reinterpret_cast<void*>(1);
35 }
36
37
38 void Isolate::InitOnce() { 32 void Isolate::InitOnce() {
39 ASSERT(isolate_key == PTHREAD_KEY_UNSET); 33 ASSERT(isolate_key == PTHREAD_KEY_UNSET);
40 int result = pthread_key_create(&isolate_key, NULL); 34 int result = pthread_key_create(&isolate_key, NULL);
41 // Make sure creating a key was successful. 35 // Make sure creating a key was successful.
42 VALIDATE_PTHREAD_RESULT(result); 36 VALIDATE_PTHREAD_RESULT(result);
43 ASSERT(isolate_key != PTHREAD_KEY_UNSET); 37 ASSERT(isolate_key != PTHREAD_KEY_UNSET);
44 init_callback_ = VMIsolateInitCallback; 38 create_callback_ = NULL;
45 } 39 }
46 40
47 } // namespace dart 41 } // namespace dart
OLDNEW
« no previous file with comments | « vm/isolate.cc ('k') | vm/isolate_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698