Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // Integration with OS X native spellchecker. | 5 // Integration with OS X native spellchecker. |
| 6 | 6 |
| 7 #include "chrome/browser/spellchecker/spellcheck_platform_mac.h" | 7 #include "chrome/browser/spellchecker/spellcheck_platform_mac.h" |
| 8 | 8 |
| 9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 10 | 10 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 | 190 |
| 191 // If the length of the misspelled word == 0, | 191 // If the length of the misspelled word == 0, |
| 192 // then there is no misspelled word. | 192 // then there is no misspelled word. |
| 193 bool word_correct = (spell_range.length == 0); | 193 bool word_correct = (spell_range.length == 0); |
| 194 return word_correct; | 194 return word_correct; |
| 195 } | 195 } |
| 196 | 196 |
| 197 void FillSuggestionList(const base::string16& wrong_word, | 197 void FillSuggestionList(const base::string16& wrong_word, |
| 198 std::vector<base::string16>* optional_suggestions) { | 198 std::vector<base::string16>* optional_suggestions) { |
| 199 NSString* NS_wrong_word = base::SysUTF16ToNSString(wrong_word); | 199 NSString* NS_wrong_word = base::SysUTF16ToNSString(wrong_word); |
| 200 TimeTicks debug_begin_time = base::Histogram::DebugNow(); | 200 #ifndef NDEBUG |
| 201 TimeTicks debug_begin_time = base::TimeTicks::Now(); | |
| 202 #endif | |
| 201 // The suggested words for |wrong_word|. | 203 // The suggested words for |wrong_word|. |
| 202 NSArray* guesses = [SharedSpellChecker() guessesForWord:NS_wrong_word]; | 204 NSArray* guesses = [SharedSpellChecker() guessesForWord:NS_wrong_word]; |
| 203 DHISTOGRAM_TIMES("Spellcheck.SuggestTime", | 205 #ifndef NDEBUG |
| 204 base::Histogram::DebugNow() - debug_begin_time); | 206 LOCAL_HISTOGRAM_TIMES("Spellcheck.SuggestTime", |
|
groby-ooo-7-16
2014/08/25 21:12:11
Feel free to remove
Alexei Svitkine (slow)
2014/08/25 21:21:03
Done.
| |
| 207 base::TimeTicks::Now() - debug_begin_time); | |
| 208 #endif | |
| 205 | 209 |
| 206 for (int i = 0; i < static_cast<int>([guesses count]); ++i) { | 210 for (int i = 0; i < static_cast<int>([guesses count]); ++i) { |
| 207 if (i < chrome::spellcheck_common::kMaxSuggestions) { | 211 if (i < chrome::spellcheck_common::kMaxSuggestions) { |
| 208 optional_suggestions->push_back(base::SysNSStringToUTF16( | 212 optional_suggestions->push_back(base::SysNSStringToUTF16( |
| 209 [guesses objectAtIndex:i])); | 213 [guesses objectAtIndex:i])); |
| 210 } | 214 } |
| 211 } | 215 } |
| 212 } | 216 } |
| 213 | 217 |
| 214 void AddWord(const base::string16& word) { | 218 void AddWord(const base::string16& word) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 | 301 |
| 298 ScopedEnglishLanguageForTest::ScopedEnglishLanguageForTest() | 302 ScopedEnglishLanguageForTest::ScopedEnglishLanguageForTest() |
| 299 : state_(new SpellcheckerStateInternal) { | 303 : state_(new SpellcheckerStateInternal) { |
| 300 } | 304 } |
| 301 | 305 |
| 302 ScopedEnglishLanguageForTest::~ScopedEnglishLanguageForTest() { | 306 ScopedEnglishLanguageForTest::~ScopedEnglishLanguageForTest() { |
| 303 delete state_; | 307 delete state_; |
| 304 } | 308 } |
| 305 | 309 |
| 306 } // namespace spellcheck_mac | 310 } // namespace spellcheck_mac |
| OLD | NEW |