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

Unified Diff: content/browser/android/synchronous_compositor_host.cc

Issue 2490383002: Revert of Resolves layering violation in SynchronousCompositorHost creation (Closed)
Patch Set: Created 4 years, 1 month 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: content/browser/android/synchronous_compositor_host.cc
diff --git a/content/browser/android/synchronous_compositor_host.cc b/content/browser/android/synchronous_compositor_host.cc
index 4f2e1f07ecc53d4566156df09d699699a7f08a02..c0d33fbc765cfa4305ed9054b46c57b0c434746b 100644
--- a/content/browser/android/synchronous_compositor_host.cc
+++ b/content/browser/android/synchronous_compositor_host.cc
@@ -13,6 +13,7 @@
#include "base/trace_event/trace_event_argument.h"
#include "content/browser/android/synchronous_compositor_browser_filter.h"
#include "content/browser/renderer_host/render_widget_host_view_android.h"
+#include "content/browser/web_contents/web_contents_android.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/android/sync_compositor_messages.h"
#include "content/common/android/sync_compositor_statics.h"
@@ -31,23 +32,41 @@
namespace content {
// static
+void SynchronousCompositor::SetClientForWebContents(
+ WebContents* contents,
+ SynchronousCompositorClient* client) {
+ DCHECK(contents);
+ DCHECK(client);
+ WebContentsAndroid* web_contents_android =
+ static_cast<WebContentsImpl*>(contents)->GetWebContentsAndroid();
+ DCHECK(!web_contents_android->synchronous_compositor_client());
+ web_contents_android->set_synchronous_compositor_client(client);
+}
+
+// static
std::unique_ptr<SynchronousCompositorHost> SynchronousCompositorHost::Create(
- RenderWidgetHostViewAndroid* rwhva) {
- if (!rwhva->synchronous_compositor_client())
+ RenderWidgetHostViewAndroid* rwhva,
+ WebContents* web_contents) {
+ DCHECK(web_contents);
+ WebContentsAndroid* web_contents_android =
+ static_cast<WebContentsImpl*>(web_contents)->GetWebContentsAndroid();
+ if (!web_contents_android->synchronous_compositor_client())
return nullptr; // Not using sync compositing.
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
bool use_in_proc_software_draw =
command_line->HasSwitch(switches::kSingleProcess);
return base::WrapUnique(new SynchronousCompositorHost(
- rwhva, use_in_proc_software_draw));
+ rwhva, web_contents_android->synchronous_compositor_client(),
+ use_in_proc_software_draw));
}
SynchronousCompositorHost::SynchronousCompositorHost(
RenderWidgetHostViewAndroid* rwhva,
+ SynchronousCompositorClient* client,
bool use_in_proc_software_draw)
: rwhva_(rwhva),
- client_(rwhva->synchronous_compositor_client()),
+ client_(client),
ui_task_runner_(BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)),
process_id_(rwhva_->GetRenderWidgetHost()->GetProcess()->GetID()),
routing_id_(rwhva_->GetRenderWidgetHost()->GetRoutingID()),
« no previous file with comments | « content/browser/android/synchronous_compositor_host.h ('k') | content/browser/renderer_host/render_widget_host_view_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698