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

Side by Side Diff: services/fake_surfaces/fake_surfaces_service_application.cc

Issue 807733002: Split surface id and simplify connecting to surfaces service (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/fake_surfaces/fake_surfaces_service_application.h" 5 #include "services/fake_surfaces/fake_surfaces_service_application.h"
6 6
7 #include "mojo/application/application_runner_chromium.h" 7 #include "mojo/application/application_runner_chromium.h"
8 #include "mojo/common/tracing_impl.h" 8 #include "mojo/common/tracing_impl.h"
9 #include "mojo/public/c/system/main.h" 9 #include "mojo/public/c/system/main.h"
10 #include "mojo/public/cpp/application/application_connection.h" 10 #include "mojo/public/cpp/application/application_connection.h"
11 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h" 11 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h"
12 12
13 using mojo::InterfaceRequest; 13 using mojo::InterfaceRequest;
14 14
15 namespace fake_surfaces { 15 namespace fake_surfaces {
16 16
17 class FakeSurfaceImpl : public mojo::Surface { 17 class FakeSurfaceImpl : public mojo::Surface {
18 public: 18 public:
19 FakeSurfaceImpl(uint32_t id_namespace, mojo::SurfacePtr* ptr) 19 FakeSurfaceImpl(uint32_t id_namespace, mojo::SurfacePtr* ptr)
20 : binding_(this, ptr) {} 20 : binding_(this, ptr) {
21 binding_.client()->SetIdNamespace(id_namespace);
22 }
21 ~FakeSurfaceImpl() override {} 23 ~FakeSurfaceImpl() override {}
22 24
23 // mojo::Surface implementation. 25 // mojo::Surface implementation.
24 void CreateSurface(mojo::SurfaceIdPtr id, mojo::SizePtr size) override {} 26 void CreateSurface(mojo::SurfaceIdPtr id) override {}
25 27
26 void SubmitFrame(mojo::SurfaceIdPtr id, 28 void SubmitFrame(mojo::SurfaceIdPtr id,
27 mojo::FramePtr frame, 29 mojo::FramePtr frame,
28 const mojo::Closure& callback) override { 30 const mojo::Closure& callback) override {
29 callback.Run(); 31 callback.Run();
30 if (frame->resources.size() == 0u) 32 if (frame->resources.size() == 0u)
31 return; 33 return;
32 mojo::Array<mojo::ReturnedResourcePtr> returned; 34 mojo::Array<mojo::ReturnedResourcePtr> returned;
33 returned.resize(frame->resources.size()); 35 returned.resize(frame->resources.size());
34 for (size_t i = 0; i < frame->resources.size(); ++i) { 36 for (size_t i = 0; i < frame->resources.size(); ++i) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 new FakeSurfacesServiceImpl(&next_id_namespace_, request.Pass()); 107 new FakeSurfacesServiceImpl(&next_id_namespace_, request.Pass());
106 } 108 }
107 109
108 } // namespace fake_surfaces 110 } // namespace fake_surfaces
109 111
110 MojoResult MojoMain(MojoHandle shell_handle) { 112 MojoResult MojoMain(MojoHandle shell_handle) {
111 mojo::ApplicationRunnerChromium runner( 113 mojo::ApplicationRunnerChromium runner(
112 new fake_surfaces::FakeSurfacesServiceApplication); 114 new fake_surfaces::FakeSurfacesServiceApplication);
113 return runner.Run(shell_handle); 115 return runner.Run(shell_handle);
114 } 116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698