Support fast opening of PD
authorYunchan Cho <yunchan.cho@samsung.com>
Fri, 26 Apr 2013 07:38:30 +0000 (16:38 +0900)
committerYunchan Cho <yunchan.cho@samsung.com>
Sun, 28 Apr 2013 14:38:27 +0000 (23:38 +0900)
[Issue#] N/A
[Problem] If contents of Box is very heavy, PD opening is started lately
[Cause] PD content starts to be rendered after its Box finishes to be rendered and window.open for PD is executed
[Solution] wrt core instance for PD is newly created in case of 'fast-open' attribute of <tizen:pd> is true.
           And web-provider requests PD and Box rendering to webkit at the almost same time.

Change-Id: I4fe503ce555796a620aafa36b3bc6daa2aa5bc1e

13 files changed:
src/Core/Box.cpp
src/Core/View/IPdHelper.h
src/Core/View/PdHelper.cpp
src/Core/View/PdHelper.h
src/Core/View/injection.js
src/Plugin/AppBoxPlugin/AppBoxPdHelper.cpp [new file with mode: 0644]
src/Plugin/AppBoxPlugin/AppBoxPdHelper.h [new file with mode: 0644]
src/Plugin/AppBoxPlugin/AppBoxRenderBuffer.cpp
src/Plugin/AppBoxPlugin/AppBoxRenderView.cpp
src/Plugin/AppBoxPlugin/AppBoxRenderView.h
src/Plugin/AppBoxPlugin/AppPdHelper.cpp [deleted file]
src/Plugin/AppBoxPlugin/AppPdHelper.h [deleted file]
src/Plugin/AppBoxPlugin/CMakeLists.txt

index 4e71f58..5229d6b 100644 (file)
@@ -124,6 +124,7 @@ bool Box::resize(int width, int height)
         RenderInfoPtr renderInfo = makeRenderInfo(renderTypeResize);
         m_view->showBox(renderInfo);
     } catch (...) {
+        LogD("resize exception");
         return false;
     }
 
index 93dced1..06fd430 100644 (file)
 #define I_PD_HELPER_H
 
 #include <Evas.h>
+#include <memory>
 
 class IPdHelper {
     public:
         virtual void startOpen() = 0;
-        virtual void finishOpen(Evas_Object*& child) = 0;
+        virtual void finishOpen(Evas_Object* child) = 0;
         virtual void close() = 0;
-        virtual void setBaseWebView(Evas_Object*& base) = 0;
-        virtual Evas_Object* getBaseWebView() const = 0;
+        virtual void setBoxWebView(Evas_Object* webview) = 0;
+        virtual void setPdWebView(Evas_Object* webview) = 0;
+        virtual Evas_Object* getBoxWebView() const = 0;
         virtual Evas_Object* getPdWebView() const = 0;
         virtual Evas* getPdCanvas() const = 0;
         virtual bool isPdOpened() const = 0;
index a73efe3..d6d15a1 100644 (file)
@@ -27,7 +27,7 @@
 
 PdHelper::PdHelper(Evas_Object* pdWin, std::string pdStartUrl, RenderInfoPtr pdRenderInfo)
     : m_win(pdWin)
-    , m_baseWebView()
+    , m_boxWebView()
     , m_pdWebView()
     , m_startUrl(pdStartUrl)
     , m_renderInfo(pdRenderInfo)
@@ -42,7 +42,7 @@ PdHelper::~PdHelper()
 void PdHelper::startOpen()
 {
     LogD("enter");
-    if (!m_baseWebView) {
+    if (!m_boxWebView) {
         return;
     }
 
@@ -54,10 +54,10 @@ void PdHelper::startOpen()
     // execute javascript for opening new webview for pd
     LogD("executed script: %s", script.c_str());
     ewk_view_script_execute(
-            m_baseWebView, script.c_str(), executeScriptCallback, this);
+            m_boxWebView, script.c_str(), executeScriptCallback, this);
 }
 
-void PdHelper::finishOpen(Evas_Object*& child)
+void PdHelper::finishOpen(Evas_Object* child)
 {
     LogD("enter");
 
@@ -73,16 +73,22 @@ void PdHelper::close()
     evas_object_del(m_pdWebView);
 }
 
-void PdHelper::setBaseWebView(Evas_Object*& parent)
+void PdHelper::setBoxWebView(Evas_Object* webview)
 {
     LogD("enter");
-    m_baseWebView = parent;
+    m_boxWebView = webview;
 }
 
-Evas_Object* PdHelper::getBaseWebView() const
+void PdHelper::setPdWebView(Evas_Object* webview)
 {
     LogD("enter");
-    return m_baseWebView;
+    m_pdWebView = webview;
+}
+
+Evas_Object* PdHelper::getBoxWebView() const
+{
+    LogD("enter");
+    return m_boxWebView;
 }
 
 Evas_Object* PdHelper::getPdWebView() const
index f6c4766..5b63c1a 100644 (file)
@@ -19,6 +19,9 @@
  * @author  Yunchan Cho (yunchan.cho@samsung.com)
  */
 
+#ifndef PD_HELPER_H
+#define PD_HELPER_H
+
 #include <string>
 #include <Evas.h>
 #include "IRenderView.h"
@@ -36,10 +39,11 @@ class EXPORT_CLASS PdHelper: public IPdHelper {
             return IPdHelperPtr(new PdHelper(pdWin, pdStartUrl, pdRenderInfo));
         }
         virtual void startOpen();
-        virtual void finishOpen(Evas_Object*& child);
+        virtual void finishOpen(Evas_Object* child);
         virtual void close();
-        virtual void setBaseWebView(Evas_Object*& parent);
-        virtual Evas_Object* getBaseWebView() const;
+        virtual void setBoxWebView(Evas_Object* webview);
+        virtual void setPdWebView(Evas_Object* webview);
+        virtual Evas_Object* getBoxWebView() const;
         virtual Evas_Object* getPdWebView() const;
         virtual Evas* getPdCanvas() const;
         virtual bool isPdOpened() const;
@@ -56,9 +60,12 @@ class EXPORT_CLASS PdHelper: public IPdHelper {
 
         //members
         Evas_Object* m_win;
-        Evas_Object* m_baseWebView;
+        Evas_Object* m_boxWebView;
         Evas_Object* m_pdWebView;
         std::string m_startUrl;
         RenderInfoPtr m_renderInfo;
         bool m_opened;
 };
+
+#endif // PD_HELPER_H
+
index f2d7b16..1d8cc54 100644 (file)
@@ -2,9 +2,11 @@
 if (typeof window.tizen == 'undefined') {
     console.log("window.tizen object not exists");
     window.tizen = new Object();
+    window.tizen.appwidget = new Object();
 }
 
-window.tizen.appwidget = new Object();
+// For future, only window.appwidget will be used
+window.appwidget = new Object();
 
 // these are functions for overriding standard javascript functions regarding event
 var original_addEventListener = window.addEventListener;
@@ -37,42 +39,11 @@ window.removeEventListener = function(event, callback, capture) {
     }
 };
 
-// Define tizen appwidget APIs
-window.tizen.appwidget.reload = function() {
-    window.location.href = "box://reload";
-}
-
-window.tizen.appwidget.changePeriod = function(period) {
-    switch (arguments.length) {
-    case 0:
-        window.location.href = "box://change-period";
-        break;
-    case 1:
-        window.location.href = "box://change-period?period=" + period;
-        break;
-    default:
-        window.location.href = "box://change-period";
-        break;
-    }
-}
-
-window.tizen.appwidget.launchBrowser = function(url) {
-    window.location.href = "box://launch-browser?url=" + url;
-}
-
-window.tizen.appwidget.scrollStart = function() {
-    window.location.href = "box://scroll-start";
-}
-
-window.tizen.appwidget.scrollStop = function() {
-    window.location.href = "box://scroll-stop";
-}
-
-window.tizen.appwidget.sendMessageToBox = function(message) {
+window.appwidget.sendMessageToBox = function(message) {
     window.location.href = "box://send-message-to-box?message=" + message;
 }
 
-window.tizen.appwidget.sendMessageToPd = function(message) {
+window.appwidget.sendMessageToPd = function(message) {
     window.location.href = "box://send-message-to-pd?message=" + message;
 }
 
@@ -99,3 +70,37 @@ var webprovider = {
 // register custom events for appwidget
 webprovider.registerAppWidgetEvent("pdmessage");
 webprovider.registerAppWidgetEvent("boxmessage");
+
+// Define appwidget APIs
+// window.tizen.appwidget should be changed to window.appwidget
+//
+//
+window.tizen.appwidget.reload = function() {
+    window.location.href = "box://reload";
+}
+
+window.tizen.appwidget.changePeriod = function(period) {
+    switch (arguments.length) {
+    case 0:
+        window.location.href = "box://change-period";
+        break;
+    case 1:
+        window.location.href = "box://change-period?period=" + period;
+        break;
+    default:
+        window.location.href = "box://change-period";
+        break;
+    }
+}
+
+window.tizen.appwidget.launchBrowser = function(url) {
+    window.location.href = "box://launch-browser?url=" + url;
+}
+
+window.tizen.appwidget.scrollStart = function() {
+    window.location.href = "box://scroll-start";
+}
+
+window.tizen.appwidget.scrollStop = function() {
+    window.location.href = "box://scroll-stop";
+}
diff --git a/src/Plugin/AppBoxPlugin/AppBoxPdHelper.cpp b/src/Plugin/AppBoxPlugin/AppBoxPdHelper.cpp
new file mode 100644 (file)
index 0000000..a83b13c
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Flora License, Version 1.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://floralicense.org/license/
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/**
+ * @file    AppBoxPdHelper.cpp
+ * @author  Yunchan Cho (yunchan.cho@samsung.com)
+ */
+#include <string>
+#include <Evas.h>
+#include <ewk_view.h>
+#include <Core/Util/Log.h>
+#include "AppBoxPdHelper.h"
+
+AppBoxPdHelper::AppBoxPdHelper(Evas_Object* pdWin)
+    : m_win(pdWin)
+    , m_boxWebView()
+    , m_pdWebView()
+    , m_opened(false)
+{
+}
+
+AppBoxPdHelper::~AppBoxPdHelper()
+{
+}
+
+void AppBoxPdHelper::startOpen()
+{
+    LogD("enter");
+}
+
+void AppBoxPdHelper::finishOpen(Evas_Object* child)
+{
+    LogD("enter");
+    m_opened = true;
+    setPdWebView(child);
+}
+
+void AppBoxPdHelper::close()
+{
+    LogD("enter");
+}
+
+void AppBoxPdHelper::setBoxWebView(Evas_Object* webview)
+{
+    LogD("enter");
+    m_boxWebView = webview;
+}
+
+void AppBoxPdHelper::setPdWebView(Evas_Object* webview)
+{
+    LogD("enter");
+    m_pdWebView = webview;
+}
+
+Evas_Object* AppBoxPdHelper::getBoxWebView() const
+{
+    LogD("enter");
+    return m_boxWebView;
+}
+
+Evas_Object* AppBoxPdHelper::getPdWebView() const
+{
+    LogD("enter");
+    return m_pdWebView;
+}
+
+Evas* AppBoxPdHelper::getPdCanvas() const  
+{
+    LogD("enter");
+    evas_object_evas_get(m_win);
+}
+
+bool AppBoxPdHelper::isPdOpened() const
+{
+    LogD("enter");
+    return m_opened;
+}
diff --git a/src/Plugin/AppBoxPlugin/AppBoxPdHelper.h b/src/Plugin/AppBoxPlugin/AppBoxPdHelper.h
new file mode 100644 (file)
index 0000000..1ab602a
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Flora License, Version 1.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://floralicense.org/license/
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/**
+ * @file    AppBoxPdHelper.h
+ * @author  Yunchan Cho (yunchan.cho@samsung.com)
+ */
+
+#ifndef APP_BOX_PD_HELPER_H
+#define APP_BOX_PD_HELPER_H
+
+#include <string>
+#include <Evas.h>
+#include <Core/View/IPdHelper.h>
+
+class AppBoxPdHelper: public IPdHelper {
+    public:
+        static IPdHelperPtr create(Evas_Object* pdWin)
+        {
+            return IPdHelperPtr(new AppBoxPdHelper(pdWin));
+        }
+        virtual void startOpen();
+        virtual void finishOpen(Evas_Object* child);
+        virtual void close();
+        virtual void setBoxWebView(Evas_Object* webview);
+        virtual void setPdWebView(Evas_Object* webview);
+        virtual Evas_Object* getBoxWebView() const;
+        virtual Evas_Object* getPdWebView() const;
+        virtual Evas* getPdCanvas() const;
+        virtual bool isPdOpened() const;
+        virtual ~AppBoxPdHelper();
+
+    private:
+        AppBoxPdHelper(Evas_Object* pdWin);
+
+        //members
+        Evas_Object* m_win;
+        Evas_Object* m_boxWebView;
+        Evas_Object* m_pdWebView;
+        bool m_opened;
+};
+
+#endif // APP_BOX_PD_HELPER_H
index 0c2d9c3..484eb30 100644 (file)
@@ -61,7 +61,7 @@ void AppBoxRenderBuffer::didHandleTouchEvent(
 
     m_renderView = AppBoxObserver::Instance()->getRenderView(m_instanceId);
 
-    if (!m_renderView || !(m_renderView->m_view)) {
+    if (!m_renderView || !(m_renderView->m_boxWrt)) {
         LogD("no matched render view");
         return;
     }
@@ -72,7 +72,7 @@ void AppBoxRenderBuffer::didHandleTouchEvent(
     } else {
         if (!m_touchTimer) {
             startCanvasUpdate();
-            m_renderView->m_view->Resume();
+            m_renderView->m_boxWrt->Resume();
         } else {
             deleteTouchTimer();
         }
@@ -96,7 +96,7 @@ Eina_Bool AppBoxRenderBuffer::fireTouchTimerCallback(void* data)
     LogD("enter");
     AppBoxRenderBuffer* This = static_cast<AppBoxRenderBuffer*>(data); 
     This->stopCanvasUpdate();
-    This->m_renderView->m_view->Suspend();
+    This->m_renderView->m_boxWrt->Suspend();
     This->m_touchTimer = NULL;
 
     return ECORE_CALLBACK_CANCEL;
index 17c0370..933ce12 100644 (file)
@@ -24,6 +24,7 @@
 #include <Evas.h>
 #include <Ecore.h>
 #include <ewk_view.h>
+#include <ewk_context.h>
 #include <livebox-service.h>
 #include <i_runnable_widget_object.h>
 #include <core_module.h>
@@ -36,6 +37,7 @@
 #include <Core/Util/Log.h>
 #include "AppBoxObserver.h"
 #include "AppBoxRenderBuffer.h"
+#include "AppBoxPdHelper.h"
 #include "AppBoxRenderView.h"
 
 #define RENDER_MAX_TIME 10.0
@@ -50,14 +52,15 @@ AppBoxRenderView::AppBoxRenderView(
     , m_boxId(boxId)
     , m_instanceId(instanceId)
     , m_boxWin(boxWin)
-    , m_baseWebView()
     , m_snapshot()
     , m_renderInfo()
-    , m_view()
-    , m_startUrl()
+    , m_boxWrt()
+    , m_pdWrt()
     , m_fireRenderTimer()
     , m_pdHelper()
+    , m_pdFastOpen(false)
     , m_ewkContext(ewkContext)
+    , m_renderBuffer()
 {
     LogD("enter");
     m_appId = getAppId(m_boxId);
@@ -67,6 +70,7 @@ AppBoxRenderView::AppBoxRenderView(
 
     evas_object_show(m_boxWin);
     m_renderBuffer = AppBoxObserver::Instance()->getRenderBuffer(m_instanceId);
+    m_pdFastOpen = web_provider_livebox_get_pd_fast_open(m_boxId.c_str()) ? true : false;
     AppBoxObserver::Instance()->registerRenderView(m_instanceId, this);
 }
 
@@ -90,53 +94,49 @@ void AppBoxRenderView::showBox(RenderInfoPtr renderInfo)
     }
 
     // copy to url
-    m_startUrl = getStartUrl(URL_TYPE_BOX, renderInfo->defaultUrlParams);
-
-    if (!createView()) {
-        LogD("can't create view instance");
-        return;
+    std::string boxStartUrl = getStartUrl(URL_TYPE_BOX, renderInfo->defaultUrlParams);
+    if (m_boxWrt) {
+        LogD("existing wrt core is removed");
+        destroyWrtCore(m_boxWrt);
     }
 
+    m_boxWrt = createWrtCore(boxStartUrl, m_boxWin, m_ewkContext); 
+
     // in case of showing box by request of pd open
     if (m_pdHelper) {
-        m_pdHelper->setBaseWebView(m_baseWebView);
+        m_pdHelper->setBoxWebView(m_boxWrt->GetCurrentWebview());
     }
 
     // resize webview fitted to width, height of Box
     evas_object_resize(
-            m_baseWebView
+            m_boxWrt->GetCurrentWebview()
             renderInfo->width,
             renderInfo->height);
 
-    clearSnapShot();
-    m_renderBuffer->startCanvasUpdate();
-    m_view->Show();
+    m_boxWrt->Show();
     m_renderInfo = renderInfo;
 }
 
-bool AppBoxRenderView::createView()
+AppBoxRenderView::WrtCorePtr AppBoxRenderView::createWrtCore(
+        std::string& startUrl, Evas_Object* win, EwkContextPtr ewkContext)
 {
     LogD("enter");
     
-    if (m_view) {
-        m_view->Hide();
-        m_view.reset();
-        m_baseWebView = NULL;
-    }
+    WrtCorePtr wrt;
 #ifdef MULTIPROCESS_SERVICE_SUPPORT
-    m_view = WRT::CoreModuleSingleton::
+    wrt = WRT::CoreModuleSingleton::
                 Instance().getRunnableWidgetObject(m_appId, DPL::Optional<unsigned>());
 #else
-    m_view = WRT::CoreModuleSingleton::
+    wrt = WRT::CoreModuleSingleton::
                 Instance().getRunnableWidgetObject(m_appId);
 #endif
     // prepare webview
-    if (m_startUrl.empty()) {
+    if (startUrl.empty()) {
         LogD("no start url");
-        return false;
+        return WrtCorePtr();
     }
-    m_view->PrepareView(m_startUrl, m_boxWin, m_ewkContext.get());
-    m_view->CheckBeforeLaunch();
+    wrt->PrepareView(startUrl, win, ewkContext.get());
+    wrt->CheckBeforeLaunch();
 
     // set callback functions of RunnableWidgetObject
     WRT::UserDelegatesPtr cbs(new WRT::UserDelegates);
@@ -144,39 +144,55 @@ bool AppBoxRenderView::createView()
     cbs->loadFinish = DPL::MakeDelegate(this, &AppBoxRenderView::finishLoadCallback);
     cbs->bufferSet = DPL::MakeDelegate(this, &AppBoxRenderView::setBufferCallback);
     cbs->bufferUnset = DPL::MakeDelegate(this, &AppBoxRenderView::unsetBufferCallback);
-    cbs->windowCreateBefore = DPL::MakeDelegate(this, &AppBoxRenderView::createWindowBeforeCallback);
-    cbs->windowCreateAfter = DPL::MakeDelegate(this, &AppBoxRenderView::createWindowAfterCallback);
-    cbs->navigationDecide = DPL::MakeDelegate(this, &AppBoxRenderView::decideNavigationCallback);
-    m_view->SetUserDelegates(cbs);
+    if (!m_pdFastOpen) {
+        cbs->windowCreateBefore =
+            DPL::MakeDelegate(this, &AppBoxRenderView::createWindowBeforeCallback);
+        cbs->windowCreateAfter =
+            DPL::MakeDelegate(this, &AppBoxRenderView::createWindowAfterCallback);
+    }
 
-    // set base webview
-    m_baseWebView = m_view->GetCurrentWebview();
+    cbs->navigationDecide =
+        DPL::MakeDelegate(this, &AppBoxRenderView::decideNavigationCallback);
+    wrt->SetUserDelegates(cbs);
 
     // To support transparent background
-    evas_object_color_set(m_baseWebView, 0, 0, 0, 0);
-    evas_object_layer_set(m_baseWebView, EVAS_LAYER_MAX);
-    return true;
+    evas_object_color_set(wrt->GetCurrentWebview(), 0, 0, 0, 0);
+    evas_object_layer_set(wrt->GetCurrentWebview(), EVAS_LAYER_MAX);
+
+    return wrt;
 }
 
-bool AppBoxRenderView::destroyView()
+void AppBoxRenderView::destroyBoxWrtCore()
 {
     LogD("enter");
 
     m_renderBuffer->stopCanvasUpdate();
     deleteRenderTimer();
-    if (m_view) {
-        m_view->Hide();
-        m_view.reset();
-        m_baseWebView = NULL;
-    }
+    destroyWrtCore(m_boxWrt);
+    m_boxWrt.reset();
+}
 
-    return true;
+void AppBoxRenderView::destroyPdWrtCore()
+{
+    LogD("enter");
+
+    destroyWrtCore(m_pdWrt);
+    m_pdWrt.reset();
+}
+
+void AppBoxRenderView::destroyWrtCore(WrtCorePtr wrt)
+{
+    LogD("enter");
+
+    if (wrt) {
+        wrt->Hide();
+    }
 }
 
 void AppBoxRenderView::hideBox()
 {
     LogD("enter");
-    destroyView();
+    destroyBoxWrtCore();
 }
 
 void AppBoxRenderView::pauseBox()
@@ -195,7 +211,27 @@ void AppBoxRenderView::showPd(Evas_Object* pdWin, RenderInfoPtr renderInfo)
 
     // create pd helper
     std::string pdStartUrl = getStartUrl(URL_TYPE_PD, renderInfo->defaultUrlParams);
-    m_pdHelper = PdHelper::create(pdWin, pdStartUrl, renderInfo);
+    if (m_pdFastOpen) {
+        destroyPdWrtCore();
+        // if needed, last param regarding ewk context can be set to new one.
+        m_pdWrt = createWrtCore(pdStartUrl, pdWin, m_ewkContext);
+        if (!m_pdWrt) {
+            LogD("no wrt core instance");
+            return;
+        }
+        m_pdHelper = AppBoxPdHelper::create(pdWin);
+
+        // resize webview fitted to width, height of pd
+        evas_object_resize(
+                m_pdWrt->GetCurrentWebview(), 
+                renderInfo->width,
+                renderInfo->height);
+        // show pd
+        m_pdWrt->Show();
+        m_pdHelper->finishOpen(m_pdWrt->GetCurrentWebview());
+    } else {
+        m_pdHelper = PdHelper::create(pdWin, pdStartUrl, renderInfo);
+    }
 
     // show pd window
     evas_object_show(pdWin);
@@ -206,6 +242,9 @@ void AppBoxRenderView::hidePd()
 {
     LogD("enter");
 
+    if (m_pdFastOpen) {
+        destroyPdWrtCore();
+    }
     m_pdHelper->close();
     m_pdHelper.reset();
 
@@ -215,7 +254,7 @@ void AppBoxRenderView::hidePd()
 
 Evas_Object* AppBoxRenderView::getBoxWebView()
 {
-    return m_baseWebView;
+    return m_boxWrt->GetCurrentWebview();
 }
 
 Evas_Object* AppBoxRenderView::getPdWebView()
@@ -314,13 +353,13 @@ Eina_Bool AppBoxRenderView::fireRenderTimerCallback(void* data)
     if (web_provider_livebox_get_mouse_event(This->m_boxId.c_str())) {
         // stop touch timer
         This->m_renderBuffer->deleteTouchTimer();
-        This->m_view->Suspend();
+        This->m_boxWrt->Suspend();
     } else {
         // Before webview should be removed,
         // new evas object with last render data should be created
         // otherwise, after webview is removed, box is white screen.
         evas_object_show(This->getCurrentSnapShot());
-        This->destroyView();
+        This->destroyBoxWrtCore();
     }
 
     return ECORE_CALLBACK_CANCEL;
@@ -347,6 +386,7 @@ void AppBoxRenderView::executeScriptCallback(
 void AppBoxRenderView::startLoadCallback(Evas_Object* webview)
 {
     LogD("enter");
+    m_renderBuffer->startCanvasUpdate();
     // execute injection for creating js objects
     std::ifstream jsFile(injectionFile);
     std::string script((std::istreambuf_iterator<char>(jsFile)),
@@ -365,11 +405,13 @@ void AppBoxRenderView::finishLoadCallback(Evas_Object* webview)
         // start render timer
         addRenderTimer();
     } else {
-        if (!(m_pdHelper->isPdOpened()) && 
-                webview == m_pdHelper->getBaseWebView())
-        {
-            // open pd
-            ecore_idler_add(openPdIdlerCallback, this);
+        if (!m_pdFastOpen) {
+            if (!(m_pdHelper->isPdOpened()) && 
+                    webview == m_pdHelper->getBoxWebView())
+            {
+                // open pd
+                ecore_idler_add(openPdIdlerCallback, this);
+            }
         }
     }
 }
@@ -380,13 +422,13 @@ void AppBoxRenderView::createWindowBeforeCallback(Evas** canvas, Evas_Object* pa
 
     if (m_pdHelper) {
         if (!(m_pdHelper->isPdOpened()) && 
-                parent == m_pdHelper->getBaseWebView())
+                parent == m_pdHelper->getBoxWebView())
         {
             LogD("pd canvas is used");
             *canvas = m_pdHelper->getPdCanvas();
             return;
         }
-    } 
+    }
     
     LogD("canvas of this webview is used");
     *canvas = evas_object_evas_get(parent);
index ad6aa05..38ec629 100644 (file)
@@ -35,6 +35,7 @@ class AppBoxRenderBuffer;
 class AppBoxRenderView: public IRenderView {
     public:
         typedef std::shared_ptr<Ewk_Context> EwkContextPtr;
+
         static IRenderViewPtr create(
                 std::string boxId, std::string instanceId, 
                 Evas_Object* boxWin, EwkContextPtr ewkContext)
@@ -55,14 +56,17 @@ class AppBoxRenderView: public IRenderView {
 
     private:
         // type definition
+        typedef std::shared_ptr<WRT::IRunnableWidgetObject> WrtCorePtr;
         enum UrlType {
             URL_TYPE_BOX,
             URL_TYPE_PD
         };
-        typedef std::shared_ptr<WRT::IRunnableWidgetObject> ViewPtr;
-        
-        bool createView();
-        bool destroyView();
+
+        WrtCorePtr createWrtCore(
+                std::string& startUrl, Evas_Object* win, EwkContextPtr ewkContext);
+        void destroyWrtCore(WrtCorePtr wrt);
+        void destroyBoxWrtCore();
+        void destroyPdWrtCore();
         std::string getAppId(std::string& boxId);
         std::string getStartUrl(UrlType type, std::string& defaultParams);
         Evas_Object* getCurrentSnapShot();
@@ -97,13 +101,13 @@ class AppBoxRenderView: public IRenderView {
         std::string m_boxId;
         std::string m_instanceId;
         Evas_Object* m_boxWin;
-        Evas_Object* m_baseWebView;
         Evas_Object* m_snapshot;
         RenderInfoPtr m_renderInfo;
-        ViewPtr m_view;
-        std::string m_startUrl;
+        WrtCorePtr m_boxWrt;
+        WrtCorePtr m_pdWrt;
         Ecore_Timer* m_fireRenderTimer;
         IPdHelperPtr m_pdHelper;
+        bool m_pdFastOpen;
         EwkContextPtr m_ewkContext;
         AppBoxRenderBuffer* m_renderBuffer;
 
diff --git a/src/Plugin/AppBoxPlugin/AppPdHelper.cpp b/src/Plugin/AppBoxPlugin/AppPdHelper.cpp
deleted file mode 100644 (file)
index c0f508d..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Flora License, Version 1.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://floralicense.org/license/
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-/**
- * @file    AppPdHelper.cpp
- * @author  Yunchan Cho (yunchan.cho@samsung.com)
- */
diff --git a/src/Plugin/AppBoxPlugin/AppPdHelper.h b/src/Plugin/AppBoxPlugin/AppPdHelper.h
deleted file mode 100644 (file)
index d02cdd9..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Flora License, Version 1.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://floralicense.org/license/
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-/**
- * @file    AppPdHelper.h
- * @author  Yunchan Cho (yunchan.cho@samsung.com)
- */
index 685e858..dbfc153 100644 (file)
@@ -38,7 +38,7 @@ SET(SRCS
     ${CMAKE_CURRENT_SOURCE_DIR}/AppBoxPluginFactory.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/AppBoxRenderView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/AppBoxRenderBuffer.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/AppPdHelper.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/AppBoxPdHelper.cpp
 )
 
 SET(HEADERS