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

Side by Side Diff: content/browser/renderer_host/text_input_client_mac.mm

Issue 24012002: Move Range code to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d Created 7 years, 3 months 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 | Annotate | Revision Log
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 #import "content/browser/renderer_host/text_input_client_mac.h" 5 #import "content/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/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 55
56 NSRect TextInputClientMac::GetFirstRectForRange(RenderWidgetHost* rwh, 56 NSRect TextInputClientMac::GetFirstRectForRange(RenderWidgetHost* rwh,
57 NSRange range) { 57 NSRange range) {
58 base::TimeTicks start = base::TimeTicks::Now(); 58 base::TimeTicks start = base::TimeTicks::Now();
59 59
60 BeforeRequest(); 60 BeforeRequest();
61 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); 61 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh);
62 rwhi->Send( 62 rwhi->Send(
63 new TextInputClientMsg_FirstRectForCharacterRange(rwhi->GetRoutingID(), 63 new TextInputClientMsg_FirstRectForCharacterRange(rwhi->GetRoutingID(),
64 ui::Range(range))); 64 gfx::Range(range)));
65 // http://crbug.com/121917 65 // http://crbug.com/121917
66 base::ThreadRestrictions::ScopedAllowWait allow_wait; 66 base::ThreadRestrictions::ScopedAllowWait allow_wait;
67 condition_.TimedWait(base::TimeDelta::FromMilliseconds(kWaitTimeout)); 67 condition_.TimedWait(base::TimeDelta::FromMilliseconds(kWaitTimeout));
68 AfterRequest(); 68 AfterRequest();
69 69
70 base::TimeDelta delta(base::TimeTicks::Now() - start); 70 base::TimeDelta delta(base::TimeTicks::Now() - start);
71 UMA_HISTOGRAM_LONG_TIMES("TextInputClient.FirstRect", 71 UMA_HISTOGRAM_LONG_TIMES("TextInputClient.FirstRect",
72 delta * base::Time::kMicrosecondsPerMillisecond); 72 delta * base::Time::kMicrosecondsPerMillisecond);
73 73
74 return first_rect_; 74 return first_rect_;
75 } 75 }
76 76
77 NSAttributedString* TextInputClientMac::GetAttributedSubstringFromRange( 77 NSAttributedString* TextInputClientMac::GetAttributedSubstringFromRange(
78 RenderWidgetHost* rwh, 78 RenderWidgetHost* rwh,
79 NSRange range) { 79 NSRange range) {
80 base::TimeTicks start = base::TimeTicks::Now(); 80 base::TimeTicks start = base::TimeTicks::Now();
81 81
82 BeforeRequest(); 82 BeforeRequest();
83 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); 83 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh);
84 rwhi->Send(new TextInputClientMsg_StringForRange(rwhi->GetRoutingID(), 84 rwhi->Send(new TextInputClientMsg_StringForRange(rwhi->GetRoutingID(),
85 ui::Range(range))); 85 gfx::Range(range)));
86 // http://crbug.com/121917 86 // http://crbug.com/121917
87 base::ThreadRestrictions::ScopedAllowWait allow_wait; 87 base::ThreadRestrictions::ScopedAllowWait allow_wait;
88 condition_.TimedWait(base::TimeDelta::FromMilliseconds(kWaitTimeout)); 88 condition_.TimedWait(base::TimeDelta::FromMilliseconds(kWaitTimeout));
89 AfterRequest(); 89 AfterRequest();
90 90
91 base::TimeDelta delta(base::TimeTicks::Now() - start); 91 base::TimeDelta delta(base::TimeTicks::Now() - start);
92 UMA_HISTOGRAM_LONG_TIMES("TextInputClient.Substring", 92 UMA_HISTOGRAM_LONG_TIMES("TextInputClient.Substring",
93 delta * base::Time::kMicrosecondsPerMillisecond); 93 delta * base::Time::kMicrosecondsPerMillisecond);
94 94
95 // Lookup.framework calls this method repeatedly and expects that repeated 95 // Lookup.framework calls this method repeatedly and expects that repeated
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 character_index_ = NSNotFound; 131 character_index_ = NSNotFound;
132 first_rect_ = NSZeroRect; 132 first_rect_ = NSZeroRect;
133 substring_.reset(); 133 substring_.reset();
134 } 134 }
135 135
136 void TextInputClientMac::AfterRequest() { 136 void TextInputClientMac::AfterRequest() {
137 lock_.Release(); 137 lock_.Release();
138 } 138 }
139 139
140 } // namespace content 140 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698