Skip to content

Commit

Permalink
stop using std::vector<const uint8_t> in ProcessingSingleton
Browse files Browse the repository at this point in the history
breaks compilation with gcc/libstdc++.
this is in line with https://issues.chromium.org/issues/323708866
  • Loading branch information
selfisekai committed Apr 11, 2024
1 parent 344aba0 commit 2b57703
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Expand Up @@ -13,7 +13,7 @@ app.requestSingleInstanceLock API so that users can pass in a JSON
object for the second instance to send to the first instance.

diff --git a/chrome/browser/process_singleton.h b/chrome/browser/process_singleton.h
index 31f5b160e4cd755cfb56a62b04261ee1bee80277..191d43392d1ca76882e9da32548fd8e6a713e701 100644
index 31f5b160e4cd755cfb56a62b04261ee1bee80277..8dbc5ac458481d2f805f90101069f02adcfe4090 100644
--- a/chrome/browser/process_singleton.h
+++ b/chrome/browser/process_singleton.h
@@ -18,6 +18,7 @@
Expand All @@ -30,7 +30,7 @@ index 31f5b160e4cd755cfb56a62b04261ee1bee80277..191d43392d1ca76882e9da32548fd8e6
base::RepeatingCallback<bool(base::CommandLine command_line,
- const base::FilePath& current_directory)>;
+ const base::FilePath& current_directory,
+ const std::vector<const uint8_t> additional_data)>;
+ const std::vector<uint8_t> additional_data)>;

#if BUILDFLAG(IS_WIN)
ProcessSingleton(const std::string& program_name,
Expand Down Expand Up @@ -63,14 +63,14 @@ index 31f5b160e4cd755cfb56a62b04261ee1bee80277..191d43392d1ca76882e9da32548fd8e6
#if BUILDFLAG(IS_WIN)
bool EscapeVirtualization(const base::FilePath& user_data_dir);
diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc
index 298c9c81fa110ad7900d0bd6822136bb57f0382e..da7aaed23e4e0cdc037490bbe8beaea705b48df5 100644
index 298c9c81fa110ad7900d0bd6822136bb57f0382e..f662580a6fc23d06c5e4795d5e7d41e788c8f90d 100644
--- a/chrome/browser/process_singleton_posix.cc
+++ b/chrome/browser/process_singleton_posix.cc
@@ -610,6 +610,7 @@ class ProcessSingleton::LinuxWatcher
// |reader| is for sending back ACK message.
void HandleMessage(const std::string& current_dir,
const std::vector<std::string>& argv,
+ const std::vector<const uint8_t> additional_data,
+ const std::vector<uint8_t> additional_data,
SocketReader* reader);

// Called when the ProcessSingleton that owns this class is about to be
Expand All @@ -81,7 +81,7 @@ index 298c9c81fa110ad7900d0bd6822136bb57f0382e..da7aaed23e4e0cdc037490bbe8beaea7
- const std::string& current_dir, const std::vector<std::string>& argv,
+ const std::string& current_dir,
+ const std::vector<std::string>& argv,
+ const std::vector<const uint8_t> additional_data,
+ const std::vector<uint8_t> additional_data,
SocketReader* reader) {
DCHECK(ui_task_runner_->BelongsToCurrentThread());
DCHECK(reader);
Expand Down Expand Up @@ -112,7 +112,7 @@ index 298c9c81fa110ad7900d0bd6822136bb57f0382e..da7aaed23e4e0cdc037490bbe8beaea7
+ base::StringToSizeT(tokens[0], &num_args);
+ std::vector<std::string> command_line(tokens.begin() + 1, tokens.begin() + 1 + num_args);
+
+ std::vector<const uint8_t> additional_data;
+ std::vector<uint8_t> additional_data;
+ if (tokens.size() >= 3 + num_args) {
+ size_t additional_data_size;
+ base::StringToSizeT(tokens[1 + num_args], &additional_data_size);
Expand All @@ -121,7 +121,7 @@ index 298c9c81fa110ad7900d0bd6822136bb57f0382e..da7aaed23e4e0cdc037490bbe8beaea7
+ std::string(1, kTokenDelimiter));
+ const uint8_t* additional_data_bits =
+ reinterpret_cast<const uint8_t*>(remaining_args.c_str());
+ additional_data = std::vector<const uint8_t>(
+ additional_data = std::vector<uint8_t>(
+ additional_data_bits, additional_data_bits + additional_data_size);
+ }
+
Expand Down
6 changes: 3 additions & 3 deletions shell/browser/api/electron_api_app.cc
Expand Up @@ -407,10 +407,10 @@ bool NotificationCallbackWrapper(
const base::RepeatingCallback<
void(base::CommandLine command_line,
const base::FilePath& current_directory,
const std::vector<const uint8_t> additional_data)>& callback,
const std::vector<uint8_t> additional_data)>& callback,
base::CommandLine cmd,
const base::FilePath& cwd,
const std::vector<const uint8_t> additional_data) {
const std::vector<uint8_t> additional_data) {
// Make sure the callback is called after app gets ready.
if (Browser::Get()->is_ready()) {
callback.Run(std::move(cmd), cwd, std::move(additional_data));
Expand Down Expand Up @@ -987,7 +987,7 @@ std::string App::GetLocaleCountryCode() {

void App::OnSecondInstance(base::CommandLine cmd,
const base::FilePath& cwd,
const std::vector<const uint8_t> additional_data) {
const std::vector<uint8_t> additional_data) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Value> data_value =
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/api/electron_api_app.h
Expand Up @@ -196,7 +196,7 @@ class App : public ElectronBrowserClient::Delegate,
std::string GetSystemLocale(gin_helper::ErrorThrower thrower) const;
void OnSecondInstance(base::CommandLine cmd,
const base::FilePath& cwd,
const std::vector<const uint8_t> additional_data);
const std::vector<uint8_t> additional_data);
bool HasSingleInstanceLock() const;
bool RequestSingleInstanceLock(gin::Arguments* args);
void ReleaseSingleInstanceLock();
Expand Down

0 comments on commit 2b57703

Please sign in to comment.