fixup! Implement Delegate renderer using frame buffer object on Tizen.
authorChandan Padhi <c.padhi@samsung.com>
Wed, 17 Jun 2015 13:43:21 +0000 (19:13 +0530)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
Currently, segmentation fault occurs if a new page is loaded on top of an
already loaded page. In this scenario, current RWHVEfl is destroyed and a
new RWHVEfl is created. In delegated rendering, ui::ContextFactoryEfl and
ui::Compositor are created as scoped pointers with ContextFactoryEfl being
created before Compositor. Destruction of scoped pointers takes place in the
same order as their creation. Therefore, ContextFactoryEfl gets deleted before
Compositor even though Compositor holds a reference to ContextFactoryEfl.
Crash occurs when Compositor tries to access ContextFactoryEfl which has been
already deleted.

To solve this problem, we now create ContextFactoryEfl and Compositor as raw
pointers and delete them in RWHVEfl's destructor in the required order.
Reviewed by: DaeHyun Ko, Prashant Nevase, venu musham

Change-Id: I5172342df43fde49f71750b9752588e242380cf2
Signed-off-by: Chandan Padhi <c.padhi@samsung.com>
tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc
tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.h

index 4761679..e943011 100644 (file)
@@ -154,8 +154,10 @@ RenderWidgetHostViewEfl::RenderWidgetHostViewEfl(RenderWidgetHost* widget,
     was_scrolled_(false),
     web_contents_(web_contents),
     single_tap_performed_(false),
+    compositor_(NULL),
     root_layer_(new ui::Layer(ui::LAYER_SOLID_COLOR)),
-    delegated_frame_host_(new DelegatedFrameHost(this)) {
+    delegated_frame_host_(new DelegatedFrameHost(this)),
+    context_factory_(NULL) {
 
   SetDoubleTapSupportEnabled(touch_events_enabled_);
 
@@ -288,6 +290,12 @@ RenderWidgetHostViewEfl::~RenderWidgetHostViewEfl() {
   content_image_elm_host_ = NULL;
   content_image_ = NULL;
   parent_view_ = NULL;
+
+  if (compositor_)
+    delete compositor_;
+
+  if (context_factory_)
+    delete context_factory_;
 }
 
 gfx::Point RenderWidgetHostViewEfl::ConvertPointInViewPix(gfx::Point point) {
@@ -521,7 +529,7 @@ void RenderWidgetHostViewEfl::Init_EvasGL(int width, int height) {
 
   evas_gl_initialized_ = true;
 
-  context_factory_.reset(new ui::ContextFactoryEfl(this, host_->surface_id()));
+  context_factory_ = new ui::ContextFactoryEfl(this, host_->surface_id());
 
   bool gpu_thread_disabled = false;
 
@@ -529,10 +537,10 @@ void RenderWidgetHostViewEfl::Init_EvasGL(int width, int height) {
   gpu_thread_disabled = GpuDataManagerImpl::GetInstance()->GpuThreadDisabled();
 #endif
 
-  compositor_.reset(new ui::Compositor(GetNativeViewId(),
-                                       context_factory_.get(),
+  compositor_ = new ui::Compositor(GetNativeViewId(),
+                                       context_factory_,
                                        base::ThreadTaskRunnerHandle::Get(),
-                                       gpu_thread_disabled));
+                                       gpu_thread_disabled);
 
 #if defined(TIZEN_DISABLE_GPU_THREAD)
   if (gpu_thread_disabled) {
index d448fd7..2530199 100644 (file)
@@ -422,10 +422,10 @@ class RenderWidgetHostViewEfl
   scoped_ptr<bool> restore_showing_large_handle_on_gesture_end_;
 
   IDMap<ScreenshotCapturedCallback, IDMapOwnPointer> screen_capture_cb_map_;
-  scoped_ptr<ui::Compositor> compositor_;
+  ui::Compositor* compositor_;
   scoped_ptr<ui::Layer> root_layer_;
   scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
-  scoped_ptr<ui::ContextFactory> context_factory_;
+  ui::ContextFactory* context_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewEfl);
 };