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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 return isolate; | 111 return isolate; |
112 } | 112 } |
113 | 113 |
114 v8::Persistent<v8::Value>& V8PerIsolateData::ensureLiveRoot() | 114 v8::Persistent<v8::Value>& V8PerIsolateData::ensureLiveRoot() |
115 { | 115 { |
116 if (m_liveRoot.isEmpty()) | 116 if (m_liveRoot.isEmpty()) |
117 m_liveRoot.set(isolate(), v8::Null(isolate())); | 117 m_liveRoot.set(isolate(), v8::Null(isolate())); |
118 return m_liveRoot.getUnsafe(); | 118 return m_liveRoot.getUnsafe(); |
119 } | 119 } |
120 | 120 |
121 void V8PerIsolateData::dispose(v8::Isolate* isolate) | 121 void V8PerIsolateData::willBeDestroyed(v8::Isolate* isolate) |
| 122 { |
| 123 V8PerIsolateData* data = from(isolate); |
| 124 |
| 125 // Clear any data that may have handles into the heap, |
| 126 // prior to calling ThreadState::detach(). |
| 127 data->m_idbPendingTransactionMonitor.clear(); |
| 128 } |
| 129 |
| 130 void V8PerIsolateData::destroy(v8::Isolate* isolate) |
122 { | 131 { |
123 #if ENABLE(ASSERT) | 132 #if ENABLE(ASSERT) |
124 if (blink::Platform::current()->currentThread()) | 133 if (blink::Platform::current()->currentThread()) |
125 isolate->RemoveCallCompletedCallback(&assertV8RecursionScope); | 134 isolate->RemoveCallCompletedCallback(&assertV8RecursionScope); |
126 #endif | 135 #endif |
127 void* data = isolate->GetData(gin::kEmbedderBlink); | 136 V8PerIsolateData* data = from(isolate); |
128 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. | 137 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. |
129 isolate->Exit(); | 138 isolate->Exit(); |
130 delete static_cast<V8PerIsolateData*>(data); | 139 delete data; |
131 } | 140 } |
132 | 141 |
133 V8PerIsolateData::DOMTemplateMap& V8PerIsolateData::currentDOMTemplateMap() | 142 V8PerIsolateData::DOMTemplateMap& V8PerIsolateData::currentDOMTemplateMap() |
134 { | 143 { |
135 if (DOMWrapperWorld::current(isolate()).isMainWorld()) | 144 if (DOMWrapperWorld::current(isolate()).isMainWorld()) |
136 return m_domTemplateMapForMainWorld; | 145 return m_domTemplateMapForMainWorld; |
137 return m_domTemplateMapForNonMainWorld; | 146 return m_domTemplateMapForNonMainWorld; |
138 } | 147 } |
139 | 148 |
140 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::domTemplate(void* domTemplate
Key, v8::FunctionCallback callback, v8::Handle<v8::Value> data, v8::Handle<v8::S
ignature> signature, int length) | 149 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::domTemplate(void* domTemplate
Key, v8::FunctionCallback callback, v8::Handle<v8::Value> data, v8::Handle<v8::S
ignature> signature, int length) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 v8SetReturnValue(info, V8ScriptRunner::callInternalFunction(v8::Handle<v8::F
unction>::Cast(value), info.This(), 0, 0, info.GetIsolate())); | 233 v8SetReturnValue(info, V8ScriptRunner::callInternalFunction(v8::Handle<v8::F
unction>::Cast(value), info.This(), 0, 0, info.GetIsolate())); |
225 } | 234 } |
226 | 235 |
227 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() | 236 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() |
228 { | 237 { |
229 if (m_toStringTemplate.isEmpty()) | 238 if (m_toStringTemplate.isEmpty()) |
230 m_toStringTemplate.set(isolate(), v8::FunctionTemplate::New(isolate(), c
onstructorOfToString)); | 239 m_toStringTemplate.set(isolate(), v8::FunctionTemplate::New(isolate(), c
onstructorOfToString)); |
231 return m_toStringTemplate.newLocal(isolate()); | 240 return m_toStringTemplate.newLocal(isolate()); |
232 } | 241 } |
233 | 242 |
| 243 IDBPendingTransactionMonitor* V8PerIsolateData::ensureIDBPendingTransactionMonit
or() |
| 244 { |
| 245 if (!m_idbPendingTransactionMonitor) |
| 246 m_idbPendingTransactionMonitor = adoptPtr(new IDBPendingTransactionMonit
or()); |
| 247 return m_idbPendingTransactionMonitor.get(); |
| 248 } |
| 249 |
234 } // namespace blink | 250 } // namespace blink |
OLD | NEW |