OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 62 } |
63 | 63 |
64 void setWrapper(v8::Handle<v8::Object> wrapper, v8::Isolate* isolate, const
WrapperConfiguration& configuration) | 64 void setWrapper(v8::Handle<v8::Object> wrapper, v8::Isolate* isolate, const
WrapperConfiguration& configuration) |
65 { | 65 { |
66 ASSERT(!containsWrapper()); | 66 ASSERT(!containsWrapper()); |
67 if (!*wrapper) { | 67 if (!*wrapper) { |
68 m_wrapperOrTypeInfo = 0; | 68 m_wrapperOrTypeInfo = 0; |
69 return; | 69 return; |
70 } | 70 } |
71 v8::Persistent<v8::Object> persistent(isolate, wrapper); | 71 v8::Persistent<v8::Object> persistent(isolate, wrapper); |
72 configuration.configureWrapper(&persistent, isolate); | 72 configuration.configureWrapper(&persistent); |
73 persistent.MakeWeak(this, &makeWeakCallback); | 73 persistent.MakeWeak(this, &makeWeakCallback); |
74 m_wrapperOrTypeInfo = reinterpret_cast<uintptr_t>(persistent.ClearAndLea
k()) | 1; | 74 m_wrapperOrTypeInfo = reinterpret_cast<uintptr_t>(persistent.ClearAndLea
k()) | 1; |
75 ASSERT(containsWrapper()); | 75 ASSERT(containsWrapper()); |
76 } | 76 } |
77 | 77 |
78 v8::Local<v8::Object> newLocalWrapper(v8::Isolate* isolate) const | 78 v8::Local<v8::Object> newLocalWrapper(v8::Isolate* isolate) const |
79 { | 79 { |
80 return unsafePersistent().newLocal(isolate); | 80 return unsafePersistent().newLocal(isolate); |
81 } | 81 } |
82 | 82 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // FIXME: I noticed that 50%~ of minor GC cycle times can be consumed | 201 // FIXME: I noticed that 50%~ of minor GC cycle times can be consumed |
202 // inside key->deref(), which causes Node destructions. We should | 202 // inside key->deref(), which causes Node destructions. We should |
203 // make Node destructions incremental. | 203 // make Node destructions incremental. |
204 info->derefObject(object); | 204 info->derefObject(object); |
205 } | 205 } |
206 }; | 206 }; |
207 | 207 |
208 } // namespace WebCore | 208 } // namespace WebCore |
209 | 209 |
210 #endif // ScriptWrappable_h | 210 #endif // ScriptWrappable_h |
OLD | NEW |