OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_ | |
6 #define SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "base/memory/weak_ptr.h" | |
10 #include "cc/surfaces/surface_id.h" | |
11 #include "mojo/services/gpu/public/interfaces/gpu.mojom.h" | |
12 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h" | |
13 #include "ui/gfx/native_widget_types.h" | |
14 #include "ui/gfx/size.h" | |
15 | |
16 namespace native_viewport { | |
17 | |
18 // This manages the surface that draws to a particular NativeViewport instance. | |
19 class ViewportSurface { | |
20 public: | |
21 ViewportSurface(mojo::SurfacePtr surface, | |
22 mojo::Gpu* gpu_service, | |
23 const gfx::Size& size, | |
24 cc::SurfaceId child_id); | |
25 ~ViewportSurface(); | |
26 | |
27 void SetWidgetId(uint64_t widget_id); | |
28 void SetSize(const gfx::Size& size); | |
29 void SetChildId(cc::SurfaceId child_id); | |
30 | |
31 private: | |
32 void BindSurfaceToNativeViewport(); | |
33 void SubmitFrame(); | |
34 | |
35 mojo::SurfacePtr surface_; | |
36 mojo::Gpu* gpu_service_; | |
37 uint64_t widget_id_; | |
38 gfx::Size size_; | |
39 bool gles2_bound_surface_created_; | |
40 cc::SurfaceId child_id_; | |
41 base::WeakPtrFactory<ViewportSurface> weak_factory_; | |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(ViewportSurface); | |
44 }; | |
45 | |
46 } // namespace native_viewport | |
47 | |
48 #endif // SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_ | |
OLD | NEW |