Skip to content

Commit be0eb82

Browse files
authored
Remove --timeout/--restricted from renderer (#1494)
As part of our ongoing effort to deprecate restricted mode (#1376), we are removing the --timeout and --restricted flags from mozc_renderer. These flags had actually used only in Windows until recently, but with the recent commit [1] there remains no code path that specifies these flags. Therefore we can safely remove these unused flags and the related code. [1]: ca34c8d PiperOrigin-RevId: 913010141
1 parent 7e648b2 commit be0eb82

7 files changed

Lines changed: 1 addition & 62 deletions

File tree

src/renderer/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ mozc_cc_library(
122122
"//protocol:commands_cc_proto",
123123
"//protocol:config_cc_proto",
124124
"//protocol:renderer_cc_proto",
125-
"@com_google_absl//absl/flags:flag",
126125
"@com_google_absl//absl/log",
127126
"@com_google_absl//absl/strings",
128127
"@com_google_absl//absl/time",
@@ -338,6 +337,5 @@ mozc_cc_library(
338337
"//base:init_mozc",
339338
"//base:run_level",
340339
"//base:system_util",
341-
"@com_google_absl//absl/flags:flag",
342340
],
343341
)

src/renderer/init_mozc_renderer.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,10 @@
3131

3232
#include <cstdlib>
3333

34-
#include "absl/flags/declare.h"
35-
#include "absl/flags/flag.h"
3634
#include "base/init_mozc.h"
3735
#include "base/run_level.h"
3836
#include "base/system_util.h"
3937

40-
ABSL_DECLARE_FLAG(bool, restricted);
41-
4238
namespace mozc::renderer {
4339

4440
void InitMozcRenderer(const char* argv0, int* argc, char*** argv) {
@@ -50,10 +46,6 @@ void InitMozcRenderer(const char* argv0, int* argc, char*** argv) {
5046

5147
mozc::SystemUtil::DisableIME();
5248

53-
// restricted mode
54-
if (run_level == mozc::RunLevel::RESTRICTED) {
55-
absl::SetFlag(&FLAGS_restricted, true);
56-
}
5749
mozc::InitMozc(argv0, argc, argv);
5850
}
5951

src/renderer/qt/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ mozc_cc_qt_library(
9999
"//ipc:named_event",
100100
"//protocol:config_cc_proto",
101101
"//protocol:renderer_cc_proto",
102-
"@com_google_absl//absl/flags:flag",
103102
"@com_google_absl//absl/log",
104103
"@com_google_absl//absl/strings:string_view",
105104
],

src/renderer/qt/qt_server.cc

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@
3535

3636
#include <QApplication>
3737
#include <QMetaType>
38-
#include <algorithm>
39-
#include <cstdint>
4038
#include <string>
4139

42-
#include "absl/flags/flag.h"
4340
#include "absl/log/log.h"
4441
#include "absl/strings/string_view.h"
4542
#include "base/system_util.h"
@@ -53,12 +50,6 @@
5350
#include "config/config_handler.h"
5451
#endif // NDEBUG
5552

56-
// By default, mozc_renderer quits when user-input continues to be
57-
// idle for 10min.
58-
ABSL_FLAG(int32_t, timeout, 10 * 60, "timeout of candidate server (sec)");
59-
ABSL_FLAG(bool, restricted, false,
60-
"launch candidates server with restricted mode");
61-
6253
Q_DECLARE_METATYPE(std::string);
6354

6455
namespace mozc {
@@ -78,16 +69,7 @@ std::string GetServiceName() {
7869
}
7970
} // namespace
8071

81-
QtServer::QtServer() : timeout_(0) {
82-
if (absl::GetFlag(FLAGS_restricted)) {
83-
absl::SetFlag(&FLAGS_timeout,
84-
// set 60 sec with restricted mode
85-
std::min(absl::GetFlag(FLAGS_timeout), 60));
86-
}
87-
88-
timeout_ = 1000 * std::clamp(absl::GetFlag(FLAGS_timeout), 3, 24 * 60 * 60);
89-
MOZC_VLOG(2) << "timeout is set to be : " << timeout_;
90-
72+
QtServer::QtServer() {
9173
#ifndef NDEBUG
9274
mozc::internal::SetConfigVLogLevel(
9375
config::ConfigHandler::GetSharedConfig()->verbose_level());
@@ -136,7 +118,5 @@ bool QtServer::ExecCommandInternal(const commands::RendererCommand& command) {
136118
return renderer_.ExecCommand(command);
137119
}
138120

139-
uint32_t QtServer::timeout() const { return timeout_; }
140-
141121
} // namespace renderer
142122
} // namespace mozc

src/renderer/qt/qt_server.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#ifndef MOZC_RENDERER_QT_QT_SERVER_H_
3131
#define MOZC_RENDERER_QT_QT_SERVER_H_
3232

33-
#include <cstdint>
3433
#include <string>
3534

3635
#include "absl/strings/string_view.h"
@@ -64,16 +63,10 @@ class QtServer : public QObject {
6463
// of AsyncExecCommand()
6564
bool ExecCommandInternal(const commands::RendererCommand& command);
6665

67-
// return timeout (msec) passed by FLAGS_timeout
68-
uint32_t timeout() const;
69-
7066
QtWindowManager renderer_;
7167

7268
private:
7369
QtIpcThread ipc_thread_;
74-
75-
// From RendererServer
76-
uint32_t timeout_;
7770
};
7871

7972
} // namespace renderer

src/renderer/renderer_server.cc

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@
2929

3030
#include "renderer/renderer_server.h"
3131

32-
#include <algorithm>
3332
#include <cstdint>
3433
#include <memory>
3534
#include <string>
3635

37-
#include "absl/flags/flag.h"
3836
#include "absl/log/log.h"
3937
#include "absl/strings/str_cat.h"
4038
#include "absl/strings/string_view.h"
@@ -59,12 +57,6 @@
5957
#include "base/win32/win_util.h"
6058
#endif // _WIN32
6159

62-
// By default, mozc_renderer quits when user-input continues to be
63-
// idle for 10min.
64-
ABSL_FLAG(int32_t, timeout, 10 * 60, "timeout of candidate server (sec)");
65-
ABSL_FLAG(bool, restricted, false,
66-
"launch candidates server with restricted mode");
67-
6860
namespace mozc {
6961
namespace renderer {
7062

@@ -141,7 +133,6 @@ RendererServer::RendererServer(bool for_testing)
141133
: IPCServer(ConstructServiceName(for_testing), kNumConnections,
142134
kIPCServerTimeOut),
143135
renderer_interface_(nullptr),
144-
timeout_(0),
145136
send_command_(std::make_unique<RendererServerSendCommand>()) {
146137
watch_dog_ = std::make_unique<ProcessWatchDog>(
147138
[this](ProcessWatchDog::SignalType type) {
@@ -159,14 +150,6 @@ RendererServer::RendererServer(bool for_testing)
159150
}
160151
}
161152
});
162-
if (absl::GetFlag(FLAGS_restricted)) {
163-
absl::SetFlag(&FLAGS_timeout,
164-
// set 60sec with restricted mode
165-
std::min(absl::GetFlag(FLAGS_timeout), 60));
166-
}
167-
168-
timeout_ = 1000 * std::clamp(absl::GetFlag(FLAGS_timeout), 3, 24 * 60 * 60);
169-
MOZC_VLOG(2) << "timeout is set to be : " << timeout_;
170153

171154
#ifndef NDEBUG
172155
mozc::internal::SetConfigVLogLevel(
@@ -252,6 +235,5 @@ bool RendererServer::ExecCommandInternal(
252235
return false;
253236
}
254237

255-
uint32_t RendererServer::timeout() const { return timeout_; }
256238
} // namespace renderer
257239
} // namespace mozc

src/renderer/renderer_server.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#ifndef MOZC_RENDERER_RENDERER_SERVER_H_
3131
#define MOZC_RENDERER_RENDERER_SERVER_H_
3232

33-
#include <cstdint>
3433
#include <memory>
3534
#include <string>
3635

@@ -88,13 +87,9 @@ class RendererServer : public IPCServer {
8887
// of AsyncExecCommand()
8988
bool ExecCommandInternal(const commands::RendererCommand& command);
9089

91-
// return timeout (msec) passed by FLAGS_timeout
92-
uint32_t timeout() const;
93-
9490
RendererInterface* renderer_interface_ = nullptr;
9591

9692
private:
97-
uint32_t timeout_;
9893
std::unique_ptr<ProcessWatchDog> watch_dog_;
9994
std::unique_ptr<RendererServerSendCommand> send_command_;
10095
};

0 commit comments

Comments
 (0)