OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 class GCEventData; | 44 class GCEventData; |
45 class StringCache; | 45 class StringCache; |
46 struct WrapperTypeInfo; | 46 struct WrapperTypeInfo; |
47 | 47 |
48 class ExternalStringVisitor; | 48 class ExternalStringVisitor; |
49 | 49 |
50 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList; | 50 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList; |
51 | 51 |
52 class V8PerIsolateData { | 52 class V8PerIsolateData { |
53 public: | 53 public: |
54 static void ensureInitialized(v8::Isolate*); | 54 static v8::Isolate* initialize(); |
55 static V8PerIsolateData* from(v8::Isolate* isolate) | 55 static V8PerIsolateData* from(v8::Isolate* isolate) |
56 { | 56 { |
57 ASSERT(isolate); | 57 ASSERT(isolate); |
58 ASSERT(isolate->GetData(gin::kEmbedderBlink)); | 58 ASSERT(isolate->GetData(gin::kEmbedderBlink)); |
59 return static_cast<V8PerIsolateData*>(isolate->GetData(gin::kEmbedderBli
nk)); | 59 return static_cast<V8PerIsolateData*>(isolate->GetData(gin::kEmbedderBli
nk)); |
60 } | 60 } |
61 static void dispose(v8::Isolate*); | 61 static void dispose(v8::Isolate*); |
62 static v8::Isolate* mainThreadIsolate(); | 62 static v8::Isolate* mainThreadIsolate(); |
63 | 63 |
64 v8::Isolate* isolate() { return m_isolate; } | 64 v8::Isolate* isolate() { return m_isolateHolder->isolate(); } |
65 | 65 |
66 v8::Handle<v8::FunctionTemplate> toStringTemplate(); | 66 v8::Handle<v8::FunctionTemplate> toStringTemplate(); |
67 | 67 |
68 StringCache* stringCache() { return m_stringCache.get(); } | 68 StringCache* stringCache() { return m_stringCache.get(); } |
69 | 69 |
70 v8::Persistent<v8::Value>& ensureLiveRoot(); | 70 v8::Persistent<v8::Value>& ensureLiveRoot(); |
71 | 71 |
72 int recursionLevel() const { return m_recursionLevel; } | 72 int recursionLevel() const { return m_recursionLevel; } |
73 int incrementRecursionLevel() { return ++m_recursionLevel; } | 73 int incrementRecursionLevel() { return ++m_recursionLevel; } |
74 int decrementRecursionLevel() { return --m_recursionLevel; } | 74 int decrementRecursionLevel() { return --m_recursionLevel; } |
(...skipping 18 matching lines...) Expand all Loading... |
93 | 93 |
94 bool hasInstance(const WrapperTypeInfo*, v8::Handle<v8::Value>); | 94 bool hasInstance(const WrapperTypeInfo*, v8::Handle<v8::Value>); |
95 v8::Handle<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*,
v8::Handle<v8::Value>); | 95 v8::Handle<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*,
v8::Handle<v8::Value>); |
96 | 96 |
97 v8::Local<v8::Context> ensureScriptRegexpContext(); | 97 v8::Local<v8::Context> ensureScriptRegexpContext(); |
98 | 98 |
99 const char* previousSamplingState() const { return m_previousSamplingState;
} | 99 const char* previousSamplingState() const { return m_previousSamplingState;
} |
100 void setPreviousSamplingState(const char* name) { m_previousSamplingState =
name; } | 100 void setPreviousSamplingState(const char* name) { m_previousSamplingState =
name; } |
101 | 101 |
102 private: | 102 private: |
103 explicit V8PerIsolateData(v8::Isolate*); | 103 V8PerIsolateData(); |
104 ~V8PerIsolateData(); | 104 ~V8PerIsolateData(); |
105 | 105 |
106 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate> > DOMTemplate
Map; | 106 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate> > DOMTemplate
Map; |
107 DOMTemplateMap& currentDOMTemplateMap(); | 107 DOMTemplateMap& currentDOMTemplateMap(); |
108 bool hasInstance(const WrapperTypeInfo*, v8::Handle<v8::Value>, DOMTemplateM
ap&); | 108 bool hasInstance(const WrapperTypeInfo*, v8::Handle<v8::Value>, DOMTemplateM
ap&); |
109 v8::Handle<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*,
v8::Handle<v8::Value>, DOMTemplateMap&); | 109 v8::Handle<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*,
v8::Handle<v8::Value>, DOMTemplateMap&); |
110 | 110 |
111 v8::Isolate* m_isolate; | |
112 OwnPtr<gin::IsolateHolder> m_isolateHolder; | 111 OwnPtr<gin::IsolateHolder> m_isolateHolder; |
113 DOMTemplateMap m_domTemplateMapForMainWorld; | 112 DOMTemplateMap m_domTemplateMapForMainWorld; |
114 DOMTemplateMap m_domTemplateMapForNonMainWorld; | 113 DOMTemplateMap m_domTemplateMapForNonMainWorld; |
115 ScopedPersistent<v8::FunctionTemplate> m_toStringTemplate; | 114 ScopedPersistent<v8::FunctionTemplate> m_toStringTemplate; |
116 OwnPtr<StringCache> m_stringCache; | 115 OwnPtr<StringCache> m_stringCache; |
117 OwnPtr<V8HiddenValue> m_hiddenValue; | 116 OwnPtr<V8HiddenValue> m_hiddenValue; |
118 ScopedPersistent<v8::Value> m_liveRoot; | 117 ScopedPersistent<v8::Value> m_liveRoot; |
119 RefPtr<ScriptState> m_scriptRegexpScriptState; | 118 RefPtr<ScriptState> m_scriptRegexpScriptState; |
120 | 119 |
121 const char* m_previousSamplingState; | 120 const char* m_previousSamplingState; |
122 | 121 |
123 bool m_constructorMode; | 122 bool m_constructorMode; |
124 friend class ConstructorMode; | 123 friend class ConstructorMode; |
125 | 124 |
126 int m_recursionLevel; | 125 int m_recursionLevel; |
127 bool m_isHandlingRecursionLevelError; | 126 bool m_isHandlingRecursionLevelError; |
128 | 127 |
129 #if ENABLE(ASSERT) | 128 #if ENABLE(ASSERT) |
130 int m_internalScriptRecursionLevel; | 129 int m_internalScriptRecursionLevel; |
131 #endif | 130 #endif |
132 OwnPtr<GCEventData> m_gcEventData; | 131 OwnPtr<GCEventData> m_gcEventData; |
133 bool m_performingMicrotaskCheckpoint; | 132 bool m_performingMicrotaskCheckpoint; |
134 }; | 133 }; |
135 | 134 |
136 } // namespace blink | 135 } // namespace blink |
137 | 136 |
138 #endif // V8PerIsolateData_h | 137 #endif // V8PerIsolateData_h |
OLD | NEW |