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); |
sky
2014/08/27 21:44:14
nit: no _t, the _t types are deprecated.
|
+ 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_ |