Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_ | 5 #ifndef SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_ |
| 6 #define SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_ | 6 #define SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "cc/surfaces/surface_id.h" | 10 #include "cc/surfaces/surface_id.h" |
| 11 #include "mojo/services/gpu/public/interfaces/gpu.mojom.h" | 11 #include "mojo/services/gpu/public/interfaces/gpu.mojom.h" |
| 12 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h" | 12 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h" |
| 13 #include "mojo/services/surfaces/public/interfaces/surfaces_service.mojom.h" | 13 #include "mojo/services/surfaces/public/interfaces/surfaces_service.mojom.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
| 16 | 16 |
| 17 namespace cc { | |
| 18 class SurfaceIdAllocator; | |
| 19 } | |
| 20 | |
| 21 namespace native_viewport { | 17 namespace native_viewport { |
| 22 | 18 |
| 23 // This manages the surface that draws to a particular NativeViewport instance. | 19 // This manages the surface that draws to a particular NativeViewport instance. |
| 24 class ViewportSurface : public mojo::SurfaceClient { | 20 class ViewportSurface : public mojo::SurfaceClient { |
| 25 public: | 21 public: |
| 26 ViewportSurface(mojo::SurfacesService* surfaces_service, | 22 ViewportSurface(mojo::SurfacePtr surface, |
| 27 mojo::Gpu* gpu_service, | 23 mojo::Gpu* gpu_service, |
| 28 const gfx::Size& size, | 24 const gfx::Size& size, |
| 29 cc::SurfaceId child_id); | 25 cc::SurfaceId child_id); |
| 30 ~ViewportSurface() override; | 26 ~ViewportSurface() override; |
| 31 | 27 |
| 32 void SetWidgetId(uint64_t widget_id); | 28 void SetWidgetId(uint64_t widget_id); |
| 33 void SetSize(const gfx::Size& size); | 29 void SetSize(const gfx::Size& size); |
| 34 void SetChildId(cc::SurfaceId child_id); | 30 void SetChildId(cc::SurfaceId child_id); |
| 35 | 31 |
| 36 private: | 32 private: |
| 37 void OnSurfaceConnectionCreated(mojo::SurfacePtr surface, | |
| 38 uint32_t id_namespace); | |
| 39 void BindSurfaceToNativeViewport(); | 33 void BindSurfaceToNativeViewport(); |
| 40 void SubmitFrame(); | 34 void SubmitFrame(); |
| 41 | 35 |
| 42 // SurfaceClient implementation. | 36 // SurfaceClient implementation. |
| 43 void SetIdNamespace(uint32_t id_namespace) override; | 37 void SetIdNamespace(uint32_t id_namespace) override; |
| 44 void ReturnResources( | 38 void ReturnResources( |
| 45 mojo::Array<mojo::ReturnedResourcePtr> resources) override; | 39 mojo::Array<mojo::ReturnedResourcePtr> resources) override; |
| 46 | 40 |
| 47 mojo::SurfacePtr surface_; | 41 mojo::SurfacePtr surface_; |
| 48 mojo::Gpu* gpu_service_; | 42 mojo::Gpu* gpu_service_; |
| 49 uint64_t widget_id_; | 43 uint64_t widget_id_; |
| 50 gfx::Size size_; | 44 gfx::Size size_; |
| 51 scoped_ptr<cc::SurfaceIdAllocator> id_allocator_; | 45 bool gles2_bound_surface_created_; |
|
sky
2015/01/13 18:14:27
Initialize this.
jamesr
2015/01/14 01:50:29
Done.
| |
| 52 cc::SurfaceId id_; | |
| 53 cc::SurfaceId child_id_; | 46 cc::SurfaceId child_id_; |
| 54 base::WeakPtrFactory<ViewportSurface> weak_factory_; | 47 base::WeakPtrFactory<ViewportSurface> weak_factory_; |
| 55 | 48 |
| 56 DISALLOW_COPY_AND_ASSIGN(ViewportSurface); | 49 DISALLOW_COPY_AND_ASSIGN(ViewportSurface); |
| 57 }; | 50 }; |
| 58 | 51 |
| 59 } // namespace native_viewport | 52 } // namespace native_viewport |
| 60 | 53 |
| 61 #endif // SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_ | 54 #endif // SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_ |
| OLD | NEW |