Defer creation of DisambiguationPopupEfl
authorPawel Forysiuk <p.forysiuk@samsung.com>
Tue, 9 Jun 2015 07:12:53 +0000 (09:12 +0200)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
This object is unnecessarily allocated and initialized together with rwhv as
the likehood of its usage is rather low.

This popup notifies the client that multiple touch targets may have been pressed.
Test: WebKit/Source/web/tests/data/disambiguation_popup.html

To test memory gain, you need to pass:
    --enable-link-disambiguation-popup

This patch defers creation of DisambiguationPopupEfl when it needs to be shown.
This change does not regress performance and saves ~10O KB PSS.

Patch cherry picked from beta/m40_2214_t_memopt

http://suprem.sec.samsung.net/gerrit/#/c/33075/

Original Author: Grzegorz Czajkowski <g.czajkowski@samsung.com>
Reviewed by: Antonio Gomes, Janusz Majnert

Change-Id: I2bcbe247c8cd5123d7ca2d35ced576aa504a9cc2
Signed-off-by: Pawel Forysiuk <p.forysiuk@samsung.com>
tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc

index 1101588..7a31d4e 100755 (executable)
@@ -247,10 +247,6 @@ void RenderWidgetHostViewEfl::InitAsChild(gfx::NativeView parent_view) {
 
   Init_EvasGL(width, height);
 
-#if defined(OS_TIZEN_MOBILE)
-  disambiguation_popup_.reset(new DisambiguationPopupEfl(
-      content_image_elm_host_, this));
-#endif
 }
 
 RenderWidgetHostViewEfl::~RenderWidgetHostViewEfl() {
@@ -1005,8 +1001,10 @@ void RenderWidgetHostViewEfl::SelectClosestWord(const gfx::Point& touch_point) {
 }
 
 void RenderWidgetHostViewEfl::ShowDisambiguationPopup(const gfx::Rect& rect_pixels, const SkBitmap& zoomed_bitmap) {
-  if (disambiguation_popup_)
-    disambiguation_popup_->Show(rect_pixels, zoomed_bitmap);
+  if (!disambiguation_popup_)
+    disambiguation_popup_.reset(new DisambiguationPopupEfl(content_image_, this));
+
+  disambiguation_popup_->Show(rect_pixels, zoomed_bitmap);
 }
 
 bool RenderWidgetHostViewEfl::CanDispatchToConsumer(ui::GestureConsumer* consumer) {