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

Unified Diff: sky/compositor/surface_holder.h

Issue 740923002: Add a simple compositor for Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address reviewer comments Created 6 years, 1 month 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: sky/compositor/surface_holder.h
diff --git a/sky/compositor/surface_holder.h b/sky/compositor/surface_holder.h
new file mode 100644
index 0000000000000000000000000000000000000000..ee352edb4ce0c535b9c6fa55cce2184b719a532e
--- /dev/null
+++ b/sky/compositor/surface_holder.h
@@ -0,0 +1,63 @@
+// Copyright 2014 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.
+
+#ifndef SKY_COMPOSITOR_SURFACE_HOLDER_H_
+#define SKY_COMPOSITOR_SURFACE_HOLDER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h"
+#include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h"
+#include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h"
+#include "ui/gfx/geometry/rect.h"
+
+namespace mojo {
+class Shell;
+}
+
+namespace sky {
+class SurfaceAllocator;
+
+class SurfaceHolder : public mojo::SurfaceClient {
+ public:
+ class Client {
+ public:
+ virtual void OnReadyForNextFrame() = 0;
+ virtual void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) = 0;
+ virtual void ReturnResources(
+ mojo::Array<mojo::ReturnedResourcePtr> resources) = 0;
+
+ protected:
+ virtual ~Client();
+ };
+
+ explicit SurfaceHolder(Client* client, mojo::Shell* shell);
+ ~SurfaceHolder() override;
+
+ void SetSize(const gfx::Size& size);
+ void SubmitFrame(mojo::FramePtr frame);
+
+ private:
+ // mojo::SurfaceClient
+ void ReturnResources(
+ mojo::Array<mojo::ReturnedResourcePtr> resources) override;
+
+ void OnSurfaceConnectionCreated(mojo::SurfacePtr surface,
+ uint32_t id_namespace);
+
+ Client* client_;
+ gfx::Size size_;
+ scoped_ptr<SurfaceAllocator> surface_allocator_;
+ mojo::SurfacesServicePtr surfaces_service_;
+ mojo::SurfacePtr surface_;
+ mojo::SurfaceIdPtr surface_id_;
+
+ base::WeakPtrFactory<SurfaceHolder> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(SurfaceHolder);
+};
+
+} // namespace sky
+
+#endif // SKY_COMPOSITOR_SURFACE_HOLDER_H_

Powered by Google App Engine
This is Rietveld 408576698