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

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

Issue 1769273004: Remove V8RecrusionScope, cleanup call sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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 "core/dom/Microtask.h" 31 #include "bindings/core/v8/Microtask.h"
32 32
33 #include "bindings/core/v8/V8PerIsolateData.h"
34 #include "platform/ScriptForbiddenScope.h" 33 #include "platform/ScriptForbiddenScope.h"
35 #include "platform/Task.h" 34 #include "platform/Task.h"
36 #include "public/platform/WebTaskRunner.h"
37 #include <v8.h>
38 35
39 namespace blink { 36 namespace blink {
40 37
41 void Microtask::performCheckpoint(v8::Isolate* isolate) 38 void Microtask::performCheckpoint(v8::Isolate* isolate)
42 { 39 {
43 if (ScriptForbiddenScope::isScriptForbidden()) 40 if (ScriptForbiddenScope::isScriptForbidden())
44 return; 41 return;
45 v8::MicrotasksScope::PerformCheckpoint(isolate); 42 v8::MicrotasksScope::PerformCheckpoint(isolate);
46 } 43 }
47 44
48 static void microtaskFunctionCallback(void* data) 45 static void microtaskFunctionCallback(void* data)
49 { 46 {
50 OwnPtr<WebTaskRunner::Task> task = adoptPtr(static_cast<WebTaskRunner::Task* >(data)); 47 OwnPtr<WebTaskRunner::Task> task = adoptPtr(static_cast<WebTaskRunner::Task* >(data));
51 task->run(); 48 task->run();
52 } 49 }
53 50
54 void Microtask::enqueueMicrotask(PassOwnPtr<WebTaskRunner::Task> callback) 51 void Microtask::enqueueMicrotask(PassOwnPtr<WebTaskRunner::Task> callback)
55 { 52 {
56 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 53 v8::Isolate* isolate = v8::Isolate::GetCurrent();
57 isolate->EnqueueMicrotask(&microtaskFunctionCallback, callback.leakPtr()); 54 isolate->EnqueueMicrotask(&microtaskFunctionCallback, callback.leakPtr());
58 } 55 }
59 56
60 void Microtask::enqueueMicrotask(PassOwnPtr<SameThreadClosure> callback) 57 void Microtask::enqueueMicrotask(PassOwnPtr<SameThreadClosure> callback)
61 { 58 {
62 enqueueMicrotask(adoptPtr(new SameThreadTask(callback))); 59 enqueueMicrotask(adoptPtr(new SameThreadTask(callback)));
63 } 60 }
64 61
65 } // namespace blink 62 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698