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

Unified Diff: services/fake_surfaces/fake_surfaces_service_application.cc

Issue 871373015: De-Client Surface interface (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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: services/fake_surfaces/fake_surfaces_service_application.cc
diff --git a/services/fake_surfaces/fake_surfaces_service_application.cc b/services/fake_surfaces/fake_surfaces_service_application.cc
index 56508f6dcbf4c8120e51996165ff20961bf6179e..a62e5ea9b23c60561c5747de0fee5f0baea73a06 100644
--- a/services/fake_surfaces/fake_surfaces_service_application.cc
+++ b/services/fake_surfaces/fake_surfaces_service_application.cc
@@ -18,19 +18,26 @@ class FakeSurfaceImpl : public mojo::Surface {
public:
FakeSurfaceImpl(uint32_t id_namespace,
mojo::InterfaceRequest<mojo::Surface> request)
- : binding_(this, request.Pass()) {
- binding_.client()->SetIdNamespace(id_namespace);
- }
+ : id_namespace_(id_namespace), binding_(this, request.Pass()) {}
~FakeSurfaceImpl() override {}
// mojo::Surface implementation.
+ void GetIdNamespace(
+ const Surface::GetIdNamespaceCallback& callback) override {
+ callback.Run(id_namespace_);
+ }
+
+ void SetResourceReturner(mojo::ResourceReturnerPtr returner) override {
+ returner_ = returner.Pass();
+ }
+
void CreateSurface(uint32_t local_id) override {}
void SubmitFrame(uint32_t local_id,
mojo::FramePtr frame,
const mojo::Closure& callback) override {
callback.Run();
- if (frame->resources.size() == 0u)
+ if (frame->resources.size() == 0u || !returner_)
return;
mojo::Array<mojo::ReturnedResourcePtr> returned;
returned.resize(frame->resources.size());
@@ -42,7 +49,7 @@ class FakeSurfaceImpl : public mojo::Surface {
ret->lost = false;
returned[i] = ret.Pass();
}
- binding_.client()->ReturnResources(returned.Pass());
+ returner_->ReturnResources(returned.Pass());
}
void DestroySurface(uint32_t local_id) override {}
@@ -55,6 +62,8 @@ class FakeSurfaceImpl : public mojo::Surface {
override {}
private:
+ uint32_t id_namespace_;
sky 2015/01/31 01:25:28 nit: const.
+ mojo::ResourceReturnerPtr returner_;
mojo::StrongBinding<mojo::Surface> binding_;
DISALLOW_COPY_AND_ASSIGN(FakeSurfaceImpl);

Powered by Google App Engine
This is Rietveld 408576698