}
Try
{
-
- // Needed settings for WKContext are located here
- // create Ewk_Context
- Ewk_Context* newEwkContext =
- ewk_context_new_with_injected_bundle_path(bundlePath);
- if (!newEwkContext) {
- LogError("Failed to create Ewk_Context");
- ThrowMsg(DPL::Exception, "Failed to create ewk context");
+ if(!m_ewkContext)
+ {
+ // Needed settings for WKContext are located here
+ // create Ewk_Context
+ Ewk_Context* newEwkContext =
+ ewk_context_new_with_injected_bundle_path(bundlePath);
+ if (!newEwkContext) {
+ LogError("Failed to create Ewk_Context");
+ ThrowMsg(DPL::Exception, "Failed to create ewk context");
+ }
+
+ m_ewkContext = newEwkContext;
}
- // cache model setting
- ewk_context_cache_model_set(newEwkContext,
+
+ // cache model setting
+ ewk_context_cache_model_set(m_ewkContext,
EWK_CACHE_MODEL_DOCUMENT_BROWSER);
- m_ewkContext = newEwkContext;
ADD_PROFILING_POINT("WebProcess fork", "start");
// To fork a Webprocess as soon as possible,
return true;
}
+ bool Init(Ewk_Context* ewk_context)
+ {
+ if(ewk_context)
+ {
+ m_ewkContext = ewk_context;
+ }
+
+ return Init();
+ }
+
void Terminate()
{
if (m_ewkContext) {
return m_impl->Init();
}
+bool CoreModule::Init(Ewk_Context* ewk_context)
+{
+ return m_impl->Init(ewk_context);
+}
+
void CoreModule::Terminate()
{
return m_impl->Terminate();
const std::string VIEWMODE_TYPE_FULLSCREEN = "fullscreen";
const std::string VIEWMODE_TYPE_MAXIMIZED = "maximized";
char const* const ELM_SWALLOW_CONTENT = "elm.swallow.content";
+const char* const BUNDLE_PATH = "/usr/lib/wrt-wk2-bundles/libwrt-wk2-bundle.so";
+
+static Ewk_Context* s_ewk_context = NULL;
WrtClient::WrtClient(int argc, char **argv) :
Application(argc, argv, "wrt-client", false),
bool WrtClient::checkArgument()
{
- LogInfo("checkArgument");
+ std::string tizenId = getTizenIdFromArgument(m_argc, m_argv);
+
+ if(tizenId.empty()){
+ // Just show help
+ return false;
+ } else {
+ m_tizenId = tizenId;
+ LogDebug("Tizen id: " << m_tizenId);
+ return true;
+ }
+}
- std::string arg = m_argv[0];
+std::string WrtClient::getTizenIdFromArgument(int argc, char **argv)
+{
+ LogInfo("checkArgument");
+ std::string arg = argv[0];
if (arg.empty()) {
- return false;
+ return "";
}
- if (arg.find("wrt-client") != std::string::npos)
- {
- if (m_argc <= 1) {
- return false;
+ if (arg.find("wrt-client") != std::string::npos) {
+ if (argc <= 1) {
+ return "";
}
- arg = m_argv[1];
+ arg = argv[1];
if (arg == "-h" || arg == "--help") {
- // Just show help
- return false;
+ return "";
} else if (arg == "-l" || arg == "--launch" ||
arg == "-t" || arg == "--tizen") {
- if (m_argc != 3) {
- return false;
+ if (argc != 3) {
+ return "";
}
- m_tizenId = std::string(m_argv[2]);
+ return argv[2];
} else {
- return false;
+ return "";
}
} else {
+ // Launch widget based on application basename
size_t pos = arg.find_last_of('/');
if (pos != std::string::npos) {
arg = arg.erase(0, pos + 1);
}
- // Launch widget based on application basename
- m_tizenId = arg;
- LogDebug("Tizen id: " << m_tizenId);
+ return arg;
}
- return true;
+ return "";
}
void WrtClient::setStep()
void WrtClient::initStep()
{
LogDebug("");
- if (WRT::CoreModuleSingleton::Instance().Init()) {
+ if (WRT::CoreModuleSingleton::Instance().Init(s_ewk_context)) {
m_initialized = true;
} else {
m_returnStatus = ReturnStatus::Failed;
{
ADD_PROFILING_POINT("main-entered", "point");
+ // Set log tagging
+ DPL::Log::LogSystemSingleton::Instance().SetTag("WRT");
+
+ // This code is to fork a web process without exec.
+ std::string tizenId = WrtClient::getTizenIdFromArgument(argc, argv);
+
+ if (!tizenId.empty())
+ {
+ LogDebug("Launching by fork mode");
+ ewk_init();
+ ewk_set_arguments(argc, argv);
+ setenv("WRT_LAUNCHING_PERFORMANCE", "1", 1);
+ s_ewk_context = ewk_context_new_with_injected_bundle_path(BUNDLE_PATH);
+ }
+
// Output on stdout will be flushed after every newline character,
// even if it is redirected to a pipe. This is useful for running
// from a script and parsing output.
setenv("CAIRO_GL_LAZY_FLUSHING", "yes", 1);
setenv("ELM_IMAGE_CACHE", "0", 1);
- // Set log tagging
- DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-CLIENT");
-
WrtClient app(argc, argv);
ADD_PROFILING_POINT("Before appExec", "point");