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

Unified Diff: components/view_manager/public/cpp/lib/view_surface.cc

Issue 1281663002: Mandoline: Allow submitting CompositorFrames directly to mojo::Views (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 4 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: components/view_manager/public/cpp/lib/view_surface.cc
diff --git a/components/view_manager/public/cpp/lib/view_surface.cc b/components/view_manager/public/cpp/lib/view_surface.cc
new file mode 100644
index 0000000000000000000000000000000000000000..17a0b23b6545cefd7a3594cbe06ff86cb4fa1083
--- /dev/null
+++ b/components/view_manager/public/cpp/lib/view_surface.cc
@@ -0,0 +1,46 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/view_manager/public/cpp/view_surface.h"
+
+#include "components/view_manager/public/cpp/view_surface_client.h"
+#include "mojo/converters/surfaces/surfaces_type_converters.h"
+
+namespace mojo {
+
+ViewSurface::~ViewSurface() {
+}
+
+void ViewSurface::BindToThread() {
+ DCHECK(!bound_to_thread_);
+ bound_to_thread_ = true;
+ surface_.Bind(surface_info_.Pass());
+ client_binding_.Bind(client_request_.Pass());
+}
+
+void ViewSurface::SubmitCompositorFrame(mojo::CompositorFramePtr frame) {
+ DCHECK(bound_to_thread_);
+ if (!surface_)
+ return;
+ surface_->SubmitCompositorFrame(frame.Pass(), mojo::Closure());
+}
+
+ViewSurface::ViewSurface(
+ mojo::InterfacePtrInfo<mojo::Surface> surface_info,
+ mojo::InterfaceRequest<mojo::SurfaceClient> client_request)
+ : client_(nullptr),
+ surface_info_(surface_info.Pass()),
+ client_request_(client_request.Pass()),
+ client_binding_(this),
+ bound_to_thread_(false) {
+}
+
+void ViewSurface::ReturnResources(
+ mojo::Array<mojo::ReturnedResourcePtr> resources) {
+ if (!client_)
+ return;
+ client_->OnResourcesReturned(this, resources.Pass());
+}
+
+} // namespace mojo
« no previous file with comments | « components/view_manager/public/cpp/lib/view.cc ('k') | components/view_manager/public/cpp/lib/view_tree_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698