Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Unified Diff: android_webview/lib/main/aw_main_delegate.cc

Issue 14888002: Android WebView Merged-Thread Hardware Draw (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/lib/main/aw_main_delegate.cc
diff --git a/android_webview/lib/main/aw_main_delegate.cc b/android_webview/lib/main/aw_main_delegate.cc
index 32afc03790db6d3eb52dd28b2e6c63eb1d155ae8..fe86e46c3dc6ba9c3db0488da311c2cd4a1a66df 100644
--- a/android_webview/lib/main/aw_main_delegate.cc
+++ b/android_webview/lib/main/aw_main_delegate.cc
@@ -17,6 +17,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/threading/thread_restrictions.h"
#include "content/public/browser/browser_main_runner.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_switches.h"
@@ -26,9 +27,15 @@ namespace android_webview {
namespace {
+// TODO(boliu): Remove these global Allows once the underlying issues
+// are resolved. See AwMainDelegate::RunProcess below.
+
base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> >
g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<scoped_ptr<base::ThreadRestrictions::ScopedAllowIO> >
+ g_allow_io_in_ui_thread = LAZY_INSTANCE_INITIALIZER;
+
bool UIAndRendererCompositorThreadsNotMerged() {
return CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNoMergeUIAndRendererCompositorThreads);
@@ -76,10 +83,16 @@ int AwMainDelegate::RunProcess(
int exit_code = browser_runner_->Initialize(main_function_params);
DCHECK(exit_code < 0);
- // This is temporary until we remove the browser compositor
if (!UIAndRendererCompositorThreadsNotMerged()) {
+ // This is temporary until we remove the browser compositor
g_allow_wait_in_ui_thread.Get().reset(
- new ScopedAllowWaitForLegacyWebViewApi());
+ new ScopedAllowWaitForLegacyWebViewApi);
+
+ // TODO(boliu): This is a HUGE hack to work around the fact that
+ // cc::WorkerPool joins on worker threads on the UI thread.
+ // See crbug.com/239423.
+ g_allow_io_in_ui_thread.Get().reset(
+ new base::ThreadRestrictions::ScopedAllowIO);
}
// Return 0 so that we do NOT trigger the default behavior. On Android, the

Powered by Google App Engine
This is Rietveld 408576698