OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 | 122 |
123 class GlobalHandles { | 123 class GlobalHandles { |
124 public: | 124 public: |
125 ~GlobalHandles(); | 125 ~GlobalHandles(); |
126 | 126 |
127 // Creates a new global handle that is alive until Destroy is called. | 127 // Creates a new global handle that is alive until Destroy is called. |
128 Handle<Object> Create(Object* value); | 128 Handle<Object> Create(Object* value); |
129 | 129 |
130 // Destroy a global handle. | 130 // Destroy a global handle. |
131 void Destroy(Object** location); | 131 static void Destroy(Object** location); |
132 | 132 |
133 typedef WeakReferenceCallbacks<v8::Value, void>::Revivable RevivableCallback; | 133 typedef WeakReferenceCallbacks<v8::Value, void>::Revivable RevivableCallback; |
134 | 134 |
135 // Make the global handle weak and set the callback parameter for the | 135 // Make the global handle weak and set the callback parameter for the |
136 // handle. When the garbage collector recognizes that only weak global | 136 // handle. When the garbage collector recognizes that only weak global |
137 // handles point to an object the handles are cleared and the callback | 137 // handles point to an object the handles are cleared and the callback |
138 // function is invoked (for each handle) with the handle and corresponding | 138 // function is invoked (for each handle) with the handle and corresponding |
139 // parameter as arguments. Note: cleared means set to Smi::FromInt(0). The | 139 // parameter as arguments. Note: cleared means set to Smi::FromInt(0). The |
140 // reason is that Smi::FromInt(0) does not change during garage collection. | 140 // reason is that Smi::FromInt(0) does not change during garage collection. |
141 void MakeWeak(Object** location, | 141 void MakeWeak(Object** location, |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 328 |
329 friend class Isolate; | 329 friend class Isolate; |
330 | 330 |
331 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); | 331 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); |
332 }; | 332 }; |
333 | 333 |
334 | 334 |
335 } } // namespace v8::internal | 335 } } // namespace v8::internal |
336 | 336 |
337 #endif // V8_GLOBAL_HANDLES_H_ | 337 #endif // V8_GLOBAL_HANDLES_H_ |
OLD | NEW |