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

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

Issue 1777183002: Revert of Use v8::MicrotasksScope internally in V8RecursionScope. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8rs-2-endofscope
Patch Set: Resolve patch conflict 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 22 matching lines...) Expand all
33 #include "bindings/core/v8/V8PerIsolateData.h" 33 #include "bindings/core/v8/V8PerIsolateData.h"
34 #include "platform/ScriptForbiddenScope.h" 34 #include "platform/ScriptForbiddenScope.h"
35 #include "platform/Task.h" 35 #include "platform/Task.h"
36 #include "public/platform/WebTaskRunner.h" 36 #include "public/platform/WebTaskRunner.h"
37 #include <v8.h> 37 #include <v8.h>
38 38
39 namespace blink { 39 namespace blink {
40 40
41 void Microtask::performCheckpoint(v8::Isolate* isolate) 41 void Microtask::performCheckpoint(v8::Isolate* isolate)
42 { 42 {
43 if (ScriptForbiddenScope::isScriptForbidden()) 43 V8PerIsolateData* isolateData = V8PerIsolateData::from(isolate);
44 ASSERT(isolateData);
45 if (isolateData->recursionLevel() || isolateData->performingMicrotaskCheckpo int() || isolateData->destructionPending() || ScriptForbiddenScope::isScriptForb idden())
44 return; 46 return;
45 v8::MicrotasksScope::PerformCheckpoint(isolate); 47 isolateData->setPerformingMicrotaskCheckpoint(true);
48 isolate->RunMicrotasks();
49 isolateData->setPerformingMicrotaskCheckpoint(false);
46 } 50 }
47 51
48 static void microtaskFunctionCallback(void* data) 52 static void microtaskFunctionCallback(void* data)
49 { 53 {
50 OwnPtr<WebTaskRunner::Task> task = adoptPtr(static_cast<WebTaskRunner::Task* >(data)); 54 OwnPtr<WebTaskRunner::Task> task = adoptPtr(static_cast<WebTaskRunner::Task* >(data));
51 task->run(); 55 task->run();
52 } 56 }
53 57
54 void Microtask::enqueueMicrotask(PassOwnPtr<WebTaskRunner::Task> callback) 58 void Microtask::enqueueMicrotask(PassOwnPtr<WebTaskRunner::Task> callback)
55 { 59 {
56 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 60 v8::Isolate* isolate = v8::Isolate::GetCurrent();
57 isolate->EnqueueMicrotask(&microtaskFunctionCallback, callback.leakPtr()); 61 isolate->EnqueueMicrotask(&microtaskFunctionCallback, callback.leakPtr());
58 } 62 }
59 63
60 void Microtask::enqueueMicrotask(PassOwnPtr<SameThreadClosure> callback) 64 void Microtask::enqueueMicrotask(PassOwnPtr<SameThreadClosure> callback)
61 { 65 {
62 enqueueMicrotask(adoptPtr(new SameThreadTask(callback))); 66 enqueueMicrotask(adoptPtr(new SameThreadTask(callback)));
63 } 67 }
64 68
65 } // namespace blink 69 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698