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

Unified Diff: services/fake_surfaces/fake_surfaces_service_application.cc

Issue 826423008: Use local ids for Surfaces APIs that can only apply to local surfaces (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 70e4aa33eeb0ef52d6654d0df32720e17d063c02..6ee37def56956e88b45c644bb639a4f40ad88f07 100644
--- a/services/fake_surfaces/fake_surfaces_service_application.cc
+++ b/services/fake_surfaces/fake_surfaces_service_application.cc
@@ -16,16 +16,17 @@ namespace fake_surfaces {
class FakeSurfaceImpl : public mojo::Surface {
public:
- FakeSurfaceImpl(uint32_t id_namespace, mojo::SurfacePtr* ptr)
- : binding_(this, ptr) {
+ FakeSurfaceImpl(uint32_t id_namespace,
+ mojo::InterfaceRequest<mojo::Surface> request)
+ : binding_(this, request.Pass()) {
binding_.client()->SetIdNamespace(id_namespace);
}
~FakeSurfaceImpl() override {}
// mojo::Surface implementation.
- void CreateSurface(mojo::SurfaceIdPtr id) override {}
+ void CreateSurface(uint32_t local_id) override {}
- void SubmitFrame(mojo::SurfaceIdPtr id,
+ void SubmitFrame(uint32_t local_id,
mojo::FramePtr frame,
const mojo::Closure& callback) override {
callback.Run();
@@ -44,15 +45,14 @@ class FakeSurfaceImpl : public mojo::Surface {
binding_.client()->ReturnResources(returned.Pass());
}
- void DestroySurface(mojo::SurfaceIdPtr id) override {}
+ void DestroySurface(uint32_t local_id) override {}
void CreateGLES2BoundSurface(
mojo::CommandBufferPtr gles2_client,
- mojo::SurfaceIdPtr id,
+ uint32_t local_id,
mojo::SizePtr size,
mojo::InterfaceRequest<mojo::ViewportParameterListener> listener_request)
- override {
- }
+ override {}
private:
mojo::StrongBinding<mojo::Surface> binding_;
@@ -73,7 +73,7 @@ class FakeSurfacesServiceImpl : public mojo::SurfacesService {
override {
mojo::SurfacePtr surface;
uint32_t id_namespace = (*next_id_namespace_)++;
- new FakeSurfaceImpl(id_namespace, &surface);
+ new FakeSurfaceImpl(id_namespace, GetProxy(&surface));
callback.Run(surface.Pass(), id_namespace);
}
@@ -97,7 +97,8 @@ void FakeSurfacesServiceApplication::Initialize(mojo::ApplicationImpl* app) {
bool FakeSurfacesServiceApplication::ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) {
- connection->AddService(this);
+ connection->AddService<mojo::SurfacesService>(this);
+ connection->AddService<mojo::Surface>(this);
return true;
}
@@ -107,6 +108,12 @@ void FakeSurfacesServiceApplication::Create(
new FakeSurfacesServiceImpl(&next_id_namespace_, request.Pass());
}
+void FakeSurfacesServiceApplication::Create(
+ mojo::ApplicationConnection* connection,
+ InterfaceRequest<mojo::Surface> request) {
+ new FakeSurfaceImpl(next_id_namespace_++, request.Pass());
+}
+
} // namespace fake_surfaces
MojoResult MojoMain(MojoHandle shell_handle) {
« no previous file with comments | « services/fake_surfaces/fake_surfaces_service_application.h ('k') | services/native_viewport/native_viewport_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698