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

Side by Side Diff: third_party/WebKit/Source/core/dom/Microtask.cpp

Issue 1806643002: Revert of Remove V8RecrusionScope, cleanup call sites. (patchset #8 id:140001 of https://codereview… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverts 1805543002 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "bindings/core/v8/Microtask.h" 31 #include "core/dom/Microtask.h"
32 32
33 #include "bindings/core/v8/V8PerIsolateData.h"
33 #include "platform/ScriptForbiddenScope.h" 34 #include "platform/ScriptForbiddenScope.h"
34 #include "platform/Task.h" 35 #include "platform/Task.h"
36 #include "public/platform/WebTaskRunner.h"
37 #include <v8.h>
35 38
36 namespace blink { 39 namespace blink {
37 40
38 void Microtask::performCheckpoint(v8::Isolate* isolate) 41 void Microtask::performCheckpoint(v8::Isolate* isolate)
39 { 42 {
40 if (ScriptForbiddenScope::isScriptForbidden()) 43 if (ScriptForbiddenScope::isScriptForbidden())
41 return; 44 return;
42 v8::MicrotasksScope::PerformCheckpoint(isolate); 45 v8::MicrotasksScope::PerformCheckpoint(isolate);
43 } 46 }
44 47
45 static void microtaskFunctionCallback(void* data) 48 static void microtaskFunctionCallback(void* data)
46 { 49 {
47 OwnPtr<WebTaskRunner::Task> task = adoptPtr(static_cast<WebTaskRunner::Task* >(data)); 50 OwnPtr<WebTaskRunner::Task> task = adoptPtr(static_cast<WebTaskRunner::Task* >(data));
48 task->run(); 51 task->run();
49 } 52 }
50 53
51 void Microtask::enqueueMicrotask(PassOwnPtr<WebTaskRunner::Task> callback) 54 void Microtask::enqueueMicrotask(PassOwnPtr<WebTaskRunner::Task> callback)
52 { 55 {
53 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 56 v8::Isolate* isolate = v8::Isolate::GetCurrent();
54 isolate->EnqueueMicrotask(&microtaskFunctionCallback, callback.leakPtr()); 57 isolate->EnqueueMicrotask(&microtaskFunctionCallback, callback.leakPtr());
55 } 58 }
56 59
57 void Microtask::enqueueMicrotask(PassOwnPtr<SameThreadClosure> callback) 60 void Microtask::enqueueMicrotask(PassOwnPtr<SameThreadClosure> callback)
58 { 61 {
59 enqueueMicrotask(adoptPtr(new SameThreadTask(callback))); 62 enqueueMicrotask(adoptPtr(new SameThreadTask(callback)));
60 } 63 }
61 64
62 } // namespace blink 65 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Microtask.h ('k') | third_party/WebKit/Source/core/dom/MutationObserver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698