From b4b821890fb8ed05edc9041fc8a496b6a5e071ad Mon Sep 17 00:00:00 2001 From: Eurogiciel-BOT Date: Wed, 7 May 2014 08:44:51 +0000 Subject: [PATCH] Upstream version 6.35.132.0 Upstream commit-id 2d7493e1cdc071bbcc6df7f1bd641b722e55464c Change-Id: I549ddb27f573fdf1d77efb27c345905ca0fdd8b0 Signed-off-by: Eurogiciel-BOT --- packaging/crosswalk.spec | 2 +- src/xwalk/VERSION | 2 +- .../application/browser/application_protocols.cc | 24 ++++++++++++- .../browser/linux/running_application_object.cc | 40 +++++++++++++++++----- .../browser/linux/running_application_object.h | 9 +++++ .../common/application_manifest_constants.cc | 2 +- src/xwalk/application/common/manifest.cc | 3 -- .../linux/xwalk_extension_process_launcher.cc | 6 ++++ .../tools/linux/xwalk_extension_process_launcher.h | 8 +++++ src/xwalk/packaging/crosswalk.spec | 2 +- .../android/core/src/org/xwalk/core/XWalkView.java | 37 ++++++++++++++------ .../org/xwalk/runtime/XWalkCoreProviderImpl.java | 2 ++ .../browser/xwalk_browser_main_parts_android.cc | 6 ++++ 13 files changed, 116 insertions(+), 27 deletions(-) diff --git a/packaging/crosswalk.spec b/packaging/crosswalk.spec index 292de2f..6cedf75 100644 --- a/packaging/crosswalk.spec +++ b/packaging/crosswalk.spec @@ -2,7 +2,7 @@ %bcond_with wayland Name: crosswalk -Version: 6.35.131.0 +Version: 6.35.132.0 Release: 0 Summary: Crosswalk is an app runtime based on Chromium License: (BSD-3-Clause and LGPL-2.1+) diff --git a/src/xwalk/VERSION b/src/xwalk/VERSION index 7ac2bcc..efaa7da 100644 --- a/src/xwalk/VERSION +++ b/src/xwalk/VERSION @@ -1,4 +1,4 @@ MAJOR=6 MINOR=35 -BUILD=131 +BUILD=132 PATCH=0 diff --git a/src/xwalk/application/browser/application_protocols.cc b/src/xwalk/application/browser/application_protocols.cc index 78a252e..d81fcd2 100644 --- a/src/xwalk/application/browser/application_protocols.cc +++ b/src/xwalk/application/browser/application_protocols.cc @@ -27,6 +27,7 @@ #include "net/url_request/url_request_error_job.h" #include "net/url_request/url_request_file_job.h" #include "net/url_request/url_request_simple_job.h" +#include "xwalk/runtime/browser/xwalk_runner.h" #include "xwalk/application/browser/application_service.h" #include "xwalk/application/common/application_data.h" #include "xwalk/application/common/application_file_util.h" @@ -265,6 +266,22 @@ class ApplicationProtocolHandler DISALLOW_COPY_AND_ASSIGN(ApplicationProtocolHandler); }; +// The |locale| should be expanded to user agent locale. +// Such as, "en-us" will be expaned as "en-us, en". +void GetUserAgentLocales(const std::string& sys_locale, + std::list& ua_locales) { + if (sys_locale.empty()) + return; + + std::string locale = StringToLowerASCII(sys_locale); + size_t position; + do { + ua_locales.push_back(locale); + position = locale.find_last_of("-"); + locale = locale.substr(0, position); + } while (position != std::string::npos); +} + net::URLRequestJob* ApplicationProtocolHandler::MaybeCreateJob( net::URLRequest* request, net::NetworkDelegate* network_delegate) const { @@ -303,7 +320,12 @@ ApplicationProtocolHandler::MaybeCreateJob( } std::list locales; - // FIXME(Xinchao): Get the user agent locales into |locales|. + if (application->GetPackageType() == Manifest::TYPE_WGT) { + GetUserAgentLocales( + xwalk::XWalkRunner::GetInstance()->GetLocale(), locales); + GetUserAgentLocales(application->GetManifest()->default_locale(), locales); + } + return new URLRequestApplicationJob( request, network_delegate, diff --git a/src/xwalk/application/browser/linux/running_application_object.cc b/src/xwalk/application/browser/linux/running_application_object.cc index b53b19dd..19b8cd5 100644 --- a/src/xwalk/application/browser/linux/running_application_object.cc +++ b/src/xwalk/application/browser/linux/running_application_object.cc @@ -7,6 +7,7 @@ #include #include "base/values.h" #include "base/bind.h" +#include "content/public/browser/browser_thread.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/exported_object.h" @@ -133,15 +134,15 @@ void RunningApplicationObject::OnTerminate( void RunningApplicationObject::OnGetExtensionProcessChannel( dbus::MethodCall* method_call, dbus::ExportedObject::ResponseSender response_sender) { - scoped_ptr response = - dbus::Response::FromMethodCall(method_call); - dbus::MessageWriter writer(response.get()); - - writer.AppendString(ep_bp_channel_.name); - dbus::FileDescriptor client_fd(ep_bp_channel_.socket.fd); - client_fd.CheckValidity(); - writer.AppendFileDescriptor(client_fd); - response_sender.Run(response.Pass()); + content::BrowserThread::PostTaskAndReplyWithResult( + content::BrowserThread::FILE, + FROM_HERE, + base::Bind(&RunningApplicationObject::CreateClientFileDescriptor, + base::Unretained(this)), + base::Bind(&RunningApplicationObject::SendChannel, + base::Unretained(this), + method_call, + response_sender)); } #if defined(OS_TIZEN) @@ -193,6 +194,27 @@ void RunningApplicationObject::OnLauncherDisappeared() { TerminateApplication(Application::Immediate); } +scoped_ptr +RunningApplicationObject::CreateClientFileDescriptor() { + scoped_ptr client_fd( + new dbus::FileDescriptor(ep_bp_channel_.socket.fd)); + client_fd->CheckValidity(); + return client_fd.Pass(); +} + +void RunningApplicationObject::SendChannel( + dbus::MethodCall* method_call, + dbus::ExportedObject::ResponseSender response_sender, + scoped_ptr client_fd) { + scoped_ptr response = + dbus::Response::FromMethodCall(method_call); + dbus::MessageWriter writer(response.get()); + + writer.AppendString(ep_bp_channel_.name); + writer.AppendFileDescriptor(*client_fd); + response_sender.Run(response.Pass()); +} + void RunningApplicationObject::ExtensionProcessCreated( const IPC::ChannelHandle& handle) { ep_bp_channel_ = handle; diff --git a/src/xwalk/application/browser/linux/running_application_object.h b/src/xwalk/application/browser/linux/running_application_object.h index 02e0812..3dc2ad1 100644 --- a/src/xwalk/application/browser/linux/running_application_object.h +++ b/src/xwalk/application/browser/linux/running_application_object.h @@ -12,6 +12,10 @@ #include "xwalk/application/browser/application.h" #include "xwalk/dbus/object_manager_adaptor.h" +namespace dbus { +class FileDescriptor; +} + namespace xwalk { namespace application { @@ -58,6 +62,11 @@ class RunningApplicationObject : public dbus::ManagedObject { void OnLauncherDisappeared(); + scoped_ptr CreateClientFileDescriptor(); + void SendChannel(dbus::MethodCall* method_call, + dbus::ExportedObject::ResponseSender response_sender, + scoped_ptr client_fd); + scoped_refptr bus_; std::string launcher_name_; dbus::Bus::GetServiceOwnerCallback owner_change_callback_; diff --git a/src/xwalk/application/common/application_manifest_constants.cc b/src/xwalk/application/common/application_manifest_constants.cc index 40dc276..345e9a1 100644 --- a/src/xwalk/application/common/application_manifest_constants.cc +++ b/src/xwalk/application/common/application_manifest_constants.cc @@ -86,7 +86,7 @@ const char kAllowNavigationKey[] = "widget.allow-navigation.#text"; const char kCSPReportOnlyKey[] = "widget.content-security-policy-report-only.#text"; const char kTizenSettingKey[] = "widget.setting"; -const char kTizenHardwareKey[] = "widget.setting.@hwkey"; +const char kTizenHardwareKey[] = "widget.setting.@hwkey-event"; const char kTizenMetaDataKey[] = "widget.metadata"; // Child keys inside 'kTizenMetaDataKey' const char kTizenMetaDataNameKey[] = "@key"; diff --git a/src/xwalk/application/common/manifest.cc b/src/xwalk/application/common/manifest.cc index ba9647d..8495e35 100644 --- a/src/xwalk/application/common/manifest.cc +++ b/src/xwalk/application/common/manifest.cc @@ -270,9 +270,6 @@ void Manifest::ParseWGTI18nEachPath(const std::string& path) { get_first_one = ParseWGTI18nEachElement(*it, path, kLocaleFirstOne); } } - // After Parse we remove this path from data_ for saving memory. - scoped_ptr remove_value; - data_->Remove(path, &remove_value); } bool Manifest::ParseWGTI18nEachElement(base::Value* value, diff --git a/src/xwalk/application/tools/linux/xwalk_extension_process_launcher.cc b/src/xwalk/application/tools/linux/xwalk_extension_process_launcher.cc index 75ffc9c..30cc2ba 100644 --- a/src/xwalk/application/tools/linux/xwalk_extension_process_launcher.cc +++ b/src/xwalk/application/tools/linux/xwalk_extension_process_launcher.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/at_exit.h" #include "base/message_loop/message_loop.h" #include "xwalk/application/tools/linux/xwalk_extension_process_launcher.h" #include "xwalk/extensions/extension_process/xwalk_extension_process.h" @@ -9,6 +10,7 @@ XWalkExtensionProcessLauncher::XWalkExtensionProcessLauncher() : base::Thread("LauncherExtensionService"), is_started_(false) { + exit_manager_.reset(new base::AtExitManager); base::Thread::Options thread_options; thread_options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; StartWithOptions(thread_options); @@ -18,6 +20,10 @@ XWalkExtensionProcessLauncher::~XWalkExtensionProcessLauncher() { Stop(); } +void XWalkExtensionProcessLauncher::CleanUp() { + extension_process_.reset(); +} + void XWalkExtensionProcessLauncher::Launch( const std::string& channel_id, int channel_fd) { is_started_ = true; diff --git a/src/xwalk/application/tools/linux/xwalk_extension_process_launcher.h b/src/xwalk/application/tools/linux/xwalk_extension_process_launcher.h index 573aa66..776293a 100644 --- a/src/xwalk/application/tools/linux/xwalk_extension_process_launcher.h +++ b/src/xwalk/application/tools/linux/xwalk_extension_process_launcher.h @@ -9,6 +9,10 @@ #include "base/threading/thread.h" +namespace base { +class AtExitManager; +} + namespace xwalk { namespace extensions { class XWalkExtensionProcess; @@ -20,6 +24,9 @@ class XWalkExtensionProcessLauncher: public base::Thread { XWalkExtensionProcessLauncher(); ~XWalkExtensionProcessLauncher(); + // Implement base::Thread. + virtual void CleanUp() OVERRIDE; + // Will be called in launcher's main thread. void Launch(const std::string& channel_id, int channel_fd); @@ -29,6 +36,7 @@ class XWalkExtensionProcessLauncher: public base::Thread { void StartExtensionProcess(const std::string& channel_id, int channel_fd); bool is_started_; + scoped_ptr exit_manager_; scoped_ptr extension_process_; }; diff --git a/src/xwalk/packaging/crosswalk.spec b/src/xwalk/packaging/crosswalk.spec index 292de2f..6cedf75 100644 --- a/src/xwalk/packaging/crosswalk.spec +++ b/src/xwalk/packaging/crosswalk.spec @@ -2,7 +2,7 @@ %bcond_with wayland Name: crosswalk -Version: 6.35.131.0 +Version: 6.35.132.0 Release: 0 Summary: Crosswalk is an app runtime based on Chromium License: (BSD-3-Clause and LGPL-2.1+) diff --git a/src/xwalk/runtime/android/core/src/org/xwalk/core/XWalkView.java b/src/xwalk/runtime/android/core/src/org/xwalk/core/XWalkView.java index 8cd941d..49771f4 100644 --- a/src/xwalk/runtime/android/core/src/org/xwalk/core/XWalkView.java +++ b/src/xwalk/runtime/android/core/src/org/xwalk/core/XWalkView.java @@ -53,6 +53,8 @@ public class XWalkView extends android.widget.FrameLayout { private Activity mActivity; private Context mContext; private XWalkExtensionManager mExtensionManager; + private boolean mIsTimerPaused; + private boolean mIsHidden; /** Normal reload mode as default. */ public static final int RELOAD_NORMAL = 0; @@ -186,6 +188,8 @@ public class XWalkView extends android.widget.FrameLayout { } private void initXWalkContent(Context context, AttributeSet attrs) { + mIsTimerPaused = false; + mIsHidden = false; mContent = new XWalkContent(context, attrs, this); addView(mContent, new FrameLayout.LayoutParams( @@ -369,34 +373,46 @@ public class XWalkView extends android.widget.FrameLayout { } /** - * Pause timers of rendering engine. Typically it should be called - * when the activity for this view is paused. + * Pause all layout, parsing and JavaScript timers for all XWalkView instances. + * Typically it should be called when the activity for this view is paused, + * and accordingly {@link #resumeTimers} should be called when the activity + * is resumed again. + * + * Note that it will globally impact all XWalkView instances, not limited to + * just this XWalkView. */ public void pauseTimers() { - if (mContent == null) return; + if (mContent == null || mIsTimerPaused) return; checkThreadSafety(); mContent.pauseTimers(); + mIsTimerPaused = true; } /** - * Resume timers of rendering engine. Typically it should be called - * when the activyt for this view is resumed. + * Resume all layout, parsing and JavaScript timers for all XWalkView instances. + * Typically it should be called when the activity for this view is resumed. + * + * Note that it will globally impact all XWalkView instances, not limited to + * just this XWalkView. */ public void resumeTimers() { - if (mContent == null) return; + if (mContent == null || !mIsTimerPaused) return; checkThreadSafety(); mContent.resumeTimers(); + mIsTimerPaused = false; } /** - * Aside from timers, this method can pause many other things inside - * rendering engine, like video player, modal dialogs, etc. + * Pause many other things except JavaScript timers inside rendering engine, + * like video player, modal dialogs, etc. See {@link #pauseTimers} about pausing + * JavaScript timers. * Typically it should be called when the activity for this view is paused. */ public void onHide() { - if (mContent == null) return; + if (mContent == null || mIsHidden) return; mExtensionManager.onPause(); mContent.onPause(); + mIsHidden = true; } /** @@ -405,9 +421,10 @@ public class XWalkView extends android.widget.FrameLayout { * Typically it should be called when the activity for this view is resumed. */ public void onShow() { - if (mContent == null) return; + if (mContent == null || !mIsHidden ) return; mExtensionManager.onResume(); mContent.onResume(); + mIsHidden = false; } /** diff --git a/src/xwalk/runtime/android/runtime/src/org/xwalk/runtime/XWalkCoreProviderImpl.java b/src/xwalk/runtime/android/runtime/src/org/xwalk/runtime/XWalkCoreProviderImpl.java index a432f86..d8ad1db 100644 --- a/src/xwalk/runtime/android/runtime/src/org/xwalk/runtime/XWalkCoreProviderImpl.java +++ b/src/xwalk/runtime/android/runtime/src/org/xwalk/runtime/XWalkCoreProviderImpl.java @@ -52,11 +52,13 @@ class XWalkCoreProviderImpl implements XWalkRuntimeViewProvider { @Override public void onResume() { + mXWalkView.resumeTimers(); mXWalkView.onShow(); } @Override public void onPause() { + mXWalkView.pauseTimers(); mXWalkView.onHide(); } diff --git a/src/xwalk/runtime/browser/xwalk_browser_main_parts_android.cc b/src/xwalk/runtime/browser/xwalk_browser_main_parts_android.cc index 7310f5d..10fe45d 100644 --- a/src/xwalk/runtime/browser/xwalk_browser_main_parts_android.cc +++ b/src/xwalk/runtime/browser/xwalk_browser_main_parts_android.cc @@ -102,6 +102,12 @@ void XWalkBrowserMainPartsAndroid::PreMainMessageLoopStart() { command_line->AppendSwitch(switches::kEnableWebAudio); #endif + // 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(); startup_url_ = GURL(); -- 2.7.4