Bringup with updated chromium-efl(m56.0.2924) 68/117868/1 submit/tizen/20170313.110550
authorYoungcheol Kang <ychul.kang@samsung.com>
Thu, 8 Dec 2016 11:27:22 +0000 (20:27 +0900)
committerYoungcheol Kang <ychul.kang@samsung.com>
Wed, 8 Mar 2017 01:41:50 +0000 (10:41 +0900)
This patch supports the working of WebApp and WebTCT with
new updated chromium-efl(m56.0.2924).

- Changed the codes related to including 'ewk_chromium.h' from 'EWebkit.h'
- Changed the codes related to dependency of V8 in chromium-efl

Bug: http://suprem.sec.samsung.net/jira/browse/RWASP-253

Change-Id: Iee178f03e9926b13d972c975b1e53a9fa20be576
Signed-off-by: Youngcheol Kang <ychul.kang@samsung.com>
12 files changed:
extensions/common/xwalk_extension_server.h
extensions/renderer/runtime_ipc_client.h
extensions/renderer/xwalk_extension_renderer_controller.h
extensions/renderer/xwalk_module_system.cc
extensions/renderer/xwalk_module_system.h
extensions/renderer/xwalk_v8tools_module.cc
runtime/browser/native_window.cc
runtime/browser/preload_manager.cc
runtime/browser/runtime_process.cc
runtime/browser/web_view.h
runtime/browser/web_view_impl.h
runtime/renderer/injected_bundle.cc

index 3cd67bf..123d814 100755 (executable)
@@ -5,8 +5,8 @@
 #ifndef XWALK_EXTENSIONS_XWALK_EXTENSION_SERVER_H_
 #define XWALK_EXTENSIONS_XWALK_EXTENSION_SERVER_H_
 
-#include <EWebKit.h>
-#include <EWebKit_internal.h>
+#include <ewk_chromium.h>
+
 #include <json/json.h>
 
 #include <string>
index 7f94fb3..ab0eac9 100755 (executable)
@@ -18,8 +18,8 @@
 #define XWALK_EXTENSIONS_RENDERER_RUNTIME_IPC_CLIENT_H_
 
 #include <v8/v8.h>
-#include <EWebKit.h>
-#include <EWebKit_internal.h>
+#include <ewk_chromium.h>
+
 
 #include <functional>
 #include <map>
index 95e3145..b889af2 100755 (executable)
@@ -6,8 +6,8 @@
 #ifndef XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_RENDERER_CONTROLLER_H_
 #define XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_RENDERER_CONTROLLER_H_
 
-#include <EWebKit.h>
-#include <EWebKit_internal.h>
+#include <ewk_chromium.h>
+
 #include <v8/v8.h>
 
 #include <memory>
index b14f12c..2218188 100644 (file)
@@ -255,7 +255,7 @@ bool XWalkModuleSystem::SetTrampolineAccessorForEntryPoint(
   params->Set(v8::Integer::New(isolate, 1), entry);
 
   // FIXME(cmarcelo): ensure that trampoline is readonly.
-  value.As<v8::Object>()->SetAccessor(
+  value.As<v8::Object>()->SetAccessor(context,
       v8::String::NewFromUtf8(isolate, basename.c_str()),
       TrampolineCallback, TrampolineSetterCallback, params);
   return true;
@@ -294,7 +294,7 @@ bool XWalkModuleSystem::InstallTrampoline(v8::Handle<v8::Context> context,
     return false;
   }
 
-  auto it = entry->entry_points.begin();
+  std::vector<std::string>::const_iterator it = entry->entry_points.begin();
   for (; it != entry->entry_points.end(); ++it) {
     ret = SetTrampolineAccessorForEntryPoint(context, *it, entry_ptr);
     if (!ret) {
@@ -326,7 +326,7 @@ void XWalkModuleSystem::Initialize() {
 
   MarkModulesWithTrampoline();
 
-  auto it = extension_modules_.begin();
+  ExtensionModules::iterator it = extension_modules_.begin();
   for (; it != extension_modules_.end(); ++it) {
     if (it->use_trampoline && InstallTrampoline(context, &*it))
       continue;
@@ -367,6 +367,7 @@ void XWalkModuleSystem::DeleteExtensionModules() {
 void XWalkModuleSystem::LoadExtensionForTrampoline(
     v8::Isolate* isolate,
     v8::Local<v8::Value> data) {
+  v8::HandleScope handle_scope(isolate);
   v8::Local<v8::Array> params = data.As<v8::Array>();
   void* ptr = params->Get(
       v8::Integer::New(isolate, 0)).As<v8::External>()->Value();
@@ -391,7 +392,6 @@ void XWalkModuleSystem::LoadExtensionForTrampoline(
           isolate,
           module_system->require_native_template_);
 
-
   XWalkExtensionModule* module = entry->module;
   module->LoadExtensionCode(module_system->GetV8Context(),
                             require_native_template->GetFunction());
@@ -417,7 +417,7 @@ v8::Handle<v8::Value> XWalkModuleSystem::RefetchHolder(
 
 // static
 void XWalkModuleSystem::TrampolineCallback(
-    v8::Local<v8::String> property,
+    v8::Local<v8::Name> property,
     const v8::PropertyCallbackInfo<v8::Value>& info) {
   XWalkModuleSystem::LoadExtensionForTrampoline(info.GetIsolate(), info.Data());
   v8::Handle<v8::Value> holder = RefetchHolder(info.GetIsolate(), info.Data());
@@ -429,7 +429,7 @@ void XWalkModuleSystem::TrampolineCallback(
 
 // static
 void XWalkModuleSystem::TrampolineSetterCallback(
-    v8::Local<v8::String> property,
+    v8::Local<v8::Name> property,
     v8::Local<v8::Value> value,
     const v8::PropertyCallbackInfo<void>& info) {
   XWalkModuleSystem::LoadExtensionForTrampoline(info.GetIsolate(), info.Data());
index b70603a..e8bf6bf 100644 (file)
@@ -77,10 +77,10 @@ class XWalkModuleSystem {
                          ExtensionModuleEntry* entry);
 
   static void TrampolineCallback(
-      v8::Local<v8::String> property,
+      v8::Local<v8::Name> property,
       const v8::PropertyCallbackInfo<v8::Value>& info);
   static void TrampolineSetterCallback(
-      v8::Local<v8::String> property,
+      v8::Local<v8::Name> property,
       v8::Local<v8::Value> value,
       const v8::PropertyCallbackInfo<void>& info);
   static void LoadExtensionForTrampoline(
index 72e1a4d..4fcad37 100644 (file)
@@ -21,43 +21,48 @@ void ForceSetPropertyCallback(
   info[0].As<v8::Object>()->ForceSet(info[1], info[2]);
 }
 
+// ================
+// lifecycleTracker
+// ================
+struct LifecycleTrackerWrapper {
+  v8::Global<v8::Object> handle;
+  v8::Global<v8::Function> destructor;
+};
+
 void LifecycleTrackerCleanup(
-    const v8::WeakCallbackData<v8::Object,
-                               v8::Persistent<v8::Object> >& data) {
-  v8::Isolate* isolate = data.GetIsolate();
-  v8::HandleScope handle_scope(isolate);
+    const v8::WeakCallbackInfo<LifecycleTrackerWrapper>& data) {
+  LifecycleTrackerWrapper* wrapper = data.GetParameter();
 
-  v8::Local<v8::Object> tracker = data.GetValue();
-  v8::Handle<v8::Value> function =
-      tracker->Get(v8::String::NewFromUtf8(isolate, "destructor"));
+  if (!wrapper->destructor.IsEmpty()) {
+    v8::HandleScope handle_scope(data.GetIsolate());
+    v8::Local<v8::Context> context = v8::Context::New(data.GetIsolate());
+    v8::Context::Scope scope(context);
 
-  if (function.IsEmpty() || !function->IsFunction()) {
-    LOGGER(WARN) << "Destructor function not set for LifecycleTracker.";
-    data.GetParameter()->Reset();
-    delete data.GetParameter();
-    return;
-  }
+    v8::Local<v8::Function> destructor =
+      wrapper->destructor.Get(data.GetIsolate());
 
-  v8::Handle<v8::Context> context = v8::Context::New(isolate);
+    v8::MicrotasksScope microtasks(
+        data.GetIsolate(), v8::MicrotasksScope::kDoNotRunMicrotasks);
 
-  v8::TryCatch try_catch;
-  v8::Handle<v8::Function>::Cast(function)->Call(context->Global(), 0, NULL);
-  if (try_catch.HasCaught())
-    LOGGER(WARN) << "Exception when running LifecycleTracker destructor";
+    v8::TryCatch try_catch(data.GetIsolate());
+    destructor->Call(context->Global(), 0, nullptr);
 
-  data.GetParameter()->Reset();
-  delete data.GetParameter();
+    if (try_catch.HasCaught()) {
+      LOGGER(WARN) << "Exception when running LifecycleTracker destructor";
+    }
+  }
 }
 
 void LifecycleTracker(const v8::FunctionCallbackInfo<v8::Value>& info) {
-  v8::Isolate* isolate = v8::Isolate::GetCurrent();
-  v8::HandleScope handle_scope(isolate);
-
-  v8::Persistent<v8::Object>* tracker =
-      new v8::Persistent<v8::Object>(isolate, v8::Object::New(isolate));
-  tracker->SetWeak(tracker, &LifecycleTrackerCleanup);
-
-  info.GetReturnValue().Set(*tracker);
+  v8::Isolate* isolate = info.GetIsolate();
+       v8::HandleScope handle_scope(info.GetIsolate());
+
+  v8::Local<v8::Object> tracker = v8::Object::New(isolate);
+  LifecycleTrackerWrapper* wrapper = new LifecycleTrackerWrapper;
+  wrapper->handle.Reset(isolate, tracker);
+  wrapper->handle.SetWeak(wrapper, LifecycleTrackerCleanup,
+                          v8::WeakCallbackType::kParameter);
+  info.GetReturnValue().Set(wrapper->handle);
 }
 
 }  // namespace
index 6e723e5..c2648a1 100755 (executable)
@@ -17,8 +17,8 @@
 #include "runtime/browser/native_window.h"
 
 #include <Ecore_Wayland.h>
-#include <EWebKit.h>
-#include <EWebKit_internal.h>
+#include <ewk_chromium.h>
+
 #include <cstdint>
 
 #include "common/arraysize.h"
index 53317ae..4fbaaec 100755 (executable)
@@ -17,8 +17,8 @@
 #include "runtime/browser/preload_manager.h"
 
 #include <Elementary.h>
-#include <EWebKit.h>
-#include <EWebKit_internal.h>
+#include <ewk_chromium.h>
+
 #include <stdio.h>
 
 #include "common/logger.h"
index e51887a..ee87fbb 100755 (executable)
@@ -14,8 +14,8 @@
  *    limitations under the License.
  */
 
-#include <EWebKit.h>
-#include <EWebKit_internal.h>
+#include <ewk_chromium.h>
+
 
 #include <Elementary.h>
 
index 82bbe84..9eaebc0 100644 (file)
@@ -18,8 +18,8 @@
 #define XWALK_RUNTIME_BROWSER_WEB_VIEW_H_
 
 #include <Elementary.h>
-#include <EWebKit.h>
-#include <EWebKit_internal.h>
+#include <ewk_chromium.h>
+
 #include <functional>
 #include <string>
 
index da2f297..56ecabf 100644 (file)
@@ -19,8 +19,8 @@
 
 #include <efl_extension.h>
 #include <Elementary.h>
-#include <EWebKit.h>
-#include <EWebKit_internal.h>
+#include <ewk_chromium.h>
+
 
 #include <map>
 #include <string>
index f0243e2..36fea96 100755 (executable)
@@ -15,8 +15,8 @@
  */
 
 #include <Ecore.h>
-#include <EWebKit.h>
-#include <EWebKit_internal.h>
+#include <ewk_chromium.h>
+
 #include <unistd.h>
 #include <v8.h>
 #include <dlfcn.h>