OLD | NEW |
---|---|
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 void PostGarbageCollectionProcessing() { | 146 void PostGarbageCollectionProcessing() { |
147 if (state_ != Node::PENDING) return; | 147 if (state_ != Node::PENDING) return; |
148 LOG(HandleEvent("GlobalHandle::Processing", handle().location())); | 148 LOG(HandleEvent("GlobalHandle::Processing", handle().location())); |
149 void* par = parameter(); | 149 void* par = parameter(); |
150 state_ = NEAR_DEATH; | 150 state_ = NEAR_DEATH; |
151 set_parameter(NULL); | 151 set_parameter(NULL); |
152 // The callback function is resolved as late as possible to preserve old | 152 // The callback function is resolved as late as possible to preserve old |
153 // behavior. | 153 // behavior. |
154 WeakReferenceCallback func = callback(); | 154 WeakReferenceCallback func = callback(); |
155 if (func != NULL) { | 155 if (func != NULL) { |
156 func(v8::Persistent<v8::Object>(ToApi<v8::Object>(handle())), par); | 156 v8::Persistent<v8::Object> object = ToApi<v8::Object>(handle()); |
157 { // Leaving V8. | |
Mads Ager (chromium)
2009/03/30 13:26:06
This probably does not lint?
| |
158 VMState state(EXTERNAL); | |
159 func(object, par); | |
160 } | |
157 } | 161 } |
158 } | 162 } |
159 | 163 |
160 // Place the handle address first to avoid offset computation. | 164 // Place the handle address first to avoid offset computation. |
161 Object* object_; // Storage for object pointer. | 165 Object* object_; // Storage for object pointer. |
162 | 166 |
163 // Transition diagram: | 167 // Transition diagram: |
164 // NORMAL <-> WEAK -> PENDING -> NEAR_DEATH -> { NORMAL, WEAK, DESTROYED } | 168 // NORMAL <-> WEAK -> PENDING -> NEAR_DEATH -> { NORMAL, WEAK, DESTROYED } |
165 enum State { | 169 enum State { |
166 NORMAL, // Normal global handle. | 170 NORMAL, // Normal global handle. |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
369 void GlobalHandles::RemoveObjectGroups() { | 373 void GlobalHandles::RemoveObjectGroups() { |
370 List<ObjectGroup*>* object_groups = ObjectGroups(); | 374 List<ObjectGroup*>* object_groups = ObjectGroups(); |
371 for (int i = 0; i< object_groups->length(); i++) { | 375 for (int i = 0; i< object_groups->length(); i++) { |
372 delete object_groups->at(i); | 376 delete object_groups->at(i); |
373 } | 377 } |
374 object_groups->Clear(); | 378 object_groups->Clear(); |
375 } | 379 } |
376 | 380 |
377 | 381 |
378 } } // namespace v8::internal | 382 } } // namespace v8::internal |
OLD | NEW |