Bug 1185316 TabParent should flush pending IME notifications after child process handles all sending events r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 22 Jul 2015 14:51:36 +0900
changeset 285729 0a0292a63ef041a3655638cc5e0204946c523813
parent 285728 d75fd3b93ae8be1e704f3d24cc4100f8d93973da
child 285730 98c2f8a27530580aabbb55b7889242bff3923110
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1185316
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1185316 TabParent should flush pending IME notifications after child process handles all sending events r=smaug
dom/ipc/PBrowser.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
widget/ContentCache.cpp
widget/ContentCache.h
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -255,23 +255,23 @@ parent:
      *    widget should return empty string for composition
      *  if cancel is false,
      *    widget should return the current composition text
      */
     prio(urgent) sync EndIMEComposition(bool cancel)
                         returns (bool noCompositionEvent, nsString composition);
 
     /**
-     * OnEventNeedingAckReceived() is called when a child process dispatches a
+     * OnEventNeedingAckHandled() is called after a child process dispatches a
      * composition event or a selection event which is sent from the parent
      * process.
      *
-     * message      The message value of the received event.
+     * message      The message value of the handled event.
      */
-    prio(urgent) async OnEventNeedingAckReceived(uint32_t message);
+    prio(urgent) async OnEventNeedingAckHandled(uint32_t message);
 
     /**
      * Tells chrome to start plugin IME.  If this results in a string getting
      * committed, the result is in aCommitted (otherwise aCommitted is empty).
      *
      * aKeyboardEvent     The event with which plugin IME is to be started
      * panelX and panelY  Location in screen coordinates of the IME input panel
      *                    (should be just under the plugin)
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -2225,30 +2225,30 @@ TabChild::RecvKeyEvent(const nsString& a
   nsContentUtils::SendKeyEvent(mPuppetWidget, aType, aKeyCode, aCharCode,
                                aModifiers, aPreventDefault, &ignored);
   return true;
 }
 
 bool
 TabChild::RecvCompositionEvent(const WidgetCompositionEvent& event)
 {
-  unused << SendOnEventNeedingAckReceived(event.message);
   WidgetCompositionEvent localEvent(event);
   localEvent.widget = mPuppetWidget;
   APZCCallbackHelper::DispatchWidgetEvent(localEvent);
+  unused << SendOnEventNeedingAckHandled(event.message);
   return true;
 }
 
 bool
 TabChild::RecvSelectionEvent(const WidgetSelectionEvent& event)
 {
-  unused << SendOnEventNeedingAckReceived(event.message);
   WidgetSelectionEvent localEvent(event);
   localEvent.widget = mPuppetWidget;
   APZCCallbackHelper::DispatchWidgetEvent(localEvent);
+  unused << SendOnEventNeedingAckHandled(event.message);
   return true;
 }
 
 a11y::PDocAccessibleChild*
 TabChild::AllocPDocAccessibleChild(PDocAccessibleChild*, const uint64_t&)
 {
   MOZ_ASSERT(false, "should never call this!");
   return nullptr;
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -2094,29 +2094,29 @@ TabParent::RecvNotifyIMEPositionChange(c
     widget->GetIMEUpdatePreference();
   if (updatePreference.WantPositionChanged()) {
     mContentCache.MaybeNotifyIME(widget, aIMENotification);
   }
   return true;
 }
 
 bool
-TabParent::RecvOnEventNeedingAckReceived(const uint32_t& aMessage)
+TabParent::RecvOnEventNeedingAckHandled(const uint32_t& aMessage)
 {
   // This is called when the child process receives WidgetCompositionEvent or
   // WidgetSelectionEvent.
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget) {
     return true;
   }
 
-  // While calling OnEventNeedingAckReceived(), TabParent *might* be destroyed
+  // While calling OnEventNeedingAckHandled(), TabParent *might* be destroyed
   // since it may send notifications to IME.
   nsRefPtr<TabParent> kungFuDeathGrip(this);
-  mContentCache.OnEventNeedingAckReceived(widget, aMessage);
+  mContentCache.OnEventNeedingAckHandled(widget, aMessage);
   return true;
 }
 
 bool
 TabParent::RecvRequestFocus(const bool& aCanRaise)
 {
   nsCOMPtr<nsIFocusManager> fm = nsFocusManager::GetFocusManager();
   if (!fm) {
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -172,17 +172,17 @@ public:
                                                 const widget::IMENotification& aEventMessage) override;
     virtual bool RecvNotifyIMESelection(const ContentCache& aContentCache,
                                         const widget::IMENotification& aEventMessage) override;
     virtual bool RecvUpdateContentCache(const ContentCache& aContentCache) override;
     virtual bool RecvNotifyIMEMouseButtonEvent(const widget::IMENotification& aEventMessage,
                                                bool* aConsumedByIME) override;
     virtual bool RecvNotifyIMEPositionChange(const ContentCache& aContentCache,
                                              const widget::IMENotification& aEventMessage) override;
-    virtual bool RecvOnEventNeedingAckReceived(const uint32_t& aMessage) override;
+    virtual bool RecvOnEventNeedingAckHandled(const uint32_t& aMessage) override;
     virtual bool RecvEndIMEComposition(const bool& aCancel,
                                        bool* aNoCompositionEvent,
                                        nsString* aComposition) override;
     virtual bool RecvStartPluginIME(const WidgetKeyboardEvent& aKeyboardEvent,
                                     const int32_t& aPanelX,
                                     const int32_t& aPanelY,
                                     nsString* aCommitted) override;
     virtual bool RecvSetPluginFocused(const bool& aFocused) override;
--- a/widget/ContentCache.cpp
+++ b/widget/ContentCache.cpp
@@ -909,24 +909,24 @@ ContentCacheInParent::OnSelectionEvent(
      GetBoolName(aSelectionEvent.mExpandToClusterBoundary),
      GetBoolName(aSelectionEvent.mUseNativeLineBreak), mPendingEventsNeedingAck,
      GetBoolName(mIsComposing)));
 
   mPendingEventsNeedingAck++;
 }
 
 void
-ContentCacheInParent::OnEventNeedingAckReceived(nsIWidget* aWidget,
+ContentCacheInParent::OnEventNeedingAckHandled(nsIWidget* aWidget,
                                                 uint32_t aMessage)
 {
   // This is called when the child process receives WidgetCompositionEvent or
   // WidgetSelectionEvent.
 
   MOZ_LOG(sContentCacheLog, LogLevel::Info,
-    ("ContentCacheInParent: 0x%p OnEventNeedingAckReceived(aWidget=0x%p, "
+    ("ContentCacheInParent: 0x%p OnEventNeedingAckHandled(aWidget=0x%p, "
      "aMessage=%s), mPendingEventsNeedingAck=%u",
      this, aWidget, GetEventMessageName(aMessage), mPendingEventsNeedingAck));
 
   MOZ_RELEASE_ASSERT(mPendingEventsNeedingAck > 0);
   if (--mPendingEventsNeedingAck) {
     return;
   }
 
--- a/widget/ContentCache.h
+++ b/widget/ContentCache.h
@@ -310,24 +310,24 @@ public:
   bool OnCompositionEvent(const WidgetCompositionEvent& aCompositionEvent);
 
   /**
    * OnSelectionEvent() should be called before sending selection event.
    */
   void OnSelectionEvent(const WidgetSelectionEvent& aSelectionEvent);
 
   /**
-   * OnEventNeedingAckReceived() should be called when the child process
-   * receives a sent event which needs acknowledging.
+   * OnEventNeedingAckHandled() should be called after the child process
+   * handles a sent event which needs acknowledging.
    *
    * WARNING: This may send notifications to IME.  That might cause destroying
    *          TabParent or aWidget.  Therefore, the caller must not destroy
    *          this instance during a call of this method.
    */
-  void OnEventNeedingAckReceived(nsIWidget* aWidget, uint32_t aMessage);
+  void OnEventNeedingAckHandled(nsIWidget* aWidget, uint32_t aMessage);
 
   /**
    * RequestToCommitComposition() requests to commit or cancel composition to
    * the widget.  If it's handled synchronously, this returns the number of
    * composition events after that.
    *
    * @param aWidget     The widget to be requested to commit or cancel
    *                    the composition.