Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp

Issue 1745543002: Revert of Execute end of scope tasks in isolate's MicrotasksCompletedCallback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 30 matching lines...) Expand all
41 41
42 namespace blink { 42 namespace blink {
43 43
44 static V8PerIsolateData* mainThreadPerIsolateData = 0; 44 static V8PerIsolateData* mainThreadPerIsolateData = 0;
45 45
46 static void beforeCallEnteredCallback(v8::Isolate* isolate) 46 static void beforeCallEnteredCallback(v8::Isolate* isolate)
47 { 47 {
48 RELEASE_ASSERT(!ScriptForbiddenScope::isScriptForbidden()); 48 RELEASE_ASSERT(!ScriptForbiddenScope::isScriptForbidden());
49 } 49 }
50 50
51 static void microtasksCompletedCallback(v8::Isolate* isolate)
52 {
53 V8PerIsolateData::from(isolate)->runEndOfScopeTasks();
54 }
55
56 #if ENABLE(ASSERT) 51 #if ENABLE(ASSERT)
57 static void assertV8RecursionScope(v8::Isolate* isolate) 52 static void assertV8RecursionScope(v8::Isolate* isolate)
58 { 53 {
59 ASSERT(V8RecursionScope::properlyUsed(isolate)); 54 ASSERT(V8RecursionScope::properlyUsed(isolate));
60 } 55 }
61 56
62 static bool runningUnitTest() 57 static bool runningUnitTest()
63 { 58 {
64 return Platform::current()->unitTestSupport(); 59 return Platform::current()->unitTestSupport();
65 } 60 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 #endif 151 #endif
157 , m_performingMicrotaskCheckpoint(false) 152 , m_performingMicrotaskCheckpoint(false)
158 { 153 {
159 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. 154 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone.
160 isolate()->Enter(); 155 isolate()->Enter();
161 #if ENABLE(ASSERT) 156 #if ENABLE(ASSERT)
162 if (!runningUnitTest()) 157 if (!runningUnitTest())
163 isolate()->AddCallCompletedCallback(&assertV8RecursionScope); 158 isolate()->AddCallCompletedCallback(&assertV8RecursionScope);
164 #endif 159 #endif
165 isolate()->AddBeforeCallEnteredCallback(&beforeCallEnteredCallback); 160 isolate()->AddBeforeCallEnteredCallback(&beforeCallEnteredCallback);
166 isolate()->AddMicrotasksCompletedCallback(&microtasksCompletedCallback);
167 if (isMainThread()) 161 if (isMainThread())
168 mainThreadPerIsolateData = this; 162 mainThreadPerIsolateData = this;
169 isolate()->SetUseCounterCallback(&useCounterCallback); 163 isolate()->SetUseCounterCallback(&useCounterCallback);
170 } 164 }
171 165
172 V8PerIsolateData::~V8PerIsolateData() 166 V8PerIsolateData::~V8PerIsolateData()
173 { 167 {
174 } 168 }
175 169
176 v8::Isolate* V8PerIsolateData::mainThreadIsolate() 170 v8::Isolate* V8PerIsolateData::mainThreadIsolate()
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 211
218 // destroy() clear things that should be cleared after ThreadState::detach() 212 // destroy() clear things that should be cleared after ThreadState::detach()
219 // gets called but before the Isolate exits. 213 // gets called but before the Isolate exits.
220 void V8PerIsolateData::destroy(v8::Isolate* isolate) 214 void V8PerIsolateData::destroy(v8::Isolate* isolate)
221 { 215 {
222 #if ENABLE(ASSERT) 216 #if ENABLE(ASSERT)
223 if (!runningUnitTest()) 217 if (!runningUnitTest())
224 isolate->RemoveCallCompletedCallback(&assertV8RecursionScope); 218 isolate->RemoveCallCompletedCallback(&assertV8RecursionScope);
225 #endif 219 #endif
226 isolate->RemoveBeforeCallEnteredCallback(&beforeCallEnteredCallback); 220 isolate->RemoveBeforeCallEnteredCallback(&beforeCallEnteredCallback);
227 isolate->RemoveMicrotasksCompletedCallback(&microtasksCompletedCallback);
228 V8PerIsolateData* data = from(isolate); 221 V8PerIsolateData* data = from(isolate);
229 222
230 // Clear everything before exiting the Isolate. 223 // Clear everything before exiting the Isolate.
231 if (data->m_scriptRegexpScriptState) 224 if (data->m_scriptRegexpScriptState)
232 data->m_scriptRegexpScriptState->disposePerContextData(); 225 data->m_scriptRegexpScriptState->disposePerContextData();
233 data->m_liveRoot.clear(); 226 data->m_liveRoot.clear();
234 data->m_hiddenValue.clear(); 227 data->m_hiddenValue.clear();
235 data->m_stringCache->dispose(); 228 data->m_stringCache->dispose();
236 data->m_stringCache.clear(); 229 data->m_stringCache.clear();
237 data->m_domTemplateMapForNonMainWorld.clear(); 230 data->m_domTemplateMapForNonMainWorld.clear();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 ASSERT(!m_threadDebugger); 345 ASSERT(!m_threadDebugger);
353 m_threadDebugger = std::move(threadDebugger); 346 m_threadDebugger = std::move(threadDebugger);
354 } 347 }
355 348
356 ThreadDebugger* V8PerIsolateData::threadDebugger() 349 ThreadDebugger* V8PerIsolateData::threadDebugger()
357 { 350 {
358 return m_threadDebugger.get(); 351 return m_threadDebugger.get();
359 } 352 }
360 353
361 } // namespace blink 354 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698