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

Unified Diff: mojo/services/native_viewport/viewport_surface.h

Issue 510553002: Teach the native viewport service to draw a Surface into itself (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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: mojo/services/native_viewport/viewport_surface.h
diff --git a/mojo/services/native_viewport/viewport_surface.h b/mojo/services/native_viewport/viewport_surface.h
new file mode 100644
index 0000000000000000000000000000000000000000..f582907d7fe4633842fde2b99364554634e72bcc
--- /dev/null
+++ b/mojo/services/native_viewport/viewport_surface.h
@@ -0,0 +1,58 @@
+// 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 MOJO_SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_
+#define MOJO_SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "cc/surfaces/surface_id.h"
+#include "mojo/services/public/interfaces/gpu/gpu.mojom.h"
+#include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h"
+#include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h"
+#include "ui/gfx/native_widget_types.h"
+#include "ui/gfx/rect.h"
+
+namespace cc {
+class SurfaceIdAllocator;
+}
+
+namespace mojo {
+
+// This manages the surface that draws to a particular NativeViewport instance.
+class ViewportSurface : public SurfaceClient {
+ public:
+ ViewportSurface(SurfacesService* surfaces_service,
+ Gpu* gpu_service,
+ const gfx::Rect& bounds,
+ cc::SurfaceId child_id);
+ virtual ~ViewportSurface();
+
+ void SetWidgetId(uint64_t widget_id);
+ void SetBounds(const gfx::Rect& bounds);
+ void SetChildId(cc::SurfaceId child_id);
+
+ private:
+ void OnSurfaceConnectionCreated(SurfacePtr surface, uint32_t id_namespace);
+ void BindSurfaceToNativeViewport();
+ void SubmitFrame();
+
+ // SurfaceClient implementation.
+ virtual void ReturnResources(Array<ReturnedResourcePtr> resources) OVERRIDE;
+
+ SurfacePtr surface_;
+ Gpu* gpu_service_;
+ uint64_t widget_id_;
+ gfx::Rect bounds_;
+ scoped_ptr<cc::SurfaceIdAllocator> id_allocator_;
+ cc::SurfaceId id_;
+ cc::SurfaceId child_id_;
+ base::WeakPtrFactory<ViewportSurface> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ViewportSurface);
+};
+
+} // namespace mojo
+
+#endif // MOJO_SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_
« no previous file with comments | « mojo/services/native_viewport/native_viewport_impl.cc ('k') | mojo/services/native_viewport/viewport_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698