Created
November 1, 2017 05:24
-
-
Save hajimehoshi/d74450a74e9311032a667609a97e3f81 to your computer and use it in GitHub Desktop.
crbug/777775
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dir.glob('third_party/WebKit/**/*.cpp').each do |f| | |
next if File.basename(f) == "TaskRunnerHelper.cpp" | |
next if File.basename(f) == "WorkerThread.cpp" | |
next if File.basename(f) == "AnimationWorkletGlobalScopeTest.cpp" | |
# Special | |
#next if File.basename(f) == "WorkletGlobalScope.cpp" | |
#next if File.basename(f) == "WorkerGlobalScope.cpp" | |
r = File.read(f) | |
worker = false | |
r2 = r.gsub(/TaskRunnerHelper::Get\((.+?),\s+(.+?)\)(,|;|\s)/m) do | |
replaced = "" | |
arg = $1 | |
recv = $2 | |
suffix = $3 | |
if recv.start_with?('GetWorkerThread') || recv.start_with?('thread') || recv.start_with?('worker_thread') || recv.start_with?('GetThread') | |
worker = true | |
next Regexp.last_match(0) | |
end | |
kakko = '' | |
while recv[-1] == ')' && !recv.end_with?('()') | |
kakko += recv[-1] | |
recv = recv[0..-2] | |
end | |
if recv != 'this' | |
recv += ')' if recv[-1] == '(' | |
if recv[0] == "&" | |
replaced += recv[1..-1] + '.' | |
elsif recv.end_with?('Get()') || recv.end_with?('get()') | |
replaced += recv[0..-7] + "->" | |
else | |
replaced += recv + '->' | |
end | |
end | |
if arg[-1] == ')' | |
puts arg | |
end | |
replaced += 'GetTaskRunner(' + arg + ')' + kakko + suffix | |
replaced | |
end | |
if r != r2 && !worker | |
r2.gsub!('#include "core/dom/TaskRunnerHelper.h"' + "\n", '#include "public/platform/TaskType.h"' + "\n") | |
end | |
File.open(f, "w") do |file| | |
file.write(r2) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment