| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 ~V8PerContextData(); | 72 ~V8PerContextData(); |
| 73 | 73 |
| 74 v8::Handle<v8::Context> context() { return m_context.newLocal(m_isolate); } | 74 v8::Handle<v8::Context> context() { return m_context.newLocal(m_isolate); } |
| 75 | 75 |
| 76 // To create JS Wrapper objects, we create a cache of a 'boiler plate' | 76 // To create JS Wrapper objects, we create a cache of a 'boiler plate' |
| 77 // object, and then simply Clone that object each time we need a new one. | 77 // object, and then simply Clone that object each time we need a new one. |
| 78 // This is faster than going through the full object creation process. | 78 // This is faster than going through the full object creation process. |
| 79 v8::Local<v8::Object> createWrapperFromCache(const WrapperTypeInfo* type) | 79 v8::Local<v8::Object> createWrapperFromCache(const WrapperTypeInfo* type) |
| 80 { | 80 { |
| 81 UnsafePersistent<v8::Object> boilerplate = m_wrapperBoilerplates.get(typ
e); | 81 UnsafePersistent<v8::Object> boilerplate = m_wrapperBoilerplates.get(typ
e); |
| 82 return !boilerplate.isEmpty() ? boilerplate.newLocal(v8::Isolate::GetCur
rent())->Clone() : createWrapperFromCacheSlowCase(type); | 82 return !boilerplate.isEmpty() ? boilerplate.newLocal(m_isolate)->Clone()
: createWrapperFromCacheSlowCase(type); |
| 83 } | 83 } |
| 84 | 84 |
| 85 v8::Local<v8::Function> constructorForType(const WrapperTypeInfo* type) | 85 v8::Local<v8::Function> constructorForType(const WrapperTypeInfo* type) |
| 86 { | 86 { |
| 87 UnsafePersistent<v8::Function> function = m_constructorMap.get(type); | 87 UnsafePersistent<v8::Function> function = m_constructorMap.get(type); |
| 88 if (!function.isEmpty()) | 88 if (!function.isEmpty()) |
| 89 return function.newLocal(v8::Isolate::GetCurrent()); | 89 return function.newLocal(m_isolate); |
| 90 return constructorForTypeSlowCase(type); | 90 return constructorForTypeSlowCase(type); |
| 91 } | 91 } |
| 92 | 92 |
| 93 v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*); | 93 v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*); |
| 94 | 94 |
| 95 V8NPObjectMap* v8NPObjectMap() { return &m_v8NPObjectMap; } | 95 V8NPObjectMap* v8NPObjectMap() { return &m_v8NPObjectMap; } |
| 96 V8DOMActivityLogger* activityLogger() { return m_activityLogger; } | 96 V8DOMActivityLogger* activityLogger() { return m_activityLogger; } |
| 97 void setActivityLogger(V8DOMActivityLogger* logger) { m_activityLogger = log
ger; } | 97 void setActivityLogger(V8DOMActivityLogger* logger) { m_activityLogger = log
ger; } |
| 98 | 98 |
| 99 void addCustomElementBinding(CustomElementDefinition*, PassOwnPtr<CustomElem
entBinding>); | 99 void addCustomElementBinding(CustomElementDefinition*, PassOwnPtr<CustomElem
entBinding>); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 class V8PerContextDebugData { | 133 class V8PerContextDebugData { |
| 134 public: | 134 public: |
| 135 static bool setContextDebugData(v8::Handle<v8::Context>, const char* worldNa
me, int debugId); | 135 static bool setContextDebugData(v8::Handle<v8::Context>, const char* worldNa
me, int debugId); |
| 136 static int contextDebugId(v8::Handle<v8::Context>); | 136 static int contextDebugId(v8::Handle<v8::Context>); |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 } // namespace WebCore | 139 } // namespace WebCore |
| 140 | 140 |
| 141 #endif // V8PerContextData_h | 141 #endif // V8PerContextData_h |
| OLD | NEW |