Skip to content

Commit

Permalink
Decoupled a bit
Browse files Browse the repository at this point in the history
ipfs-electron
from upstream fork.
  • Loading branch information
John-LittleBearLabs committed Jul 30, 2024
1 parent 07bfbd5 commit a10cfd1
Show file tree
Hide file tree
Showing 890 changed files with 26,502 additions and 252 deletions.
1 change: 1 addition & 0 deletions .github/tour.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ do
echo "Using compat/${e}"
break
fi
echo "No compat branch for ${e}. Remaining mainly on the main."
done

grep -n . ipfs_client_clitester/conanfile.txt
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ jobs:
if: startsWith(matrix.config.os, 'macos')
shell: bash
run: |
brew install cmake ninja
set -ex
brew install cmake
brew install ninja
brew install conan
ninja --version
cmake --version
which c++
Expand All @@ -101,8 +104,6 @@ jobs:
/usr/bin/clang++ --version
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade conan
conan profile detect
conan profile show
conan profile path default
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ CMakeUserPresets.json
*.orig
.*.swp
gotit.json
.kdev4/ipfs-chromium.kdev4
3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ else()
message(WARNING "CHROMIUM_SOURCE_TREE (${CHROMIUM_SOURCE_TREE}) not pointing to source tree.")
endif()

add_subdirectory(electron-spin)

include(cmake/doxy.cmake)
include(cmake/marp.cmake)
if(doc_targets)
Expand Down
22 changes: 0 additions & 22 deletions chromium_edits/122.0.6253.3/url/url_util.cc.patch

This file was deleted.

22 changes: 0 additions & 22 deletions chromium_edits/122.0.6261.6/url/url_util.cc.patch

This file was deleted.

12 changes: 12 additions & 0 deletions chromium_edits/124.0.6367.243/.gitignore.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/.gitignore b/.gitignore
index a55c4c5bbbb29..e6ffcfcefd2aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -212,6 +212,7 @@ vs-chromium-project.txt
/data
/delegate_execute
/device/serial/device_serial_mojo.xml
+/electron
/google_apis/gcm/gcm.xml
/googleurl
/gpu/gles2_conform_test
13 changes: 13 additions & 0 deletions chromium_edits/124.0.6367.243/.gn.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/.gn b/.gn
index afe0b3e90fafb..6b83b22994998 100644
--- a/.gn
+++ b/.gn
@@ -167,4 +167,8 @@ exec_script_whitelist =

"//tools/grit/grit_rule.gni",
"//tools/gritsettings/BUILD.gn",
+
+ "//electron/BUILD.gn",
+ "//third_party/electron_node/deps/base64/BUILD.gn",
+ "//third_party/electron_node/deps/base64/unofficial.gni",
]
23 changes: 23 additions & 0 deletions chromium_edits/124.0.6367.243/BUILD.gn.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/BUILD.gn b/BUILD.gn
index 4b37258f1bbba..4667f496f093c 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -973,7 +973,6 @@ if (is_win) {
"//media:media_unittests",
"//media/midi:midi_unittests",
"//net:net_unittests",
- "//printing:printing_unittests",
"//sql:sql_unittests",
"//third_party/breakpad:symupload($host_toolchain)",
"//ui/base:ui_base_unittests",
@@ -982,6 +981,10 @@ if (is_win) {
"//ui/views:views_unittests",
"//url:url_unittests",
]
+
+ if (enable_printing) {
+ deps += [ "//printing:printing_unittests" ]
+ }
}
}

12 changes: 12 additions & 0 deletions chromium_edits/124.0.6367.243/base/BUILD.gn.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/base/BUILD.gn b/base/BUILD.gn
index 25356ec40cdbf..0c347ca1a75a9 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -1058,6 +1058,7 @@ component("base") {
"//build/config/compiler:prevent_unsafe_narrowing",
"//build/config/compiler:wexit_time_destructors",
"//build/config/compiler:wglobal_constructors",
+ "//electron/build/config:mas_build",
]

deps = [
26 changes: 26 additions & 0 deletions chromium_edits/124.0.6367.243/base/enterprise_util_mac.mm.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/base/enterprise_util_mac.mm b/base/enterprise_util_mac.mm
index 2bad2ed2f5205..ab3d4c953556d 100644
--- a/base/enterprise_util_mac.mm
+++ b/base/enterprise_util_mac.mm
@@ -115,6 +115,14 @@ DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
DeviceUserDomainJoinState state{.device_joined = false,
.user_joined = false};

+#if IS_MAS_BUILD()
+ return state;
+ }();
+
+ return state;
+}
+#else
+
@autoreleasepool {
ODSession* session = [ODSession defaultSession];
if (session == nil) {
@@ -218,5 +226,6 @@ DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {

return state;
}
+#endif

} // namespace base
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/base/functional/callback_helpers.h b/base/functional/callback_helpers.h
index d7444427588f8..c8cc6c186a270 100644
--- a/base/functional/callback_helpers.h
+++ b/base/functional/callback_helpers.h
@@ -100,6 +100,22 @@ RepeatingCallback<void(Args...)> ForwardRepeatingCallbacks(
std::move(v));
}

+// Wraps the given OnceCallback into a RepeatingCallback that relays its
+// invocation to the original OnceCallback on the first invocation. The
+// following invocations are just ignored.
+//
+// Note that this deliberately subverts the Once/Repeating paradigm of Callbacks
+// but helps ease the migration from old-style Callbacks. Avoid if possible; use
+// if necessary for migration. TODO(tzik): Remove it. https://crbug.com/730593
+template <typename... Args>
+RepeatingCallback<void(Args...)> AdaptCallbackForRepeating(
+ OnceCallback<void(Args...)> callback) {
+ using Helper = internal::OnceCallbackHolder<Args...>;
+ return base::BindRepeating(
+ &Helper::Run, std::make_unique<Helper>(std::move(callback),
+ /*ignore_extra_runs=*/true));
+}
+
// Wraps the given OnceCallback and returns two OnceCallbacks with an identical
// signature. On first invokation of either returned callbacks, the original
// callback is invoked. Invoking the remaining callback results in a crash.
60 changes: 60 additions & 0 deletions chromium_edits/124.0.6367.243/base/process/launch_mac.cc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc
index b267bc2272fa8..967e22699bf56 100644
--- a/base/process/launch_mac.cc
+++ b/base/process/launch_mac.cc
@@ -21,13 +21,18 @@
#include "base/threading/scoped_blocking_call.h"
#include "base/threading/thread_restrictions.h"
#include "base/trace_event/base_tracing.h"
+#if IS_MAS_BUILD()
+#include <sys/syscall.h>
+#endif

extern "C" {
// Changes the current thread's directory to a path or directory file
// descriptor.
+#if !IS_MAS_BUILD()
int pthread_chdir_np(const char* dir);

int pthread_fchdir_np(int fd);
+#endif

int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs,
int disclaim);
@@ -99,13 +104,27 @@ class PosixSpawnFileActions {

#if !BUILDFLAG(IS_MAC)
int ChangeCurrentThreadDirectory(const char* path) {
+#if IS_MAS_BUILD()
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ return syscall(SYS___pthread_chdir, path);
+ #pragma clang diagnostic pop
+#else
return pthread_chdir_np(path);
+#endif
}

// The recommended way to unset a per-thread cwd is to set a new value to an
// invalid file descriptor, per libpthread-218.1.3/private/private.h.
int ResetCurrentThreadDirectory() {
+#if IS_MAS_BUILD()
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ return syscall(SYS___pthread_fchdir, -1);
+ #pragma clang diagnostic pop
+#else
return pthread_fchdir_np(-1);
+#endif
}
#endif

@@ -226,7 +245,7 @@ Process LaunchProcess(const std::vector<std::string>& argv,
file_actions.Inherit(STDERR_FILENO);
}

-#if BUILDFLAG(IS_MAC)
+#if 0
if (options.disclaim_responsibility) {
DPSXCHECK(responsibility_spawnattrs_setdisclaim(attr.get(), 1));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/base/process/process_info_mac.cc b/base/process/process_info_mac.cc
index 94a028be3c315..0d830234edb56 100644
--- a/base/process/process_info_mac.cc
+++ b/base/process/process_info_mac.cc
@@ -8,15 +8,21 @@
#include <stdlib.h>
#include <unistd.h>

+#if !IS_MAS_BUILD()
extern "C" {
pid_t responsibility_get_pid_responsible_for_pid(pid_t);
}
+#endif

namespace base {

bool IsProcessSelfResponsible() {
+#if !IS_MAS_BUILD()
const pid_t pid = getpid();
return responsibility_get_pid_responsible_for_pid(pid) == pid;
+#else
+ return true;
+#endif
}

} // namespace base
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h
index e9b8366361706..ebc1b54cd7029 100644
--- a/base/threading/thread_restrictions.h
+++ b/base/threading/thread_restrictions.h
@@ -136,6 +136,7 @@ class KeyStorageLinux;
class NativeBackendKWallet;
class NativeDesktopMediaList;
class PartnerBookmarksReader;
+class ProcessSingleton;
class Profile;
class ProfileImpl;
class ScopedAllowBlockingForProfile;
@@ -276,6 +277,9 @@ class BackendImpl;
class InFlightIO;
bool CleanupDirectorySync(const base::FilePath&);
} // namespace disk_cache
+namespace electron {
+class ScopedAllowBlockingForElectron;
+} // namespace electron
namespace enterprise_connectors {
class LinuxKeyRotationCommand;
} // namespace enterprise_connectors
@@ -576,6 +580,7 @@ class BASE_EXPORT [[maybe_unused, nodiscard]] ScopedAllowBlocking {
friend class ::DesktopNotificationBalloon;
friend class ::FirefoxProfileLock;
friend class ::GaiaConfig;
+ friend class ::ProcessSingleton;
friend class ::ProfileImpl;
friend class ::ScopedAllowBlockingForProfile;
friend class ::StartupTabProviderImpl;
@@ -615,6 +620,7 @@ class BASE_EXPORT [[maybe_unused, nodiscard]] ScopedAllowBlocking {
friend class crosapi::LacrosThreadTypeDelegate;
friend class crypto::ScopedAllowBlockingForNSS; // http://crbug.com/59847
friend class drive::FakeDriveService;
+ friend class electron::ScopedAllowBlockingForElectron;
friend class extensions::InstalledLoader;
friend class extensions::UnpackedInstaller;
friend class font_service::internal::MappedFontFile;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h
index 5f6efb0e93bce..f3a31fdee0e9e 100644
--- a/base/trace_event/builtin_categories.h
+++ b/base/trace_event/builtin_categories.h
@@ -82,6 +82,7 @@
X("drm") \
X("drmcursor") \
X("dwrite") \
+ X("electron") \
X("evdev") \
X("event") \
X("exo") \
14 changes: 14 additions & 0 deletions chromium_edits/124.0.6367.243/build/config/BUILDCONFIG.gn.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index 26a23e459a62d..237827d7a88ac 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -123,6 +123,9 @@ if (current_os == "") {
# even if the value is overridden, which is wasteful. See first bullet.

declare_args() {
+ is_electron_build = false
+ is_mas_build = false
+
# Set to enable the official build level of optimization. This has nothing
# to do with branding, but enables an additional level of optimization above
# release (!is_debug). This might be better expressed as a tri-state
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/build/config/linux/atk/BUILD.gn b/build/config/linux/atk/BUILD.gn
index 239c3870a149a..843f442a55ce8 100644
--- a/build/config/linux/atk/BUILD.gn
+++ b/build/config/linux/atk/BUILD.gn
@@ -11,7 +11,7 @@ import("//build/config/ui.gni")
assert(!is_chromeos)

# These packages should _only_ be expected when building for a target.
-assert(current_toolchain == default_toolchain)
+#assert(current_toolchain == default_toolchain)

if (use_atk) {
assert(use_glib, "use_atk=true requires that use_glib=true")
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/build/config/linux/atspi2/BUILD.gn b/build/config/linux/atspi2/BUILD.gn
index 30bc77f9c23fb..2f3070c91be9b 100644
--- a/build/config/linux/atspi2/BUILD.gn
+++ b/build/config/linux/atspi2/BUILD.gn
@@ -6,7 +6,6 @@ import("//build/config/linux/pkg_config.gni")
import("//build/config/ui.gni")

# These packages should _only_ be expected when building for a target.
-assert(current_toolchain == default_toolchain)

if (use_atk) {
pkg_config("atspi2") {
Loading

0 comments on commit a10cfd1

Please sign in to comment.