Commit Graph

2536 Commits

Author SHA1 Message Date
Yohei Yukawa
dca6482572 Introduce .clang-format
See https://clang.llvm.org/docs/ClangFormatStyleOptions.html about the format.

See https://clang.llvm.org/docs/ClangFormat.html about how to trigger clang-format and integrations with common editors.

PiperOrigin-RevId: 523046409
2023-04-10 06:18:39 +00:00
Yohei Yukawa
52cb89ebef Add /.vs/ to .gitignore
PiperOrigin-RevId: 523045993
2023-04-10 06:15:49 +00:00
Toshiyuki Hanaoka
65d8d67a8c - Limit the maximum number of Typing Correction results for the same TC query
- Apply predictive cost penalty to Bigram and TypingCorrection entries.

PiperOrigin-RevId: 523019207
2023-04-10 03:24:06 +00:00
Yohei Yukawa
cc4e161aee Install 64-bit cache_service/converter/renderer for 64-bit Windows
Historically GoogleJapaneseInput64.msi have installed 32-bit executables unless it really needs to be 64-bit, mostly because to minimize build time and differences from GoogleJapaneseInput32.msi.

At the same time, in general 64-bit executables have more capability on 64-bit Windows (e.g. better ASLR, newer CPU features, some APIs such as special user-mode APC).  Maybe it's time to start distributing more 64-bit versions executables.

With this CL, GoogleJapaneseInput64.msi will install 64-bit versions of the following executables.

- GoogleIMEJaRenderer.exe
- GoogleIMEJaCacheService.exe
- GoogleIMEJaConverter.exe

PiperOrigin-RevId: 522965093
2023-04-09 17:42:14 +00:00
Yohei Yukawa
0f0f860acb Add .vscode/ to .gitignore
PiperOrigin-RevId: 522758486
2023-04-08 05:20:29 +00:00
Yohei Yukawa
b5600b8eb8 Use %USERPROFILE%\source\repos as the repository root for Windows
Creating `C:\work` actually requires Administrator privilege.  Let's use actual user profile directory so as not to confuse people.

PiperOrigin-RevId: 522758447
2023-04-08 05:19:51 +00:00
Yohei Yukawa
aacb4c97bb Use VS2019 for build instructions
Visual Studio 2017 15.3 and later do bundle `ninja.exe`, which means that we no longer need to ask developers to check out `depot_tools` for such a build environment.

To simplify build instructions, this CL updates the default value of `--msvs_version` option to be '2019' from '2017' with removing all the references to `depot_tools` from the build instructions.

#codehealth

PiperOrigin-RevId: 522758283
2023-04-08 05:18:18 +00:00
Yohei Yukawa
3324df1d56 Run build and runtests in parallel for Windows CI
It seems that Windows CI occasionally takes more than 60 min, which is greater than our current configuration `timeout-minutes: 60`.

While we can increase timeout, it would be nice if we can run both `build` and `runtests` in parallel for faster turnaround time.

#codehealth

PiperOrigin-RevId: 522754666
2023-04-08 04:43:06 +00:00
Yohei Yukawa
3608f8fa31 Simplify WindowPositionEmulator a bit
`WindowPositionEmulator` no longer needs to keep track of window class name.

#codehalth

PiperOrigin-RevId: 522733853
2023-04-08 02:11:20 +00:00
Yohei Yukawa
775106b8b3 Remove unused GetWindowClassName()
`Win32RendererUtil::GetWindowClassName()` is no longer used in production.
We do not need to keep and test it any more.

#codehealth

PiperOrigin-RevId: 522727324
2023-04-08 01:14:42 +00:00
Yohei Yukawa
f9cd87a5f1 Assume initialized() == has_exclude_region()
Now that `CandidateWindowLayout::initialized()` and `CandidateWindowLayout::has_exclude_region()` are guaranteed to return the same value, we can simply remove the later.

#codehealth

PiperOrigin-RevId: 522724184
2023-04-08 00:49:53 +00:00
Emma Haruka Iwao
25692df7ff Split DLL main entry point and routines to mozc_tip_main.cc
mozc_dll_module has both DLL main and TipDllModule. TipDllModule is referenced by many components, which resulted in cyclic dependencies. This CL split them into separate files and moves the entry point and related functions to mozc_tip_main.cc.

PiperOrigin-RevId: 522723942
2023-04-08 00:48:09 +00:00
Emma Haruka Iwao
b861ff2497 Migrate to WRL::ComPtr and add final to implementation classes
WRL::ComPtr is an improved version of COM object wrapper by Microsoft. ATL::CComPtr lacks newer C++ semantics and doesn't always work with final classes.

More changes will follow.

PiperOrigin-RevId: 522723761
2023-04-08 00:46:41 +00:00
Yohei Yukawa
7a202d7f78 Merge CandidateWindowLayout::has_exclude_region_ into initialized_
Now that the following fields are always initialized with the same value, we can simply merge them without changing any observable behavior.

 - `CandidateWindowLayout::initialized_`
 - `CandidateWindowLayout::has_exclude_region_`

#codehealth

PiperOrigin-RevId: 522720050
2023-04-08 00:21:40 +00:00
Emma Haruka Iwao
e254877d29 Move WM_MOZC_IMMERSIVE_WINDOW_UPDATE to tip_ui_renderer_immersive.h to avoid cyclic dependency.
PiperOrigin-RevId: 522716851
2023-04-08 00:05:21 +00:00
Emma Haruka Iwao
6dbc12ad62 Mark COM implementation classes final
PiperOrigin-RevId: 522716834
2023-04-08 00:05:15 +00:00
Emma Haruka Iwao
df2fa645c5 Include what you use
#codehealth

PiperOrigin-RevId: 522714999
2023-04-07 23:56:49 +00:00
Emma Haruka Iwao
c3460146af Use constexpr to declare constants, use {} to default initialize struct fields
PiperOrigin-RevId: 522714982
2023-04-07 23:56:44 +00:00
Emma Haruka Iwao
f56d9fe2f5 Compare with the same enum type for TipInputModeManager::Action
PiperOrigin-RevId: 522714933
2023-04-07 23:56:33 +00:00
Yohei Yukawa
761c86e62a Remove unused CandidateWindowLayout::InitializeWithPosition()
#codehealth

PiperOrigin-RevId: 522714270
2023-04-07 23:53:35 +00:00
Emma Haruka Iwao
5a37662013 Change static DCHECKs to static_assert, use constexpr to define constants
PiperOrigin-RevId: 522711959
2023-04-07 23:40:35 +00:00
Yohei Yukawa
7209a02599 Make GetWorkingAreaFromPoint() a flat function
We no longer mock `WorkingAreaInterface`.  `NativeWorkingAreaAPI::GetWorkingAreaFromPoint()` can now be directly exposed as a flat function.

#codehealth

PiperOrigin-RevId: 522704762
2023-04-07 23:03:49 +00:00
Yohei Yukawa
1bd5ae9463 Assume LayoutManager::GetDefaultGuiFont() is no longer used
Now that `LayoutManager::GetDefaultGuiFont()` is no longer used, we can delete dead code such as `SystemPreferenceInterface`, `NativeSystemPreferenceAPI`, `SystemPreferenceEmulatorImpl`, and `SystemPreferenceFactory`.

PiperOrigin-RevId: 522622499
2023-04-07 17:05:29 +00:00
Yohei Yukawa
8aaded7faf Remove LayoutManager::GetCompatibilityMode(), which is unused
#codehealth

PiperOrigin-RevId: 522615598
2023-04-07 16:33:15 +00:00
Yohei Yukawa
1e9a3bc7cd Unify LayoutManager::LayoutCandidateWindowFor*()
Now that `LayoutManager::LayoutCandidateWindowFor{Suggestion,Conversion}()` have exactly the same implementation, we can safely merge them into a single method `LayoutManager::LayoutCandidateWindow()`.

#codehealth

PiperOrigin-RevId: 522606981
2023-04-07 15:50:29 +00:00
Yohei Yukawa
6d0797118d Remove unused params from LayoutCandidateWindowByCompositionTarget
`LayoutCandidateWindowByCompositionTarget` no longer uses its parameter `compatibility_mode` and `for_suggestion`.

We should be able to safely remove these two parameters.

#codehealth

PiperOrigin-RevId: 522602336
2023-04-07 15:25:39 +00:00
Hiroyuki Komatsu
d16b263af0 Update BUILD_OSS to 5065.
PiperOrigin-RevId: 522543643
2023-04-07 07:44:22 +00:00
Yohei Yukawa
dc0976e988 Assume default_gui_font is always empty
Now that `default_gui_font.has_value()` always returns `false`, we can safely delete dead code.

#codehealth

PiperOrigin-RevId: 522529097
2023-04-07 05:47:10 +00:00
Hiroyuki Komatsu
815305ba23 Update data/dictionary_oss
#typingquality

PiperOrigin-RevId: 522522245
2023-04-07 04:53:53 +00:00
Yohei Yukawa
81625a5af9 Assume composition_font is always empty
Now that `composition_font.has_value()` always returns `false`, we can safely delete dead code.

#codehealth

PiperOrigin-RevId: 522521754
2023-04-07 04:50:26 +00:00
Yohei Yukawa
09095c0ac9 Assume composition_form_topleft is always empty
Now that `composition_form_topleft.has_value()` always returns `false`, we can safely delete dead code such as

 - `CanUseExcludeRegionInCandidateFrom`
 - `UpdateCandidateWindowFromBasePosAndFontHeight`
 - `LayoutCandidateWindowByCandidateForm`

#codehealth

PiperOrigin-RevId: 522515842
2023-04-07 04:18:02 +00:00
Yohei Yukawa
64d2c28600 Set VSLANG=1033 for Windows GYP build
`ninja.exe` hard-codes `"Note: including file: "` as an expected prefix
when parsing outputs from `cl.exe /showIncludes`.

ce700488e0/src/clparser.cc (L44-L58)

To make this work under non English environment, an environment variable
`VSLANG=1033` needs to be set, where `1033` comes from Windows Language ID for `en-US` that is `MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)`.

Fixes #708.

PiperOrigin-RevId: 522498609
2023-04-07 02:27:41 +00:00
Yohei Yukawa
be61d41fc5 Refactor build_mozc.py a bit
Before working on #708, this CL simplifies the code a bit.

There must be no behavior change in this CL.

#codehealth

PiperOrigin-RevId: 522494316
2023-04-07 01:54:57 +00:00
Hiroyuki Komatsu
debb828e6a Add 圃場(ほじょう) to evaluations.
https://github.com/google/mozc/issues/701

#typingquality

PiperOrigin-RevId: 522492721
2023-04-07 01:42:43 +00:00
Mozc team
0285f3dca9 LSC: Add heterogeneous lookup to std::string-keyed ordered containers.
Ordered maps and sets with std::string keys will be modified to support heterogenous lookup.
Specifically, std::less<> will be added as a comparator to compatible container types,
e.g. std::map<std::string, T> → std::map<std::string, T, std::less<>>.

For these types, heterogeneous lookup for string keys reduces friction in APIs, and allows `absl::string_view`s
to be used for lookup, instead of having to construct a temporary std::string.

An important benefit of this LSC is aiding in the migration from `const std::string&` to `absl::string_view`
near any map locus (the importance of which is outlined in go/recommending-stringview and
go/string-ref-to-string-view-lsc).

LSC Doc: go/string-keyed-heterogeneous-lookup-lsc

#string-keyed-transparent-lookup-lsc #codehealth

Tested:
    Local presubmit tests passed.
PiperOrigin-RevId: 522380849
2023-04-06 17:59:32 +00:00
Yohei Yukawa
9a34014590 Let Mozc IPC rely on PIPE_REJECT_REMOTE_CLIENTS
On Windows Vista and later OSes we can just rely on `PIPE_REJECT_REMOTE_CLIENTS` to protect named pipe instances from remote accesses.  We no longer need to have a deny DACL for `SDDL_NETWORK`, which can have tricky side effect when a process is invoked in a non-interactive way (e.g. "ssh").

PiperOrigin-RevId: 522153220
2023-04-05 21:22:07 +00:00
Mozc team
08b16e9351 Fix 3 ClangTidyBuild findings:
* missing #include <iterator> for 'std::size'
* missing #include <utility> for 'std::swap'

#codehealth

Tested:
    Local presubmit tests passed.
PiperOrigin-RevId: 521985353
2023-04-05 08:33:57 +00:00
Toshiyuki Hanaoka
2e4c2ea554 Stop promoting TC entries when the query cost is negative in use_typing_correction_diff_cost.
PiperOrigin-RevId: 521762961
2023-04-04 14:56:35 +00:00
Toshiyuki Hanaoka
bf965814ce Add a feature to cancel suffix penalty for content node.
PiperOrigin-RevId: 521675951
2023-04-04 07:01:22 +00:00
Yohei Yukawa
25435fc75a Run also runtests in CI for Windows
With this CL `python build_mozc.py runtests -c Debug` is also executed in CI for Windows.

Overall latency impact is roughly 20 min, which is hopefully acceptable.

Debug build is chosen because Visual C++ Debug binaries have revealed multiple issues that were not detected by GCC/Clang debug binaries.

#codehealth

PiperOrigin-RevId: 521652700
2023-04-04 04:54:42 +00:00
Yohei Yukawa
cb779d5441 Reduce console messages from build_mozc.py gyp
With this CL `build_mozc.py gyp` no longer dumps 'environment.x86' and 'environment.x64' to console, which is a bit too verbose.

#codehealth

PiperOrigin-RevId: 521618886
2023-04-04 01:32:12 +00:00
Yohei Yukawa
13164e784e Assume composition_form_topleft is always empty
Now that `composition_form_topleft.has_value()` always returns `false`, we can safely delete `LayoutIndicatorWindowByCompositionForm()`, which is guaranteed to return `false` without doing anything.

#codehealth

PiperOrigin-RevId: 521499224
2023-04-03 17:36:03 +00:00
Hiroyuki Komatsu
419cd98728 Fix a build failure for the OSS version.
* Follow-up to cl/521349670

#codehealth

PiperOrigin-RevId: 521433510
2023-04-03 12:38:58 +00:00
Noriyuki Takahashi
b39b2d4a9b Remove the unused method.
Mmap::Open() was migrated to Mmap::Map().
PiperOrigin-RevId: 521398946
2023-04-03 09:09:26 +00:00
Noriyuki Takahashi
e73ed7db80 Migrate Mmap::Open() to Map().
PiperOrigin-RevId: 521398669
2023-04-03 09:07:54 +00:00
Noriyuki Takahashi
3e770b6ef9 Fix the format specifier on Windows.
PiperOrigin-RevId: 521394120
2023-04-03 08:41:00 +00:00
Hiroyuki Komatsu
a41d0677d5 Update the document and workflow as the net/ directory was removed.
#codehealth

PiperOrigin-RevId: 521369482
2023-04-03 05:58:51 +00:00
Noriyuki Takahashi
1f90ce56ad Support partial mmap.
The new API can memory-map a region of a file. This is useful if one needs to
load a chunk of data from packed files.

PiperOrigin-RevId: 521349670
2023-04-03 03:46:15 +00:00
Toshiyuki Hanaoka
255f4f4d88 Set prefix penalty when the converter returns the dummy candidate.
PiperOrigin-RevId: 521332059
2023-04-03 01:32:04 +00:00
Hiroyuki Komatsu
64e2560861 Remove third_party/jsoncpp.
It is no longer used by Mozc.
2023-04-02 10:29:58 +00:00