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
diff --git a/shared/app/oxide_content_main_delegate.cc b/shared/app/oxide_content_main_delegate.cc
index edb0938..7de1ed6 100644
--- a/shared/app/oxide_content_main_delegate.cc
+++ b/shared/app/oxide_content_main_delegate.cc
@@ -58,6 +58,7 @@ bool ContentMainDelegate::BasicStartupComplete(int* exit_code) {
58 content_client_.reset(new ContentClient());58 content_client_.reset(new ContentClient());
59 content::SetContentClient(content_client_.get());59 content::SetContentClient(content_client_.get());
60 RegisterPathProvider();60 RegisterPathProvider();
61 InitVLogging();
6162
62 return false;63 return false;
63}64}
@@ -152,4 +153,10 @@ ContentMainDelegate::CreateContentUtilityClient() {
152 return content_utility_client_.get();153 return content_utility_client_.get();
153}154}
154155
156void ContentMainDelegate::InitVLogging() {
157 logging::LoggingSettings settings;
158 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
159 logging::InitLogging(settings);
160}
161
155} // namespace oxide162} // namespace oxide
diff --git a/shared/app/oxide_content_main_delegate.h b/shared/app/oxide_content_main_delegate.h
index 6796dc7..fc17b3f 100644
--- a/shared/app/oxide_content_main_delegate.h
+++ b/shared/app/oxide_content_main_delegate.h
@@ -47,6 +47,8 @@ class ContentMainDelegate final : public content::ContentMainDelegate {
47 content::ContentUtilityClient* CreateContentUtilityClient() final;47 content::ContentUtilityClient* CreateContentUtilityClient() final;
4848
49 private:49 private:
50 void InitVLogging();
51
50 PlatformDelegate* delegate_;52 PlatformDelegate* delegate_;
51 std::unique_ptr<ContentBrowserClient> content_browser_client_;53 std::unique_ptr<ContentBrowserClient> content_browser_client_;
52 std::unique_ptr<ContentRendererClient> content_renderer_client_;54 std::unique_ptr<ContentRendererClient> content_renderer_client_;
diff --git a/shared/browser/oxide_browser_process_main.cc b/shared/browser/oxide_browser_process_main.cc
index 3bf321f..71585d5 100644
--- a/shared/browser/oxide_browser_process_main.cc
+++ b/shared/browser/oxide_browser_process_main.cc
@@ -36,6 +36,7 @@
36#include "base/memory/ref_counted.h"36#include "base/memory/ref_counted.h"
37#include "base/path_service.h"37#include "base/path_service.h"
38#include "base/posix/global_descriptors.h"38#include "base/posix/global_descriptors.h"
39#include "base/strings/string_split.h"
39#include "base/strings/string_util.h"40#include "base/strings/string_util.h"
40#include "base/strings/utf_string_conversions.h"41#include "base/strings/utf_string_conversions.h"
41#include "cc/base/switches.h"42#include "cc/base/switches.h"
@@ -388,6 +389,31 @@ void InitializeCommandLine(const std::string& argv0,
388 command_line->AppendSwitchPath(switches::kSharedMemoryOverridePath,389 command_line->AppendSwitchPath(switches::kSharedMemoryOverridePath,
389 GetSharedMemoryPath(env));390 GetSharedMemoryPath(env));
390#endif391#endif
392
393 // verbose logging
394 const std::string& verbose_log_level =
395 GetEnvironmentOption("VERBOSE_LOG_LEVEL", env);
396 if (!verbose_log_level.empty()) {
397 command_line->AppendSwitch(switches::kEnableLogging);
398 command_line->AppendSwitchASCII(switches::kV, verbose_log_level);
399 }
400
401 const std::string& extra_cmd_arg_list =
402 GetEnvironmentOption("EXTRA_CMD_ARGS", env);
403 if (!extra_cmd_arg_list.empty()) {
404 std::vector<std::string> args =
405 base::SplitString(extra_cmd_arg_list,
406 base::kWhitespaceASCII,
407 base::KEEP_WHITESPACE,
408 base::SPLIT_WANT_NONEMPTY);
409
410 base::CommandLine::StringVector new_args;
411 new_args.push_back(command_line->argv()[0]);
412 new_args.insert(new_args.end(), args.begin(), args.end());
413
414 base::CommandLine extra_cmd_line(new_args);
415 command_line->AppendArguments(extra_cmd_line, false);
416 }
391}417}
392418
393void AddFormFactorSpecificCommandLineArguments() {419void AddFormFactorSpecificCommandLineArguments() {

Subscribers

People subscribed via source and target branches

to all changes: