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

Unified Diff: content/renderer/mus/renderer_window_tree_client.cc

Issue 2764433003: mus-ws: Plumb FrameSinkId to Children (Closed)
Patch Set: Addressed Antoine's comment Created 3 years, 9 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/mus/renderer_window_tree_client.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/mus/renderer_window_tree_client.cc
diff --git a/content/renderer/mus/renderer_window_tree_client.cc b/content/renderer/mus/renderer_window_tree_client.cc
index 44474e0fc9c520c6a5df92555d99dd63c40c1b44..6940056d099c683b4b6484a9bfaa15012dffb471 100644
--- a/content/renderer/mus/renderer_window_tree_client.cc
+++ b/content/renderer/mus/renderer_window_tree_client.cc
@@ -41,6 +41,27 @@ void RendererWindowTreeClient::Destroy(int routing_id) {
client->DestroySelf();
}
+void RendererWindowTreeClient::Bind(
+ ui::mojom::WindowTreeClientRequest request) {
+ binding_.Bind(std::move(request));
+}
+
+void RendererWindowTreeClient::RequestCompositorFrameSink(
+ scoped_refptr<cc::ContextProvider> context_provider,
+ gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ const CompositorFrameSinkCallback& callback) {
+ DCHECK(pending_compositor_frame_sink_callback_.is_null());
+ if (frame_sink_id_.is_valid()) {
+ RequestCompositorFrameSinkInternal(std::move(context_provider),
+ gpu_memory_buffer_manager, callback);
+ return;
+ }
+
+ pending_context_provider_ = std::move(context_provider);
+ pending_gpu_memory_buffer_manager_ = gpu_memory_buffer_manager;
+ pending_compositor_frame_sink_callback_ = callback;
+}
+
RendererWindowTreeClient::RendererWindowTreeClient(int routing_id)
: routing_id_(routing_id), binding_(this) {}
@@ -48,28 +69,18 @@ RendererWindowTreeClient::~RendererWindowTreeClient() {
g_connections.Get().erase(routing_id_);
}
-void RendererWindowTreeClient::Bind(
- ui::mojom::WindowTreeClientRequest request) {
- binding_.Bind(std::move(request));
-}
-
-std::unique_ptr<cc::CompositorFrameSink>
-RendererWindowTreeClient::CreateCompositorFrameSink(
- const cc::FrameSinkId& frame_sink_id,
+void RendererWindowTreeClient::RequestCompositorFrameSinkInternal(
scoped_refptr<cc::ContextProvider> context_provider,
- gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) {
+ gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ const CompositorFrameSinkCallback& callback) {
std::unique_ptr<ui::ClientCompositorFrameSinkBinding> frame_sink_binding;
auto frame_sink = ui::ClientCompositorFrameSink::Create(
- frame_sink_id, std::move(context_provider), gpu_memory_buffer_manager,
+ frame_sink_id_, std::move(context_provider), gpu_memory_buffer_manager,
&frame_sink_binding);
- if (tree_) {
- tree_->AttachCompositorFrameSink(
- root_window_id_, frame_sink_binding->TakeFrameSinkRequest(),
- mojo::MakeProxy(frame_sink_binding->TakeFrameSinkClient()));
- } else {
- pending_frame_sink_ = std::move(frame_sink_binding);
- }
- return std::move(frame_sink);
+ tree_->AttachCompositorFrameSink(
+ root_window_id_, frame_sink_binding->TakeFrameSinkRequest(),
+ mojo::MakeProxy(frame_sink_binding->TakeFrameSinkClient()));
+ callback.Run(std::move(frame_sink));
}
void RendererWindowTreeClient::DestroySelf() {
@@ -81,14 +92,18 @@ void RendererWindowTreeClient::OnEmbed(ui::ClientSpecificId client_id,
ui::mojom::WindowTreePtr tree,
int64_t display_id,
ui::Id focused_window_id,
- bool drawn) {
+ bool drawn,
+ const cc::FrameSinkId& frame_sink_id) {
+ frame_sink_id_ = frame_sink_id;
root_window_id_ = root->window_id;
tree_ = std::move(tree);
- if (pending_frame_sink_) {
- tree_->AttachCompositorFrameSink(
- root_window_id_, pending_frame_sink_->TakeFrameSinkRequest(),
- mojo::MakeProxy(pending_frame_sink_->TakeFrameSinkClient()));
- pending_frame_sink_ = nullptr;
+ if (!pending_compositor_frame_sink_callback_.is_null()) {
+ RequestCompositorFrameSinkInternal(std::move(pending_context_provider_),
+ pending_gpu_memory_buffer_manager_,
+ pending_compositor_frame_sink_callback_);
+ pending_context_provider_ = nullptr;
+ pending_gpu_memory_buffer_manager_ = nullptr;
+ pending_compositor_frame_sink_callback_.Reset();
}
}
@@ -104,10 +119,12 @@ void RendererWindowTreeClient::OnUnembed(ui::Id window_id) {
void RendererWindowTreeClient::OnCaptureChanged(ui::Id new_capture_window_id,
ui::Id old_capture_window_id) {}
-void RendererWindowTreeClient::OnTopLevelCreated(uint32_t change_id,
- ui::mojom::WindowDataPtr data,
- int64_t display_id,
- bool drawn) {
+void RendererWindowTreeClient::OnTopLevelCreated(
+ uint32_t change_id,
+ ui::mojom::WindowDataPtr data,
+ int64_t display_id,
+ bool drawn,
+ const cc::FrameSinkId& frame_sink_id) {
NOTREACHED();
}
« no previous file with comments | « content/renderer/mus/renderer_window_tree_client.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698