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

Unified Diff: components/view_manager/public/cpp/lib/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 + added uip::Surface 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/surface.cc
diff --git a/components/view_manager/public/cpp/lib/surface.cc b/components/view_manager/public/cpp/lib/surface.cc
new file mode 100644
index 0000000000000000000000000000000000000000..22e6b4528a236035ed0d6a54f9c81c18723d78b2
--- /dev/null
+++ b/components/view_manager/public/cpp/lib/surface.cc
@@ -0,0 +1,43 @@
+// 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/surface.h"
+
+#include "components/view_manager/public/cpp/surface_client.h"
+#include "mojo/converters/surfaces/surfaces_type_converters.h"
+
+namespace uip {
+
+Surface::~Surface() {
+}
+
+void Surface::BindToThread() {
+ DCHECK(!bound_to_thread_);
+ bound_to_thread_ = true;
+ surface_.Bind(surface_info_.Pass());
+ client_binding_.Bind(client_request_.Pass());
+}
+
+void Surface::SubmitCompositorFrame(mojo::CompositorFramePtr frame) {
+ DCHECK(bound_to_thread_);
+ surface_->SubmitCompositorFrame(frame.Pass(), mojo::Closure());
+}
+
+Surface::Surface(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 Surface::ReturnResources(
+ mojo::Array<mojo::ReturnedResourcePtr> resources) {
+ if (!client_)
+ return;
+ client_->OnResourcesReturned(this, resources.Pass());
+}
+
+} // namespace uip

Powered by Google App Engine
This is Rietveld 408576698