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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2323983003: DO NOT SUBMIT: Bundle IME-related messages into one for batch edit (Closed)
Patch Set: fixed nits and fixed blimp test Created 4 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
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 "content/browser/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <set> 9 #include <set>
10 #include <tuple> 10 #include <tuple>
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 received_paint_after_load_(false), 209 received_paint_after_load_(false),
210 next_browser_snapshot_id_(1), 210 next_browser_snapshot_id_(1),
211 owned_by_render_frame_host_(false), 211 owned_by_render_frame_host_(false),
212 is_focused_(false), 212 is_focused_(false),
213 hung_renderer_delay_( 213 hung_renderer_delay_(
214 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), 214 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)),
215 hang_monitor_reason_( 215 hang_monitor_reason_(
216 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_UNKNOWN), 216 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_UNKNOWN),
217 new_content_rendering_delay_( 217 new_content_rendering_delay_(
218 base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)), 218 base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)),
219 in_ime_batch_edit_(false),
219 weak_factory_(this) { 220 weak_factory_(this) {
220 CHECK(delegate_); 221 CHECK(delegate_);
221 CHECK_NE(MSG_ROUTING_NONE, routing_id_); 222 CHECK_NE(MSG_ROUTING_NONE, routing_id_);
222 223
223 #if defined(OS_WIN) 224 #if defined(OS_WIN)
224 // Update the display color profile cache so that it is likely to be up to 225 // Update the display color profile cache so that it is likely to be up to
225 // date when the renderer process requests the color profile. 226 // date when the renderer process requests the color profile.
226 if (gfx::ICCProfile::CachedProfilesNeedUpdate()) { 227 if (gfx::ICCProfile::CachedProfilesNeedUpdate()) {
227 BrowserThread::PostBlockingPoolTask( 228 BrowserThread::PostBlockingPoolTask(
228 FROM_HERE, 229 FROM_HERE,
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 if (IsUseZoomForDSFEnabled()) 1259 if (IsUseZoomForDSFEnabled())
1259 input_router_->SetDeviceScaleFactor(result->device_scale_factor); 1260 input_router_->SetDeviceScaleFactor(result->device_scale_factor);
1260 } 1261 }
1261 1262
1262 void RenderWidgetHostImpl::HandleCompositorProto( 1263 void RenderWidgetHostImpl::HandleCompositorProto(
1263 const std::vector<uint8_t>& proto) { 1264 const std::vector<uint8_t>& proto) {
1264 DCHECK(!proto.empty()); 1265 DCHECK(!proto.empty());
1265 Send(new ViewMsg_HandleCompositorProto(GetRoutingID(), proto)); 1266 Send(new ViewMsg_HandleCompositorProto(GetRoutingID(), proto));
1266 } 1267 }
1267 1268
1269 void RenderWidgetHostImpl::BeginBatchEdit() {
1270 in_ime_batch_edit_ = true;
1271 }
1272
1273 void RenderWidgetHostImpl::EndBatchEdit() {
1274 if (!in_ime_batch_edit_)
1275 return;
1276 in_ime_batch_edit_ = false;
1277 if (batch_edit_messages_.empty())
1278 return;
1279 Send(new InputMsg_ImeBatchEdit(routing_id_, batch_edit_messages_));
1280 batch_edit_messages_.clear();
1281 }
1282
1283 void RenderWidgetHostImpl::SendOrBatch(IPC::Message* message) {
1284 if (in_ime_batch_edit_)
1285 batch_edit_messages_.push_back(*message);
1286 else
1287 Send(message);
1288 }
1289
1290 void RenderWidgetHostImpl::ExtendSelectionAndDelete(size_t before,
1291 size_t after) {
1292 SendOrBatch(new InputMsg_ImeExtendSelectionAndDelete(
1293 routing_id_, before, after));
1294 }
1295
1268 void RenderWidgetHostImpl::NotifyScreenInfoChanged() { 1296 void RenderWidgetHostImpl::NotifyScreenInfoChanged() {
1269 if (delegate_) 1297 if (delegate_)
1270 delegate_->ScreenInfoChanged(); 1298 delegate_->ScreenInfoChanged();
1271 1299
1272 // The resize message (which may not happen immediately) will carry with it 1300 // The resize message (which may not happen immediately) will carry with it
1273 // the screen info as well as the new size (if the screen has changed scale 1301 // the screen info as well as the new size (if the screen has changed scale
1274 // factor). 1302 // factor).
1275 WasResized(); 1303 WasResized();
1276 } 1304 }
1277 1305
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 text_direction_canceled_ = false; 1434 text_direction_canceled_ = false;
1407 } 1435 }
1408 } 1436 }
1409 1437
1410 void RenderWidgetHostImpl::ImeSetComposition( 1438 void RenderWidgetHostImpl::ImeSetComposition(
1411 const base::string16& text, 1439 const base::string16& text,
1412 const std::vector<blink::WebCompositionUnderline>& underlines, 1440 const std::vector<blink::WebCompositionUnderline>& underlines,
1413 const gfx::Range& replacement_range, 1441 const gfx::Range& replacement_range,
1414 int selection_start, 1442 int selection_start,
1415 int selection_end) { 1443 int selection_end) {
1416 Send(new InputMsg_ImeSetComposition( 1444 SendOrBatch(new InputMsg_ImeSetComposition(
1417 GetRoutingID(), text, underlines, replacement_range, 1445 GetRoutingID(), text, underlines, replacement_range,
1418 selection_start, selection_end)); 1446 selection_start, selection_end));
1419 } 1447 }
1420 1448
1421 void RenderWidgetHostImpl::ImeConfirmComposition( 1449 void RenderWidgetHostImpl::ImeConfirmComposition(
1422 const base::string16& text, 1450 const base::string16& text,
1423 const gfx::Range& replacement_range, 1451 const gfx::Range& replacement_range,
1424 bool keep_selection) { 1452 bool keep_selection) {
1425 Send(new InputMsg_ImeConfirmComposition( 1453 SendOrBatch(new InputMsg_ImeConfirmComposition(
1426 GetRoutingID(), text, replacement_range, keep_selection)); 1454 GetRoutingID(), text, replacement_range, keep_selection));
1427 } 1455 }
1428 1456
1429 void RenderWidgetHostImpl::ImeCancelComposition() { 1457 void RenderWidgetHostImpl::ImeCancelComposition() {
1430 Send(new InputMsg_ImeSetComposition(GetRoutingID(), base::string16(), 1458 SendOrBatch(new InputMsg_ImeSetComposition(GetRoutingID(), base::string16(),
1431 std::vector<blink::WebCompositionUnderline>(), 1459 std::vector<blink::WebCompositionUnderline>(),
1432 gfx::Range::InvalidRange(), 0, 0)); 1460 gfx::Range::InvalidRange(), 0, 0));
1433 } 1461 }
1434 1462
1435 void RenderWidgetHostImpl::RejectMouseLockOrUnlockIfNecessary() { 1463 void RenderWidgetHostImpl::RejectMouseLockOrUnlockIfNecessary() {
1436 DCHECK(!pending_mouse_lock_request_ || !IsMouseLocked()); 1464 DCHECK(!pending_mouse_lock_request_ || !IsMouseLocked());
1437 if (pending_mouse_lock_request_) { 1465 if (pending_mouse_lock_request_) {
1438 pending_mouse_lock_request_ = false; 1466 pending_mouse_lock_request_ = false;
1439 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); 1467 Send(new ViewMsg_LockMouse_ACK(routing_id_, false));
1440 } else if (IsMouseLocked()) { 1468 } else if (IsMouseLocked()) {
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; 2236 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL;
2209 } 2237 }
2210 2238
2211 BrowserAccessibilityManager* 2239 BrowserAccessibilityManager*
2212 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { 2240 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() {
2213 return delegate_ ? 2241 return delegate_ ?
2214 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; 2242 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL;
2215 } 2243 }
2216 2244
2217 } // namespace content 2245 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_view_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698