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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2049363003: Adds support for headless chrome embedder mojo services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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 | « content/renderer/mojo_context_state.cc ('k') | headless/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 9c3d27cd842d5c8bf4f34ed516c1da89439a629a..3e91183d18ee88a13e981c61a06194165682f1b1 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -5919,11 +5919,18 @@ void RenderFrameImpl::SendUpdateState() {
void RenderFrameImpl::MaybeEnableMojoBindings() {
int enabled_bindings = RenderProcess::current()->GetEnabledBindings();
- // BINDINGS_POLICY_WEB_UI and BINDINGS_POLICY_MOJO are mutually exclusive.
- // They both provide access to Mojo bindings, but do so in incompatible ways.
- const int kMojoAndWebUiBindings =
- BINDINGS_POLICY_WEB_UI | BINDINGS_POLICY_MOJO;
- DCHECK_NE(enabled_bindings & kMojoAndWebUiBindings, kMojoAndWebUiBindings);
+ // BINDINGS_POLICY_WEB_UI, BINDINGS_POLICY_MOJO and BINDINGS_POLICY_HEADLESS
+ // are mutually exclusive. They provide access to Mojo bindings, but do so in
+ // incompatible ways.
+ const int kAllBindingsTypes =
+ BINDINGS_POLICY_WEB_UI | BINDINGS_POLICY_MOJO | BINDINGS_POLICY_HEADLESS;
+
+ // Make sure that at most one of BINDINGS_POLICY_WEB_UI, BINDINGS_POLICY_MOJO
+ // and BINDINGS_POLICY_HEADLESS have been set.
+ // NOTE x & (x - 1) == 0 is true iff x is zero or a power of two.
+ DCHECK_EQ((enabled_bindings & kAllBindingsTypes) &
+ ((enabled_bindings & kAllBindingsTypes) - 1),
+ 0);
// If an MojoBindingsController already exists for this RenderFrameImpl, avoid
// creating another one. It is not kept as a member, as it deletes itself when
@@ -5933,9 +5940,11 @@ void RenderFrameImpl::MaybeEnableMojoBindings() {
if (IsMainFrame() &&
enabled_bindings & BINDINGS_POLICY_WEB_UI) {
- new MojoBindingsController(this, false /* for_layout_tests */);
+ new MojoBindingsController(this, MojoBindingsType::FOR_WEB_UI);
} else if (enabled_bindings & BINDINGS_POLICY_MOJO) {
- new MojoBindingsController(this, true /* for_layout_tests */);
+ new MojoBindingsController(this, MojoBindingsType::FOR_LAYOUT_TESTS);
+ } else if (enabled_bindings & BINDINGS_POLICY_HEADLESS) {
+ new MojoBindingsController(this, MojoBindingsType::FOR_HEADLESS);
}
}
« no previous file with comments | « content/renderer/mojo_context_state.cc ('k') | headless/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698