Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: chrome/renderer/spellchecker/hunspell_engine.cc

Issue 810283003: replace COMPILE_ASSERT with static_assert in chrome/[r-z]*/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/renderer/spellchecker/spellcheck_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/spellchecker/hunspell_engine.h" 5 #include "chrome/renderer/spellchecker/hunspell_engine.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/files/memory_mapped_file.h" 10 #include "base/files/memory_mapped_file.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "chrome/common/spellcheck_common.h" 12 #include "chrome/common/spellcheck_common.h"
13 #include "chrome/common/spellcheck_messages.h" 13 #include "chrome/common/spellcheck_messages.h"
14 #include "content/public/renderer/render_thread.h" 14 #include "content/public/renderer/render_thread.h"
15 #include "third_party/hunspell/src/hunspell/hunspell.hxx" 15 #include "third_party/hunspell/src/hunspell/hunspell.hxx"
16 16
17 using content::RenderThread; 17 using content::RenderThread;
18 18
19 namespace { 19 namespace {
20 // Maximum length of words we actually check. 20 // Maximum length of words we actually check.
21 // 64 is the observed limits for OSX system checker. 21 // 64 is the observed limits for OSX system checker.
22 const size_t kMaxCheckedLen = 64; 22 const size_t kMaxCheckedLen = 64;
23 23
24 // Maximum length of words we provide suggestions for. 24 // Maximum length of words we provide suggestions for.
25 // 24 is the observed limits for OSX system checker. 25 // 24 is the observed limits for OSX system checker.
26 const size_t kMaxSuggestLen = 24; 26 const size_t kMaxSuggestLen = 24;
27 27
28 COMPILE_ASSERT(kMaxCheckedLen <= size_t(MAXWORDLEN), MaxCheckedLen_too_long); 28 static_assert(kMaxCheckedLen <= size_t(MAXWORDLEN),
29 COMPILE_ASSERT(kMaxSuggestLen <= kMaxCheckedLen, MaxSuggestLen_too_long); 29 "MaxCheckedLen too long");
30 static_assert(kMaxSuggestLen <= kMaxCheckedLen,
31 "MaxSuggestLen too long");
30 } // namespace 32 } // namespace
31 33
32 #if !defined(OS_MACOSX) 34 #if !defined(OS_MACOSX)
33 SpellingEngine* CreateNativeSpellingEngine() { 35 SpellingEngine* CreateNativeSpellingEngine() {
34 return new HunspellEngine(); 36 return new HunspellEngine();
35 } 37 }
36 #endif 38 #endif
37 39
38 HunspellEngine::HunspellEngine() 40 HunspellEngine::HunspellEngine()
39 : hunspell_enabled_(false), 41 : hunspell_enabled_(false),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Don't initialize if hunspell is disabled. 129 // Don't initialize if hunspell is disabled.
128 if (file_.IsValid()) 130 if (file_.IsValid())
129 InitializeHunspell(); 131 InitializeHunspell();
130 132
131 return !initialized_; 133 return !initialized_;
132 } 134 }
133 135
134 bool HunspellEngine::IsEnabled() { 136 bool HunspellEngine::IsEnabled() {
135 return hunspell_enabled_; 137 return hunspell_enabled_;
136 } 138 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/spellchecker/spellcheck_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698