Bringup with updated chromium-efl(m56.0.2924) 60/122660/3 accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable accepted/tizen/common/20170403.190354 accepted/tizen/ivi/20170403.130903 accepted/tizen/mobile/20170403.130507 accepted/tizen/tv/20170403.130617 accepted/tizen/unified/20170403.090425 accepted/tizen/wearable/20170403.130729 submit/tizen/20170403.063537
authorjaekuk, lee <juku1999@samsung.com>
Mon, 3 Apr 2017 06:22:40 +0000 (15:22 +0900)
committerjaekuk lee <juku1999@samsung.com>
Mon, 3 Apr 2017 06:27:14 +0000 (23:27 -0700)
--------------------------------------------------------------------------------
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>
-------------------------------------------------------------------------------

Change-Id: I2f4ccb603b5b6e3fabebcef6eeae9f06106163bd
Signed-off-by: jaekuk, lee <juku1999@samsung.com>
extensions/renderer/xwalk_module_system.cc
extensions/renderer/xwalk_module_system.h
extensions/renderer/xwalk_v8tools_module.cc

index b14f12c..2218188 100755 (executable)
@@ -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 100755 (executable)
@@ -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 100755 (executable)
@@ -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