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

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

Issue 1278593004: Introduce ThreadedInputConnection behind a switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 IPC_MESSAGE_HANDLER(ViewMsg_ColorProfile, OnColorProfile) 727 IPC_MESSAGE_HANDLER(ViewMsg_ColorProfile, OnColorProfile)
728 IPC_MESSAGE_HANDLER(ViewMsg_ChangeResizeRect, OnChangeResizeRect) 728 IPC_MESSAGE_HANDLER(ViewMsg_ChangeResizeRect, OnChangeResizeRect)
729 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) 729 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden)
730 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) 730 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown)
731 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) 731 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint)
732 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) 732 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection)
733 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) 733 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck)
734 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) 734 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects)
735 IPC_MESSAGE_HANDLER(ViewMsg_SetSurfaceIdNamespace, OnSetSurfaceIdNamespace) 735 IPC_MESSAGE_HANDLER(ViewMsg_SetSurfaceIdNamespace, OnSetSurfaceIdNamespace)
736 #if defined(OS_ANDROID) 736 #if defined(OS_ANDROID)
737 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate,
738 RequestTextInputStateUpdate)
737 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) 739 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded)
738 IPC_MESSAGE_HANDLER(ViewMsg_ImeEventAck, OnImeEventAck) 740 IPC_MESSAGE_HANDLER(ViewMsg_ImeEventAck, OnImeEventAck)
739 #endif 741 #endif
740 IPC_MESSAGE_UNHANDLED(handled = false) 742 IPC_MESSAGE_UNHANDLED(handled = false)
741 IPC_END_MESSAGE_MAP() 743 IPC_END_MESSAGE_MAP()
742 return handled; 744 return handled;
743 } 745 }
744 746
745 bool RenderWidget::Send(IPC::Message* message) { 747 bool RenderWidget::Send(IPC::Message* message) {
746 // Don't send any messages after the browser has told us to close, and filter 748 // Don't send any messages after the browser has told us to close, and filter
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 1767
1766 #if defined(OS_ANDROID) 1768 #if defined(OS_ANDROID)
1767 void RenderWidget::IncrementOutstandingImeEventAcks() { 1769 void RenderWidget::IncrementOutstandingImeEventAcks() {
1768 ++outstanding_ime_acks_; 1770 ++outstanding_ime_acks_;
1769 } 1771 }
1770 1772
1771 void RenderWidget::OnImeEventAck() { 1773 void RenderWidget::OnImeEventAck() {
1772 --outstanding_ime_acks_; 1774 --outstanding_ime_acks_;
1773 DCHECK(outstanding_ime_acks_ >= 0); 1775 DCHECK(outstanding_ime_acks_ >= 0);
1774 } 1776 }
1777
1778 void RenderWidget::RequestTextInputStateUpdate() {
1779 LOG(ERROR) << "cr.Ime RequestTextInputStateUpdate";
1780 ImeEventGuard guard(this);
1781 }
1775 #endif 1782 #endif
1776 1783
1777 bool RenderWidget::ShouldHandleImeEvent() { 1784 bool RenderWidget::ShouldHandleImeEvent() {
1778 #if defined(OS_ANDROID) 1785 #if defined(OS_ANDROID)
1779 return !!webwidget_ && outstanding_ime_acks_ == 0; 1786 return !!webwidget_ && outstanding_ime_acks_ == 0;
1780 #else 1787 #else
1781 return !!webwidget_; 1788 return !!webwidget_;
1782 #endif 1789 #endif
1783 } 1790 }
1784 1791
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 1877
1871 static bool IsDateTimeInput(ui::TextInputType type) { 1878 static bool IsDateTimeInput(ui::TextInputType type) {
1872 return type == ui::TEXT_INPUT_TYPE_DATE || 1879 return type == ui::TEXT_INPUT_TYPE_DATE ||
1873 type == ui::TEXT_INPUT_TYPE_DATE_TIME || 1880 type == ui::TEXT_INPUT_TYPE_DATE_TIME ||
1874 type == ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL || 1881 type == ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL ||
1875 type == ui::TEXT_INPUT_TYPE_MONTH || 1882 type == ui::TEXT_INPUT_TYPE_MONTH ||
1876 type == ui::TEXT_INPUT_TYPE_TIME || 1883 type == ui::TEXT_INPUT_TYPE_TIME ||
1877 type == ui::TEXT_INPUT_TYPE_WEEK; 1884 type == ui::TEXT_INPUT_TYPE_WEEK;
1878 } 1885 }
1879 1886
1880
1881 void RenderWidget::StartHandlingImeEvent() { 1887 void RenderWidget::StartHandlingImeEvent() {
1882 DCHECK(!handling_ime_event_); 1888 DCHECK(!handling_ime_event_);
1883 handling_ime_event_ = true; 1889 handling_ime_event_ = true;
1884 } 1890 }
1885 1891
1886 void RenderWidget::FinishHandlingImeEvent() { 1892 void RenderWidget::FinishHandlingImeEvent() {
1887 DCHECK(handling_ime_event_); 1893 DCHECK(handling_ime_event_);
1888 handling_ime_event_ = false; 1894 handling_ime_event_ = false;
1889 // While handling an ime event, text input state and selection bounds updates 1895 // While handling an ime event, text input state and selection bounds updates
1890 // are ignored. These must explicitly be updated once finished handling the 1896 // are ignored. These must explicitly be updated once finished handling the
1891 // ime event. 1897 // ime event.
1892 UpdateSelectionBounds(); 1898 UpdateSelectionBounds();
1893 #if defined(OS_ANDROID) 1899 #if defined(OS_ANDROID)
1894 UpdateTextInputState(NO_SHOW_IME, FROM_IME); 1900 UpdateTextInputState(NO_SHOW_IME, FROM_IME);
1895 #endif 1901 #endif
1896 } 1902 }
1897 1903
1898 void RenderWidget::UpdateTextInputState(ShowIme show_ime, 1904 void RenderWidget::UpdateTextInputState(ShowIme show_ime,
1899 ChangeSource change_source) { 1905 ChangeSource change_source) {
1900 TRACE_EVENT0("renderer", "RenderWidget::UpdateTextInputState"); 1906 TRACE_EVENT0("renderer", "RenderWidget::UpdateTextInputState");
1901 if (handling_ime_event_) 1907 if (handling_ime_event_)
1902 return; 1908 return;
1909 if (change_source == FROM_IME) {
1910 LOG(ERROR) << "cr.Ime UpdateTextInputState FROM_IME";
1911 }
1903 ui::TextInputType new_type = GetTextInputType(); 1912 ui::TextInputType new_type = GetTextInputType();
1904 if (IsDateTimeInput(new_type)) 1913 if (IsDateTimeInput(new_type))
1905 return; // Not considered as a text input field in WebKit/Chromium. 1914 return; // Not considered as a text input field in WebKit/Chromium.
1906 1915
1907 blink::WebTextInputInfo new_info; 1916 blink::WebTextInputInfo new_info;
1908 if (webwidget_) 1917 if (webwidget_)
1909 new_info = webwidget_->textInputInfo(); 1918 new_info = webwidget_->textInputInfo();
1910 const ui::TextInputMode new_mode = ConvertInputMode(new_info.inputMode); 1919 const ui::TextInputMode new_mode = ConvertInputMode(new_info.inputMode);
1911 1920
1912 bool new_can_compose_inline = CanComposeInline(); 1921 bool new_can_compose_inline = CanComposeInline();
1913 1922
1914 // Only sends text input params if they are changed or if the ime should be 1923 // Only sends text input params if they are changed or if the ime should be
1915 // shown. 1924 // shown.
1916 if (show_ime == SHOW_IME_IF_NEEDED || 1925 if (show_ime == SHOW_IME_IF_NEEDED || change_source == FROM_IME ||
1917 (text_input_type_ != new_type || 1926 (text_input_type_ != new_type || text_input_mode_ != new_mode ||
1918 text_input_mode_ != new_mode ||
1919 text_input_info_ != new_info || 1927 text_input_info_ != new_info ||
1920 can_compose_inline_ != new_can_compose_inline) 1928 can_compose_inline_ != new_can_compose_inline)
1921 #if defined(OS_ANDROID) 1929 #if defined(OS_ANDROID)
1922 || text_field_is_dirty_ 1930 || text_field_is_dirty_
1923 #endif 1931 #endif
1924 ) { 1932 ) {
1925 ViewHostMsg_TextInputState_Params params; 1933 ViewHostMsg_TextInputState_Params params;
1926 params.type = new_type; 1934 params.type = new_type;
1927 params.mode = new_mode; 1935 params.mode = new_mode;
1928 params.flags = new_info.flags; 1936 params.flags = new_info.flags;
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
2419 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2427 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2420 video_hole_frames_.AddObserver(frame); 2428 video_hole_frames_.AddObserver(frame);
2421 } 2429 }
2422 2430
2423 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2431 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2424 video_hole_frames_.RemoveObserver(frame); 2432 video_hole_frames_.RemoveObserver(frame);
2425 } 2433 }
2426 #endif // defined(VIDEO_HOLE) 2434 #endif // defined(VIDEO_HOLE)
2427 2435
2428 } // namespace content 2436 } // 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