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 12 matching lines...) Expand all Loading... |
23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "bindings/core/v8/V8PerIsolateData.h" | 26 #include "bindings/core/v8/V8PerIsolateData.h" |
27 | 27 |
28 #include "bindings/core/v8/DOMDataStore.h" | 28 #include "bindings/core/v8/DOMDataStore.h" |
29 #include "bindings/core/v8/ScriptSourceCode.h" | 29 #include "bindings/core/v8/ScriptSourceCode.h" |
30 #include "bindings/core/v8/V8Binding.h" | 30 #include "bindings/core/v8/V8Binding.h" |
31 #include "bindings/core/v8/V8HiddenValue.h" | 31 #include "bindings/core/v8/V8HiddenValue.h" |
32 #include "bindings/core/v8/V8ObjectConstructor.h" | 32 #include "bindings/core/v8/V8ObjectConstructor.h" |
| 33 #include "bindings/core/v8/V8PrivateProperty.h" |
33 #include "bindings/core/v8/V8ScriptRunner.h" | 34 #include "bindings/core/v8/V8ScriptRunner.h" |
34 #include "core/frame/Deprecation.h" | 35 #include "core/frame/Deprecation.h" |
35 #include "core/inspector/MainThreadDebugger.h" | 36 #include "core/inspector/MainThreadDebugger.h" |
36 #include "platform/ScriptForbiddenScope.h" | 37 #include "platform/ScriptForbiddenScope.h" |
37 #include "public/platform/Platform.h" | 38 #include "public/platform/Platform.h" |
38 #include "wtf/LeakAnnotations.h" | 39 #include "wtf/LeakAnnotations.h" |
39 #include <memory> | 40 #include <memory> |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
42 | 43 |
43 static V8PerIsolateData* mainThreadPerIsolateData = 0; | 44 static V8PerIsolateData* mainThreadPerIsolateData = 0; |
44 | 45 |
45 static void beforeCallEnteredCallback(v8::Isolate* isolate) | 46 static void beforeCallEnteredCallback(v8::Isolate* isolate) |
46 { | 47 { |
47 RELEASE_ASSERT(!ScriptForbiddenScope::isScriptForbidden()); | 48 RELEASE_ASSERT(!ScriptForbiddenScope::isScriptForbidden()); |
48 } | 49 } |
49 | 50 |
50 static void microtasksCompletedCallback(v8::Isolate* isolate) | 51 static void microtasksCompletedCallback(v8::Isolate* isolate) |
51 { | 52 { |
52 V8PerIsolateData::from(isolate)->runEndOfScopeTasks(); | 53 V8PerIsolateData::from(isolate)->runEndOfScopeTasks(); |
53 } | 54 } |
54 | 55 |
55 V8PerIsolateData::V8PerIsolateData() | 56 V8PerIsolateData::V8PerIsolateData() |
56 : m_isolateHolder(adoptPtr(new gin::IsolateHolder())) | 57 : m_isolateHolder(adoptPtr(new gin::IsolateHolder())) |
57 , m_stringCache(adoptPtr(new StringCache(isolate()))) | 58 , m_stringCache(adoptPtr(new StringCache(isolate()))) |
58 , m_hiddenValue(V8HiddenValue::create()) | 59 , m_hiddenValue(V8HiddenValue::create()) |
| 60 , m_privateProperty(V8PrivateProperty::create()) |
59 , m_constructorMode(ConstructorMode::CreateNewObject) | 61 , m_constructorMode(ConstructorMode::CreateNewObject) |
60 , m_useCounterDisabled(false) | 62 , m_useCounterDisabled(false) |
61 , m_isHandlingRecursionLevelError(false) | 63 , m_isHandlingRecursionLevelError(false) |
62 , m_isReportingException(false) | 64 , m_isReportingException(false) |
63 { | 65 { |
64 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. | 66 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. |
65 isolate()->Enter(); | 67 isolate()->Enter(); |
66 isolate()->AddBeforeCallEnteredCallback(&beforeCallEnteredCallback); | 68 isolate()->AddBeforeCallEnteredCallback(&beforeCallEnteredCallback); |
67 isolate()->AddMicrotasksCompletedCallback(µtasksCompletedCallback); | 69 isolate()->AddMicrotasksCompletedCallback(µtasksCompletedCallback); |
68 if (isMainThread()) | 70 if (isMainThread()) |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 { | 202 { |
201 isolate->RemoveBeforeCallEnteredCallback(&beforeCallEnteredCallback); | 203 isolate->RemoveBeforeCallEnteredCallback(&beforeCallEnteredCallback); |
202 isolate->RemoveMicrotasksCompletedCallback(µtasksCompletedCallback); | 204 isolate->RemoveMicrotasksCompletedCallback(µtasksCompletedCallback); |
203 V8PerIsolateData* data = from(isolate); | 205 V8PerIsolateData* data = from(isolate); |
204 | 206 |
205 // Clear everything before exiting the Isolate. | 207 // Clear everything before exiting the Isolate. |
206 if (data->m_scriptRegexpScriptState) | 208 if (data->m_scriptRegexpScriptState) |
207 data->m_scriptRegexpScriptState->disposePerContextData(); | 209 data->m_scriptRegexpScriptState->disposePerContextData(); |
208 data->m_liveRoot.clear(); | 210 data->m_liveRoot.clear(); |
209 data->m_hiddenValue.reset(); | 211 data->m_hiddenValue.reset(); |
| 212 data->m_privateProperty.reset(); |
210 data->m_stringCache->dispose(); | 213 data->m_stringCache->dispose(); |
211 data->m_stringCache.reset(); | 214 data->m_stringCache.reset(); |
212 data->m_interfaceTemplateMapForNonMainWorld.clear(); | 215 data->m_interfaceTemplateMapForNonMainWorld.clear(); |
213 data->m_interfaceTemplateMapForMainWorld.clear(); | 216 data->m_interfaceTemplateMapForMainWorld.clear(); |
214 data->m_operationTemplateMapForNonMainWorld.clear(); | 217 data->m_operationTemplateMapForNonMainWorld.clear(); |
215 data->m_operationTemplateMapForMainWorld.clear(); | 218 data->m_operationTemplateMapForMainWorld.clear(); |
216 if (isMainThread()) | 219 if (isMainThread()) |
217 mainThreadPerIsolateData = 0; | 220 mainThreadPerIsolateData = 0; |
218 | 221 |
219 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. | 222 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 348 |
346 void V8PerIsolateData::addActiveScriptWrappable(ActiveScriptWrappable* wrappable
) | 349 void V8PerIsolateData::addActiveScriptWrappable(ActiveScriptWrappable* wrappable
) |
347 { | 350 { |
348 if (!m_activeScriptWrappables) | 351 if (!m_activeScriptWrappables) |
349 m_activeScriptWrappables = new ActiveScriptWrappableSet(); | 352 m_activeScriptWrappables = new ActiveScriptWrappableSet(); |
350 | 353 |
351 m_activeScriptWrappables->add(wrappable); | 354 m_activeScriptWrappables->add(wrappable); |
352 } | 355 } |
353 | 356 |
354 } // namespace blink | 357 } // namespace blink |
OLD | NEW |