aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp
diff options
context:
space:
mode:
authorGravatar Thiago Farina <tfarina@chromium.org>2016-09-30 08:36:20 +0000
committerGravatar Yun Peng <pcloudy@google.com>2016-09-30 10:57:13 +0000
commitc380dc4b6ac734bd1f7ab78fcbfee191c9fdb480 (patch)
tree2d80b1b07a52c3751329e4284dcc0f08ff72ade1 /src/main/cpp
parent1eac7e8195158a1b88dd6d1f11e5690ec387e077 (diff)
cpp: integrate Init() into the StartupOptions constructor
This patch integrates the code of Init() function into StartupOptions's constuctor and thus fixing the TODO in startup_options.cc. -- Change-Id: Ic041306387f5ef82fa80d8511c3e9b7be706754a Reviewed-on: https://bazel-review.googlesource.com/#/c/6332/2 MOS_MIGRATED_REVID=134759417
Diffstat (limited to 'src/main/cpp')
-rw-r--r--src/main/cpp/startup_options.cc50
-rw-r--r--src/main/cpp/startup_options.h4
2 files changed, 21 insertions, 33 deletions
diff --git a/src/main/cpp/startup_options.cc b/src/main/cpp/startup_options.cc
index 09b8eab33e..3f93b30aa2 100644
--- a/src/main/cpp/startup_options.cc
+++ b/src/main/cpp/startup_options.cc
@@ -33,51 +33,41 @@ namespace blaze {
using std::vector;
-StartupOptions::StartupOptions() :
- StartupOptions("Bazel") {
- Init();
-}
-
-StartupOptions::StartupOptions(const string& product_name) :
- product_name(product_name) {
- Init();
-}
+StartupOptions::StartupOptions() : StartupOptions("Bazel") {}
-StartupOptions::~StartupOptions() {
-}
-
-// TODO(jmmv): Integrate Init into the StartupOptions constructor.
-void StartupOptions::Init() {
+StartupOptions::StartupOptions(const string &product_name)
+ : product_name(product_name),
+ deep_execroot(true),
+ block_for_lock(true),
+ host_jvm_debug(false),
+ batch(false),
+ batch_cpu_scheduling(false),
+ io_nice_level(-1),
+ oom_more_eagerly(false),
+ oom_more_eagerly_threshold(100),
+ write_command_log(true),
+ watchfs(false),
+ allow_configurable_attributes(false),
+ fatal_event_bus_exceptions(false),
+ command_port(0),
+ invocation_policy(NULL) {
bool testing = getenv("TEST_TMPDIR") != NULL;
if (testing) {
output_root = MakeAbsolute(getenv("TEST_TMPDIR"));
} else {
- output_root = WorkspaceLayout::GetOutputRoot();
+ output_root = WorkspaceLayout::GetOutputRoot();
}
string product_name_lower = product_name;
blaze_util::ToLower(&product_name_lower);
output_user_root = blaze_util::JoinPath(
output_root, "_" + product_name_lower + "_" + GetUserName());
- deep_execroot = true;
- block_for_lock = true;
- host_jvm_debug = false;
- host_javabase = "";
- batch = false;
- batch_cpu_scheduling = false;
- allow_configurable_attributes = false;
- fatal_event_bus_exceptions = false;
- io_nice_level = -1;
// 3 hours (but only 15 seconds if used within a test)
max_idle_secs = testing ? 15 : (3 * 3600);
- oom_more_eagerly_threshold = 100;
- command_port = 0;
- oom_more_eagerly = false;
- write_command_log = true;
- watchfs = false;
- invocation_policy = NULL;
}
+StartupOptions::~StartupOptions() {}
+
void StartupOptions::AddExtraOptions(vector<string> *result) const {}
blaze_exit_code::ExitCode StartupOptions::ProcessArg(
diff --git a/src/main/cpp/startup_options.h b/src/main/cpp/startup_options.h
index 523523a32c..b7b4c3fd6b 100644
--- a/src/main/cpp/startup_options.h
+++ b/src/main/cpp/startup_options.h
@@ -207,10 +207,8 @@ class StartupOptions {
private:
string host_javabase;
-
- // Sets default values for members.
- void Init();
};
} // namespace blaze
+
#endif // BAZEL_SRC_MAIN_CPP_STARTUP_OPTIONS_H_