diff options
author | Rene Ladan <rene@FreeBSD.org> | 2020-04-13 10:37:15 +0000 |
---|---|---|
committer | Rene Ladan <rene@FreeBSD.org> | 2020-04-13 10:37:15 +0000 |
commit | e3b53fa1271f0ecfc6d650148fa6a2ce7fd59689 (patch) | |
tree | 4282b6dacc1a8a20ec4bc04900a236b3e3fb61a0 /www/chromium/files/patch-base_process_internal__linux.cc | |
parent | Update java plugin. (diff) |
www/chromium: update to 81.0.4044.92
Currently the camera and geolocation do not work.
Submitted by: Matthias Wolf
Obtained from: https://github.com/gliaskos/freebsd-chromium/pull/173
Obtained from: https://github.com/gliaskos/freebsd-chromium/pull/174
MFH: 2020Q2
Security: https://www.vuxml.org/freebsd/6e3b700a-7ca3-11ea-b594-3065ec8fd3ec.html
Diffstat (limited to 'www/chromium/files/patch-base_process_internal__linux.cc')
-rw-r--r-- | www/chromium/files/patch-base_process_internal__linux.cc | 95 |
1 files changed, 88 insertions, 7 deletions
diff --git a/www/chromium/files/patch-base_process_internal__linux.cc b/www/chromium/files/patch-base_process_internal__linux.cc index ca42b91c4296..abfff7cd44ce 100644 --- a/www/chromium/files/patch-base_process_internal__linux.cc +++ b/www/chromium/files/patch-base_process_internal__linux.cc @@ -1,16 +1,97 @@ ---- base/process/internal_linux.cc.orig 2019-03-11 22:00:51 UTC +--- base/process/internal_linux.cc.orig 2020-03-16 18:39:41 UTC +++ base/process/internal_linux.cc -@@ -60,10 +60,13 @@ bool ReadProcFile(const FilePath& file, std::string* b - // Synchronously reading files in /proc is safe. - ThreadRestrictions::ScopedAllowIO allow_io; +@@ -29,7 +29,11 @@ namespace internal { -+#if !defined(OS_BSD) - if (!ReadFileToString(file, buffer)) { + const char kProcDir[] = "/proc"; + ++#if defined(OS_BSD) ++const char kStatFile[] = "status"; ++#else + const char kStatFile[] = "stat"; ++#endif + + FilePath GetProcPidDir(pid_t pid) { + return FilePath(kProcDir).Append(NumberToString(pid)); +@@ -64,6 +68,7 @@ bool ReadProcFile(const FilePath& file, std::string* b DLOG(WARNING) << "Failed to read " << file.MaybeAsASCII(); return false; } -+#endif + return !buffer->empty(); } +@@ -79,6 +84,22 @@ bool ParseProcStats(const std::string& stats_data, + if (stats_data.empty()) + return false; + ++#if defined(OS_BSD) ++ proc_stats->clear(); ++ ++ std::vector<std::string> other_stats = SplitString( ++ stats_data, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); ++ ++ for (const auto& i : other_stats) { ++ auto pos = i.find(','); ++ ++ if (pos == std::string::npos) { ++ proc_stats->push_back(i); ++ } else { ++ proc_stats->push_back(i.substr(0, pos)); ++ } ++ } ++#else + // The stat file is formatted as: + // pid (process name) data1 data2 .... dataN + // Look for the closing paren by scanning backwards, to avoid being fooled by +@@ -108,6 +129,7 @@ bool ParseProcStats(const std::string& stats_data, + base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + for (const auto& i : other_stats) + proc_stats->push_back(i); ++#endif + return true; + } + +@@ -155,7 +177,11 @@ int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, Pro + } + + int64_t ReadProcSelfStatsAndGetFieldAsInt64(ProcStatsFields field_num) { ++#if defined(OS_BSD) ++ FilePath stat_file = FilePath(kProcDir).Append("curproc").Append(kStatFile); ++#else + FilePath stat_file = FilePath(kProcDir).Append("self").Append(kStatFile); ++#endif + return ReadStatFileAndGetFieldAsInt64(stat_file, field_num); + } + +@@ -171,6 +197,9 @@ size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid, + } + + Time GetBootTime() { ++#if defined(OS_BSD) ++ return Time(); ++#else + FilePath path("/proc/stat"); + std::string contents; + if (!ReadProcFile(path, &contents)) +@@ -184,9 +213,13 @@ Time GetBootTime() { + if (!StringToInt(btime_it->second, &btime)) + return Time(); + return Time::FromTimeT(btime); ++#endif + } + + TimeDelta GetUserCpuTimeSinceBoot() { ++#if defined(OS_BSD) ++ return TimeDelta(); ++#else + FilePath path("/proc/stat"); + std::string contents; + if (!ReadProcFile(path, &contents)) +@@ -210,6 +243,7 @@ TimeDelta GetUserCpuTimeSinceBoot() { + return TimeDelta(); + + return ClockTicksToTimeDelta(user + nice); ++#endif + } + + TimeDelta ClockTicksToTimeDelta(int clock_ticks) { |