Upstream version 8.36.169.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / xwalk_browser_main_parts_android.cc
index 6b9ace9..717ac99 100644 (file)
@@ -4,14 +4,14 @@
 
 #include "xwalk/runtime/browser/xwalk_browser_main_parts_android.h"
 
+#include <string>
+
 #include "base/android/path_utils.h"
 #include "base/base_paths_android.h"
 #include "base/files/file_path.h"
 #include "base/file_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/path_service.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/sys_info.h"
 #include "base/threading/sequenced_worker_pool.h"
 #include "cc/base/switches.h"
 #include "content/public/browser/android/compositor.h"
@@ -24,6 +24,8 @@
 #include "net/base/network_change_notifier.h"
 #include "net/base/net_module.h"
 #include "net/base/net_util.h"
+#include "net/cookies/cookie_monster.h"
+#include "net/cookies/cookie_store.h"
 #include "ui/base/layout.h"
 #include "ui/base/l10n/l10n_util_android.h"
 #include "ui/base/resource/resource_bundle.h"
@@ -81,23 +83,27 @@ void XWalkBrowserMainPartsAndroid::PreMainMessageLoopStart() {
   // External extensions will run in the BrowserProcess (in process mode).
   command_line->AppendSwitch(switches::kXWalkDisableExtensionProcess);
 
-  // Enable WebGL for Android.
+  // Only force to enable WebGL for Android for IA platforms because
+  // we've tested the WebGL conformance test. For other platforms, just
+  // follow up the behavior defined by Chromium upstream.
+#if defined(ARCH_CPU_X86)
   command_line->AppendSwitch(switches::kIgnoreGpuBlacklist);
+#endif
 
+#if defined(ENABLE_WEBRTC)
   // Disable HW encoding/decoding acceleration for WebRTC on Android.
   // FIXME: Remove these switches for Android when Android OS is removed from
   // GPU accelerated_video_decode blacklist or we stop ignoring the GPU
   // blacklist.
   command_line->AppendSwitch(switches::kDisableWebRtcHWDecoding);
   command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding);
+#endif
 
-  if (!command_line->HasSwitch(cc::switches::kNumRasterThreads)) {
-    // Enable multiple threads for rasterization to take advantage of multi CPU
-    // cores. Only valid when ImplSidePainting is enabled.
-    const int num_of_cpu_cores = base::SysInfo::NumberOfProcessors();
-    command_line->AppendSwitchASCII(cc::switches::kNumRasterThreads,
-                                    base::IntToString(num_of_cpu_cores));
-  }
+  // For fullscreen video playback, the ContentVideoView is still buggy, so
+  // we switch back to ContentVideoViewLegacy for temp.
+  // TODO(shouqun): Remove this flag when ContentVideoView is ready.
+  command_line->AppendSwitch(
+      switches::kDisableOverlayFullscreenVideoSubtitle);
 
   XWalkBrowserMainParts::PreMainMessageLoopStart();
 
@@ -118,7 +124,6 @@ void XWalkBrowserMainPartsAndroid::PreMainMessageLoopRun() {
 
   xwalk_runner_->PreMainMessageLoopRun();
 
-  runtime_context_ = xwalk_runner_->runtime_context();
   extension_service_ = xwalk_runner_->extension_service();
 
   // Prepare the cookie store.
@@ -133,14 +138,14 @@ void XWalkBrowserMainPartsAndroid::PreMainMessageLoopRun() {
       BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
           BrowserThread::GetBlockingPool()->GetSequenceToken());
 
-  cookie_store_ = content::CreatePersistentCookieStore(
+  content::CookieStoreConfig cookie_config(
       cookie_store_path,
-      true,
-      NULL,
-      NULL,
-      BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
-      background_task_runner);
-
+      content::CookieStoreConfig::RESTORED_SESSION_COOKIES,
+      NULL, NULL);
+  cookie_config.client_task_runner =
+      BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
+  cookie_config.background_task_runner = background_task_runner;
+  cookie_store_ = content::CreateCookieStore(cookie_config);
   cookie_store_->GetCookieMonster()->SetPersistSessionCookies(true);
   SetCookieMonsterOnNetworkStackInit(cookie_store_->GetCookieMonster());
 }