Upstream version 11.39.264.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / xwalk_runner_tizen.cc
1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "xwalk/runtime/browser/xwalk_runner_tizen.h"
6
7 #include "base/command_line.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "crypto/nss_util.h"
10 #include "xwalk/application/browser/application_service.h"
11 #include "xwalk/application/browser/application_system.h"
12 #include "xwalk/application/common/id_util.h"
13 #include "xwalk/runtime/browser/sysapps_component.h"
14 #include "xwalk/runtime/browser/xwalk_component.h"
15 #include "xwalk/runtime/common/xwalk_runtime_features.h"
16 #include "xwalk/runtime/common/xwalk_switches.h"
17
18 namespace xwalk {
19
20 XWalkRunnerTizen::XWalkRunnerTizen() {
21   CommandLine* cmd_line = CommandLine::ForCurrentProcess();
22   shared_process_mode_enabled_ =
23       !(cmd_line->HasSwitch(switches::kXWalkDisableSharedProcessMode));
24 }
25
26 XWalkRunnerTizen::~XWalkRunnerTizen() {}
27
28 // static
29 XWalkRunnerTizen* XWalkRunnerTizen::GetInstance() {
30   return static_cast<XWalkRunnerTizen*>(XWalkRunner::GetInstance());
31 }
32
33 void XWalkRunnerTizen::PreMainMessageLoopRun() {
34   XWalkRunner::PreMainMessageLoopRun();
35
36   // NSSInitSingleton is a costly operation (up to 100ms on VTC-1010),
37   // resulting in postponing the parsing and composition steps of the render
38   // process at cold start. Therefore, move the initialization logic here.
39   if (shared_process_mode_enabled()) {
40     content::BrowserThread::PostTask(
41         content::BrowserThread::IO,
42         FROM_HERE,
43         base::Bind(&crypto::EnsureNSSInit));
44   }
45 }
46
47 }  // namespace xwalk