[M126 Migration] Add runtime switch to identify chrome/ewk launch 38/316738/1
authorv-saha <v.saha@samsung.com>
Tue, 27 Aug 2024 10:23:51 +0000 (15:53 +0530)
committerv-saha <v.saha@samsung.com>
Tue, 27 Aug 2024 10:23:51 +0000 (15:53 +0530)
With --build-chrome compile time flag, both chrome and ewk are built
and packaged in the same rpm. This commit adds a runtime switch to
differentiate bewteen chrome and ewk launch.

Reference: https://review.tizen.org/gerrit/311918

Change-Id: I6fa83be34cb99f2868224dc728f70b3cfb6c54ec
Signed-off-by: v-saha <v.saha@samsung.com>
base/base_switches.cc
base/base_switches.h
chrome/app/chrome_main_delegate.cc
chrome/browser/chrome_content_browser_client.cc

index 7381c5c942065fa4db2990713a5cad06284241e7..6612cb039679bb5c4992c1d94b94632298994630 100644 (file)
@@ -147,6 +147,10 @@ const char kLimitMemoryAllocationInScheduleDelayedWork[] =
 const char kEnableOffscreenRendering[] = "enable-offscreen-rendering";
 #endif
 
+#if defined(BUILD_CHROME)
+const char kEnableChrome[] = "enable-chrome";
+#endif
+
 #if BUILDFLAG(IS_TIZEN)
 const char kDiscardableMemoryLimit[] = "discardable-memory-limit";
 const char kDiscardableMemoryPurgeDelay[] = "discardable-memory-purge-delay";
index e36b0d5f1130e05d7eae58df74f210492f4c3bb8..8b3ac1b1e751964033d70d2d29ea782fb91f6244 100644 (file)
@@ -50,6 +50,10 @@ extern const char kLimitMemoryAllocationInScheduleDelayedWork[];
 extern const char kEnableOffscreenRendering[];
 #endif
 
+#if defined(BUILD_CHROME)
+extern const char kEnableChrome[];
+#endif
+
 #if BUILDFLAG(IS_TIZEN)
 extern const char kDiscardableMemoryLimit[];
 extern const char kDiscardableMemoryPurgeDelay[];
index d60a195d58a27bfa51136aaedd950946a34d58ae..759bb161283542e1af7ef084e474d230366c593f 100644 (file)
 #include "ui/base/resource/scoped_startup_resource_bundle.h"
 #include "ui/base/ui_base_switches.h"
 
+#if BUILDFLAG(IS_WIN) || defined(BUILD_CHROME)
+#include "base/base_switches.h"
+#endif
+
 #if BUILDFLAG(IS_WIN)
 #include <malloc.h>
 
 #include <algorithm>
 
-#include "base/base_switches.h"
 #include "base/files/important_file_writer_cleaner.h"
 #include "base/win/atl.h"
 #include "base/win/dark_mode_support.h"
@@ -1227,6 +1230,10 @@ void ChromeMainDelegate::SetupTracing() {
 }
 
 std::optional<int> ChromeMainDelegate::BasicStartupComplete() {
+#if defined(BUILD_CHROME)
+  base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableChrome);
+#endif
+
 #if BUILDFLAG(IS_CHROMEOS_ASH)
   ash::BootTimesRecorder::Get()->SaveChromeMainStats();
 #endif
index b2178d8c247bed87d37afbcccf32df1af13841ec..e59d78a88110f3b375dfebbf6685957a5a0f8bed 100644 (file)
@@ -2543,6 +2543,10 @@ void MaybeAppendBlinkSettingsSwitchForFieldTrial(
 void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
     base::CommandLine* command_line,
     int child_process_id) {
+#if defined(BUILD_CHROME)
+  command_line->AppendSwitch(switches::kEnableChrome);
+#endif
+
 #if BUILDFLAG(IS_MAC)
   std::unique_ptr<metrics::ClientInfo> client_info =
       GoogleUpdateSettings::LoadMetricsClientInfo();