Merge ~santoshbit2007/oxide:cmd_line_extra into oxide:master

Proposed by Santosh
Status: Merged
Approved by: Chris Coulson
Approved revision: 4a2feef7a412dd0c23c0535449cc627a3b8949f2
Merged at revision: 62812a76a60de30dc18379f4be43757c59c66e33
Proposed branch: ~santoshbit2007/oxide:cmd_line_extra
Merge into: oxide:master
Diff against target: 80 lines (+35/-0)
3 files modified
shared/app/oxide_content_main_delegate.cc (+7/-0)
shared/app/oxide_content_main_delegate.h (+2/-0)
shared/browser/oxide_browser_process_main.cc (+26/-0)
Reviewer Review Type Date Requested Status
Chris Coulson Approve
Review via email: mp+300185@code.launchpad.net

Description of the change

This patch allow to extend default command-line argument passed to oxide
which can be done by setting environment variable OXIDE_EXTRA_CMD_ARGS
e.g export OXIDE_EXTRA_CMD_ARGS="enable-logging --v=1"

To post a comment you must log in.
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

This looks mostly ok - there's a couple of comments inline. I still think we should also have dedicated environment variables for tweaking the logging settings though (in addition to this).

review: Needs Fixing
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Thanks for the update. I've left some comments inline

review: Needs Fixing
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

This is mostly ok, but see the 2 comments for InitVLogging. I think this bit (InitVLogging) should be split out to a separate merge proposal for now, as the rest of the change is fine to commit.

review: Needs Fixing
Revision history for this message
Santosh (santoshbit2007) wrote :

I drop plan to write log on file everytime as I feel its not required.
Its mostly developer feature and anyway we can redirect to file for logging

Revision history for this message
Chris Coulson (chrisccoulson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/shared/app/oxide_content_main_delegate.cc b/shared/app/oxide_content_main_delegate.cc
2index edb0938..7de1ed6 100644
3--- a/shared/app/oxide_content_main_delegate.cc
4+++ b/shared/app/oxide_content_main_delegate.cc
5@@ -58,6 +58,7 @@ bool ContentMainDelegate::BasicStartupComplete(int* exit_code) {
6 content_client_.reset(new ContentClient());
7 content::SetContentClient(content_client_.get());
8 RegisterPathProvider();
9+ InitVLogging();
10
11 return false;
12 }
13@@ -152,4 +153,10 @@ ContentMainDelegate::CreateContentUtilityClient() {
14 return content_utility_client_.get();
15 }
16
17+void ContentMainDelegate::InitVLogging() {
18+ logging::LoggingSettings settings;
19+ settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
20+ logging::InitLogging(settings);
21+}
22+
23 } // namespace oxide
24diff --git a/shared/app/oxide_content_main_delegate.h b/shared/app/oxide_content_main_delegate.h
25index 6796dc7..fc17b3f 100644
26--- a/shared/app/oxide_content_main_delegate.h
27+++ b/shared/app/oxide_content_main_delegate.h
28@@ -47,6 +47,8 @@ class ContentMainDelegate final : public content::ContentMainDelegate {
29 content::ContentUtilityClient* CreateContentUtilityClient() final;
30
31 private:
32+ void InitVLogging();
33+
34 PlatformDelegate* delegate_;
35 std::unique_ptr<ContentBrowserClient> content_browser_client_;
36 std::unique_ptr<ContentRendererClient> content_renderer_client_;
37diff --git a/shared/browser/oxide_browser_process_main.cc b/shared/browser/oxide_browser_process_main.cc
38index 3bf321f..71585d5 100644
39--- a/shared/browser/oxide_browser_process_main.cc
40+++ b/shared/browser/oxide_browser_process_main.cc
41@@ -36,6 +36,7 @@
42 #include "base/memory/ref_counted.h"
43 #include "base/path_service.h"
44 #include "base/posix/global_descriptors.h"
45+#include "base/strings/string_split.h"
46 #include "base/strings/string_util.h"
47 #include "base/strings/utf_string_conversions.h"
48 #include "cc/base/switches.h"
49@@ -388,6 +389,31 @@ void InitializeCommandLine(const std::string& argv0,
50 command_line->AppendSwitchPath(switches::kSharedMemoryOverridePath,
51 GetSharedMemoryPath(env));
52 #endif
53+
54+ // verbose logging
55+ const std::string& verbose_log_level =
56+ GetEnvironmentOption("VERBOSE_LOG_LEVEL", env);
57+ if (!verbose_log_level.empty()) {
58+ command_line->AppendSwitch(switches::kEnableLogging);
59+ command_line->AppendSwitchASCII(switches::kV, verbose_log_level);
60+ }
61+
62+ const std::string& extra_cmd_arg_list =
63+ GetEnvironmentOption("EXTRA_CMD_ARGS", env);
64+ if (!extra_cmd_arg_list.empty()) {
65+ std::vector<std::string> args =
66+ base::SplitString(extra_cmd_arg_list,
67+ base::kWhitespaceASCII,
68+ base::KEEP_WHITESPACE,
69+ base::SPLIT_WANT_NONEMPTY);
70+
71+ base::CommandLine::StringVector new_args;
72+ new_args.push_back(command_line->argv()[0]);
73+ new_args.insert(new_args.end(), args.begin(), args.end());
74+
75+ base::CommandLine extra_cmd_line(new_args);
76+ command_line->AppendArguments(extra_cmd_line, false);
77+ }
78 }
79
80 void AddFormFactorSpecificCommandLineArguments() {

Subscribers

People subscribed via source and target branches

to all changes: