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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 void V8PerIsolateData::willBeDestroyed(v8::Isolate* isolate) | 127 void V8PerIsolateData::willBeDestroyed(v8::Isolate* isolate) |
128 { | 128 { |
129 V8PerIsolateData* data = from(isolate); | 129 V8PerIsolateData* data = from(isolate); |
130 | 130 |
131 ASSERT(!data->m_destructionPending); | 131 ASSERT(!data->m_destructionPending); |
132 data->m_destructionPending = true; | 132 data->m_destructionPending = true; |
133 | 133 |
134 // Clear any data that may have handles into the heap, | 134 // Clear any data that may have handles into the heap, |
135 // prior to calling ThreadState::detach(). | 135 // prior to calling ThreadState::detach(). |
136 data->m_idbPendingTransactionMonitor.clear(); | 136 data->clearEndOfScopeTasks(); |
137 } | 137 } |
138 | 138 |
139 void V8PerIsolateData::destroy(v8::Isolate* isolate) | 139 void V8PerIsolateData::destroy(v8::Isolate* isolate) |
140 { | 140 { |
141 #if ENABLE(ASSERT) | 141 #if ENABLE(ASSERT) |
142 if (blink::Platform::current()->currentThread()) | 142 if (blink::Platform::current()->currentThread()) |
143 isolate->RemoveCallCompletedCallback(&assertV8RecursionScope); | 143 isolate->RemoveCallCompletedCallback(&assertV8RecursionScope); |
144 #endif | 144 #endif |
145 V8PerIsolateData* data = from(isolate); | 145 V8PerIsolateData* data = from(isolate); |
146 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. | 146 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 v8SetReturnValue(info, V8ScriptRunner::callInternalFunction(v8::Handle<v8::F
unction>::Cast(value), info.This(), 0, 0, info.GetIsolate())); | 242 v8SetReturnValue(info, V8ScriptRunner::callInternalFunction(v8::Handle<v8::F
unction>::Cast(value), info.This(), 0, 0, info.GetIsolate())); |
243 } | 243 } |
244 | 244 |
245 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() | 245 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() |
246 { | 246 { |
247 if (m_toStringTemplate.isEmpty()) | 247 if (m_toStringTemplate.isEmpty()) |
248 m_toStringTemplate.set(isolate(), v8::FunctionTemplate::New(isolate(), c
onstructorOfToString)); | 248 m_toStringTemplate.set(isolate(), v8::FunctionTemplate::New(isolate(), c
onstructorOfToString)); |
249 return m_toStringTemplate.newLocal(isolate()); | 249 return m_toStringTemplate.newLocal(isolate()); |
250 } | 250 } |
251 | 251 |
252 IDBPendingTransactionMonitor* V8PerIsolateData::ensureIDBPendingTransactionMonit
or() | 252 void V8PerIsolateData::addEndOfScopeTask(PassOwnPtr<EndOfScopeTask> task) |
253 { | 253 { |
254 if (!m_idbPendingTransactionMonitor) | 254 m_endOfScopeTasks.append(task); |
255 m_idbPendingTransactionMonitor = adoptPtr(new IDBPendingTransactionMonit
or()); | 255 } |
256 return m_idbPendingTransactionMonitor.get(); | 256 |
| 257 void V8PerIsolateData::runEndOfScopeTasks() |
| 258 { |
| 259 Vector<OwnPtr<EndOfScopeTask>> tasks; |
| 260 tasks.swap(m_endOfScopeTasks); |
| 261 for (const auto& task : tasks) |
| 262 task->Run(); |
| 263 ASSERT(m_endOfScopeTasks.isEmpty()); |
| 264 } |
| 265 |
| 266 void V8PerIsolateData::clearEndOfScopeTasks() |
| 267 { |
| 268 m_endOfScopeTasks.clear(); |
257 } | 269 } |
258 | 270 |
259 } // namespace blink | 271 } // namespace blink |
OLD | NEW |