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

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

Issue 13907007: Replace merge-ui-and-compositor-threads flag with no-merge-ui-and-compositor-threads flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync 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
« no previous file with comments | « android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 aba8ae3976913cb5ac05c2214d0f1334caa7e3dc..32afc03790db6d3eb52dd28b2e6c63eb1d155ae8 100644
--- a/android_webview/lib/main/aw_main_delegate.cc
+++ b/android_webview/lib/main/aw_main_delegate.cc
@@ -6,6 +6,7 @@
#include "android_webview/browser/aw_content_browser_client.h"
#include "android_webview/browser/in_process_renderer/in_process_renderer_client.h"
+#include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h"
#include "android_webview/common/aw_switches.h"
#include "android_webview/lib/aw_browser_dependency_factory_impl.h"
#include "android_webview/native/aw_geolocation_permission_context.h"
@@ -13,6 +14,7 @@
#include "android_webview/native/aw_web_contents_view_delegate.h"
#include "android_webview/renderer/aw_content_renderer_client.h"
#include "base/command_line.h"
+#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/browser_main_runner.h"
@@ -22,6 +24,17 @@
namespace android_webview {
+namespace {
+
+base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> >
+ g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER;
+
+bool UIAndRendererCompositorThreadsNotMerged() {
+ return CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kNoMergeUIAndRendererCompositorThreads);
+}
+}
+
AwMainDelegate::AwMainDelegate() {
}
@@ -35,13 +48,12 @@ bool AwMainDelegate::BasicStartupComplete(int* exit_code) {
::EnableVirtualizedContext();
CommandLine* cl = CommandLine::ForCurrentProcess();
- // Set the command line to enable synchronous API compatibility.
- if (cl->HasSwitch(switches::kMergeUIAndRendererCompositorThreads)) {
- cl->AppendSwitch(switches::kEnableSynchronousRendererCompositor);
- } else {
+ if (UIAndRendererCompositorThreadsNotMerged()) {
cl->AppendSwitch(switches::kEnableWebViewSynchronousAPIs);
+ } else {
+ // Set the command line to enable synchronous API compatibility.
+ cl->AppendSwitch(switches::kEnableSynchronousRendererCompositor);
}
-
return false;
}
@@ -64,6 +76,12 @@ 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()) {
+ g_allow_wait_in_ui_thread.Get().reset(
+ new ScopedAllowWaitForLegacyWebViewApi());
+ }
+
// Return 0 so that we do NOT trigger the default behavior. On Android, the
// UI message loop is managed by the Java application.
return 0;
@@ -90,12 +108,10 @@ content::ContentRendererClient*
DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess));
// During transition period allow running in either threading mode; eventually
// only the compositor/UI thread merge mode will be supported.
- const bool merge_threads =
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kMergeUIAndRendererCompositorThreads);
+ const bool no_merge_threads = UIAndRendererCompositorThreadsNotMerged();
content_renderer_client_.reset(
- merge_threads ? new InProcessRendererClient() :
- new AwContentRendererClient());
+ no_merge_threads ? new AwContentRendererClient() :
+ new InProcessRendererClient());
return content_renderer_client_.get();
}
« no previous file with comments | « android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698