[M47_2526] Chromium upversion to m47_2526 branch
[platform/framework/web/chromium-efl.git] / tizen_src / chromium_impl / efl / init.cc
1 // Copyright (c) 2015 Samsung Electronics. 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 "efl/init.h"
6
7 #include <Elementary.h>
8 #include "ecore_x_wayland_wrapper.h"
9 #include <Ecore.h>
10
11 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h"
13 #include "base/message_loop/message_pump_ecore.h"
14 #include "cc/base/switches.h"
15 #include "content/common/paths_efl.h"
16 #include "content/public/common/content_switches.h"
17 #include "ui/compositor/compositor_switches.h"
18 #include "ui/gfx/screen_efl.h"
19 #include "ui/gfx/switches.h"
20 #include "ui/gl/gl_switches.h"
21 #include "ui/ozone/public/ozone_platform.h"
22
23 namespace efl {
24
25 namespace {
26 scoped_ptr<base::MessagePump> MessagePumpFactory() {
27   return scoped_ptr<base::MessagePump>(new base::MessagePumpEcore);
28 }
29 } // namespace
30
31 int Initialize(int argc, const char* argv[]) {
32   base::CommandLine::Init(argc, argv);
33
34   const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess();
35   std::string process_type =
36           cmd_line.GetSwitchValueASCII(switches::kProcessType);
37
38   if (process_type != "zygote") {
39     elm_init(argc, (char**)argv);
40     elm_config_accel_preference_set("hw");
41
42     ecore_init();
43 #if defined(USE_WAYLAND)
44     ecore_wl_init(NULL);
45 #else
46     ecore_x_init(NULL);
47 #endif
48     eina_init();
49     evas_init();
50   }
51
52   if (!base::MessageLoop::InitMessagePumpForUIFactory(&MessagePumpFactory)) {
53     LOG(ERROR) << "Failed to install EFL message pump!";
54     return 1;
55   }
56
57   ui::InstallScreenInstance();
58
59 #if defined(USE_OZONE)
60   ui::OzonePlatform::InitializeForUI();
61 #endif
62
63   PathsEfl::Register();
64
65   return 0;
66 }
67
68 void AppendPortParams(base::CommandLine& cmdline) {
69   cmdline.AppendSwitchASCII(switches::kUseGL,
70                             gfx::kGLImplementationEGLName);
71   cmdline.AppendSwitch(switches::kInProcessGPU);
72
73 #if !defined(EWK_BRINGUP)
74 // [M44_2403] Temporary disabling the codes for switching to new chromium
75 //            FIXME: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=14040
76 #if defined(OS_TIZEN)
77   cmdline.AppendSwitch(cc::switches::kEnableTileCompression);
78   cmdline.AppendSwitchASCII(cc::switches::kTileCompressionThreshold, "-1");
79   cmdline.AppendSwitchASCII(cc::switches::kTileCompressionMethod, "3");
80
81   // Select ETC1 compression method
82   if (!cmdline.HasSwitch(cc::switches::kDisableTileCompression) &&
83        cmdline.HasSwitch(cc::switches::kEnableTileCompression))
84     cmdline.AppendSwitch(switches::kDisableGpuRasterization);
85 #endif
86 #endif // EWK_BRINGUP
87
88 #if defined(OS_TIZEN_TV)
89   cmdline.AppendSwitchASCII(switches::kAcceleratedCanvas2dMSAASampleCount, "4");
90 #endif
91
92 }
93
94 } // namespace efl