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

Side by Side Diff: content/renderer/render_widget.cc

Issue 2355483006: Allow some InputConnection methods to be called on UI thread (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | 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 "content/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 opener_id_(MSG_ROUTING_NONE), 230 opener_id_(MSG_ROUTING_NONE),
231 next_paint_flags_(0), 231 next_paint_flags_(0),
232 auto_resize_mode_(false), 232 auto_resize_mode_(false),
233 need_update_rect_for_auto_resize_(false), 233 need_update_rect_for_auto_resize_(false),
234 did_show_(false), 234 did_show_(false),
235 is_hidden_(hidden), 235 is_hidden_(hidden),
236 compositor_never_visible_(never_visible), 236 compositor_never_visible_(never_visible),
237 is_fullscreen_granted_(false), 237 is_fullscreen_granted_(false),
238 display_mode_(blink::WebDisplayModeUndefined), 238 display_mode_(blink::WebDisplayModeUndefined),
239 ime_event_guard_(nullptr), 239 ime_event_guard_(nullptr),
240 ime_in_batch_edit_(false),
240 closing_(false), 241 closing_(false),
241 host_closing_(false), 242 host_closing_(false),
242 is_swapped_out_(swapped_out), 243 is_swapped_out_(swapped_out),
243 for_oopif_(false), 244 for_oopif_(false),
244 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 245 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
245 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), 246 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT),
246 text_input_flags_(0), 247 text_input_flags_(0),
247 can_compose_inline_(true), 248 can_compose_inline_(true),
248 composition_range_(gfx::Range::InvalidRange()), 249 composition_range_(gfx::Range::InvalidRange()),
249 popup_type_(popup_type), 250 popup_type_(popup_type),
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) 497 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects)
497 IPC_MESSAGE_HANDLER(ViewMsg_SetSurfaceClientId, OnSetSurfaceClientId) 498 IPC_MESSAGE_HANDLER(ViewMsg_SetSurfaceClientId, OnSetSurfaceClientId)
498 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, 499 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests,
499 OnWaitNextFrameForTests) 500 OnWaitNextFrameForTests)
500 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, 501 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate,
501 OnRequestCompositionUpdate) 502 OnRequestCompositionUpdate)
502 #if defined(OS_ANDROID) 503 #if defined(OS_ANDROID)
503 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) 504 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck)
504 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, 505 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate,
505 OnRequestTextInputStateUpdate) 506 OnRequestTextInputStateUpdate)
507 IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit,
508 OnImeBatchEdit)
506 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) 509 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded)
507 #endif 510 #endif
508 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) 511 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto)
509 IPC_MESSAGE_UNHANDLED(handled = false) 512 IPC_MESSAGE_UNHANDLED(handled = false)
510 IPC_END_MESSAGE_MAP() 513 IPC_END_MESSAGE_MAP()
511 return handled; 514 return handled;
512 } 515 }
513 516
514 bool RenderWidget::Send(IPC::Message* message) { 517 bool RenderWidget::Send(IPC::Message* message) {
515 // Don't send any messages after the browser has told us to close, and filter 518 // Don't send any messages after the browser has told us to close, and filter
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 params.composition_start = new_info.compositionStart; 958 params.composition_start = new_info.compositionStart;
956 params.composition_end = new_info.compositionEnd; 959 params.composition_end = new_info.compositionEnd;
957 params.can_compose_inline = new_can_compose_inline; 960 params.can_compose_inline = new_can_compose_inline;
958 params.show_ime_if_needed = (show_ime == ShowIme::IF_NEEDED); 961 params.show_ime_if_needed = (show_ime == ShowIme::IF_NEEDED);
959 #if defined(USE_AURA) 962 #if defined(USE_AURA)
960 params.is_non_ime_change = true; 963 params.is_non_ime_change = true;
961 #endif 964 #endif
962 #if defined(OS_ANDROID) 965 #if defined(OS_ANDROID)
963 params.is_non_ime_change = 966 params.is_non_ime_change =
964 (change_source == ChangeSource::FROM_NON_IME) || text_field_is_dirty_; 967 (change_source == ChangeSource::FROM_NON_IME) || text_field_is_dirty_;
968 params.batch_edit = ime_in_batch_edit_;
965 if (params.is_non_ime_change) 969 if (params.is_non_ime_change)
966 OnImeEventSentForAck(new_info); 970 OnImeEventSentForAck(new_info);
967 text_field_is_dirty_ = false; 971 text_field_is_dirty_ = false;
968 #endif 972 #endif
969 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), params)); 973 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), params));
970 974
971 text_input_info_ = new_info; 975 text_input_info_ = new_info;
972 text_input_type_ = new_type; 976 text_input_type_ = new_type;
973 text_input_mode_ = new_mode; 977 text_input_mode_ = new_mode;
974 can_compose_inline_ = new_can_compose_inline; 978 can_compose_inline_ = new_can_compose_inline;
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 void RenderWidget::OnImeEventAck() { 1577 void RenderWidget::OnImeEventAck() {
1574 DCHECK_GE(text_input_info_history_.size(), 1u); 1578 DCHECK_GE(text_input_info_history_.size(), 1u);
1575 text_input_info_history_.pop_front(); 1579 text_input_info_history_.pop_front();
1576 } 1580 }
1577 1581
1578 void RenderWidget::OnRequestTextInputStateUpdate() { 1582 void RenderWidget::OnRequestTextInputStateUpdate() {
1579 DCHECK(!ime_event_guard_); 1583 DCHECK(!ime_event_guard_);
1580 UpdateSelectionBounds(); 1584 UpdateSelectionBounds();
1581 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); 1585 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME);
1582 } 1586 }
1587
1588 void RenderWidget::OnImeBatchEdit(bool begin) {
1589 if (begin) {
1590 ime_in_batch_edit_ = true;
1591 return;
1592 }
1593 if (!ime_in_batch_edit_)
1594 return;
1595 ime_in_batch_edit_ = false;
1596 DCHECK(!ime_event_guard_);
1597 UpdateSelectionBounds();
1598 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME);
1599 }
1583 #endif 1600 #endif
1584 1601
1585 void RenderWidget::OnRequestCompositionUpdate(bool immediate_request, 1602 void RenderWidget::OnRequestCompositionUpdate(bool immediate_request,
1586 bool monitor_request) { 1603 bool monitor_request) {
1587 monitor_composition_info_ = monitor_request; 1604 monitor_composition_info_ = monitor_request;
1588 if (!immediate_request) 1605 if (!immediate_request)
1589 return; 1606 return;
1590 UpdateCompositionInfo(true /* immediate request */); 1607 UpdateCompositionInfo(true /* immediate request */);
1591 } 1608 }
1592 1609
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 void RenderWidget::requestPointerUnlock() { 2099 void RenderWidget::requestPointerUnlock() {
2083 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); 2100 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get());
2084 } 2101 }
2085 2102
2086 bool RenderWidget::isPointerLocked() { 2103 bool RenderWidget::isPointerLocked() {
2087 return mouse_lock_dispatcher_->IsMouseLockedTo( 2104 return mouse_lock_dispatcher_->IsMouseLockedTo(
2088 webwidget_mouse_lock_target_.get()); 2105 webwidget_mouse_lock_target_.get());
2089 } 2106 }
2090 2107
2091 } // namespace content 2108 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698