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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 2429f629b3cf53de06c6565c8eb7470c65ec36e8..30bd3cb7895a6b3a8c17b6347c8b98d05d29d29f 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -216,6 +216,7 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_UNKNOWN),
new_content_rendering_delay_(
base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)),
+ in_ime_batch_edit_(false),
weak_factory_(this) {
CHECK(delegate_);
CHECK_NE(MSG_ROUTING_NONE, routing_id_);
@@ -1265,6 +1266,33 @@ void RenderWidgetHostImpl::HandleCompositorProto(
Send(new ViewMsg_HandleCompositorProto(GetRoutingID(), proto));
}
+void RenderWidgetHostImpl::BeginBatchEdit() {
+ in_ime_batch_edit_ = true;
+}
+
+void RenderWidgetHostImpl::EndBatchEdit() {
+ if (!in_ime_batch_edit_)
+ return;
+ in_ime_batch_edit_ = false;
+ if (batch_edit_messages_.empty())
+ return;
+ Send(new InputMsg_ImeBatchEdit(routing_id_, batch_edit_messages_));
+ batch_edit_messages_.clear();
+}
+
+void RenderWidgetHostImpl::SendOrBatch(IPC::Message* message) {
+ if (in_ime_batch_edit_)
+ batch_edit_messages_.push_back(*message);
+ else
+ Send(message);
+}
+
+void RenderWidgetHostImpl::ExtendSelectionAndDelete(size_t before,
+ size_t after) {
+ SendOrBatch(new InputMsg_ImeExtendSelectionAndDelete(
+ routing_id_, before, after));
+}
+
void RenderWidgetHostImpl::NotifyScreenInfoChanged() {
if (delegate_)
delegate_->ScreenInfoChanged();
@@ -1413,7 +1441,7 @@ void RenderWidgetHostImpl::ImeSetComposition(
const gfx::Range& replacement_range,
int selection_start,
int selection_end) {
- Send(new InputMsg_ImeSetComposition(
+ SendOrBatch(new InputMsg_ImeSetComposition(
GetRoutingID(), text, underlines, replacement_range,
selection_start, selection_end));
}
@@ -1422,12 +1450,12 @@ void RenderWidgetHostImpl::ImeConfirmComposition(
const base::string16& text,
const gfx::Range& replacement_range,
bool keep_selection) {
- Send(new InputMsg_ImeConfirmComposition(
+ SendOrBatch(new InputMsg_ImeConfirmComposition(
GetRoutingID(), text, replacement_range, keep_selection));
}
void RenderWidgetHostImpl::ImeCancelComposition() {
- Send(new InputMsg_ImeSetComposition(GetRoutingID(), base::string16(),
+ SendOrBatch(new InputMsg_ImeSetComposition(GetRoutingID(), base::string16(),
std::vector<blink::WebCompositionUnderline>(),
gfx::Range::InvalidRange(), 0, 0));
}
« 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