OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import "chrome/browser/renderer_host/text_input_client_mac.h" | 5 #import "chrome/browser/renderer_host/text_input_client_mac.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "chrome/common/text_input_client_messages.h" | 10 #include "chrome/common/text_input_client_messages.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 | 77 |
78 base::TimeDelta delta(base::TimeTicks::Now() - start); | 78 base::TimeDelta delta(base::TimeTicks::Now() - start); |
79 UMA_HISTOGRAM_TIMES("TextInputClient.Substring", | 79 UMA_HISTOGRAM_TIMES("TextInputClient.Substring", |
80 delta * base::Time::kMicrosecondsPerMillisecond); | 80 delta * base::Time::kMicrosecondsPerMillisecond); |
81 | 81 |
82 return substring_.get(); | 82 return substring_.get(); |
83 } | 83 } |
84 | 84 |
85 void TextInputClientMac::SetCharacterIndexAndSignal(NSUInteger index) { | 85 void TextInputClientMac::SetCharacterIndexAndSignal(NSUInteger index) { |
86 lock_.Acquire(); | 86 lock_.Acquire(); |
87 // |index| could be WTF::notFound (-1) and it's value is different from | |
88 // NSNotFound so we need to convert it. | |
89 if (index == static_cast<NSUInteger>(-1)) { | |
Robert Sesek
2011/05/19 15:16:56
I think a better place to do this would be in text
bashi
2011/05/20 04:43:15
Moved it to text_input_client_message_filter.mm.
| |
90 index = NSNotFound; | |
91 } | |
87 character_index_ = index; | 92 character_index_ = index; |
88 lock_.Release(); | 93 lock_.Release(); |
89 condition_.Signal(); | 94 condition_.Signal(); |
90 } | 95 } |
91 | 96 |
92 void TextInputClientMac::SetFirstRectAndSignal(NSRect first_rect) { | 97 void TextInputClientMac::SetFirstRectAndSignal(NSRect first_rect) { |
93 lock_.Acquire(); | 98 lock_.Acquire(); |
94 first_rect_ = first_rect; | 99 first_rect_ = first_rect; |
95 lock_.Release(); | 100 lock_.Release(); |
96 condition_.Signal(); | 101 condition_.Signal(); |
(...skipping 16 matching lines...) Expand all Loading... | |
113 delta * base::Time::kMicrosecondsPerMillisecond); | 118 delta * base::Time::kMicrosecondsPerMillisecond); |
114 | 119 |
115 character_index_ = NSNotFound; | 120 character_index_ = NSNotFound; |
116 first_rect_ = NSZeroRect; | 121 first_rect_ = NSZeroRect; |
117 substring_.reset(); | 122 substring_.reset(); |
118 } | 123 } |
119 | 124 |
120 void TextInputClientMac::AfterRequest() { | 125 void TextInputClientMac::AfterRequest() { |
121 lock_.Release(); | 126 lock_.Release(); |
122 } | 127 } |
OLD | NEW |