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

Side by Side Diff: services/native_viewport/viewport_surface.h

Issue 871373015: De-Client Surface interface (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
OLDNEW
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 "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
14 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
15 15
16 namespace native_viewport { 16 namespace native_viewport {
17 17
18 // This manages the surface that draws to a particular NativeViewport instance. 18 // This manages the surface that draws to a particular NativeViewport instance.
19 class ViewportSurface : public mojo::SurfaceClient { 19 class ViewportSurface {
20 public: 20 public:
21 ViewportSurface(mojo::SurfacePtr surface, 21 ViewportSurface(mojo::SurfacePtr surface,
22 mojo::Gpu* gpu_service, 22 mojo::Gpu* gpu_service,
23 const gfx::Size& size, 23 const gfx::Size& size,
24 cc::SurfaceId child_id); 24 cc::SurfaceId child_id);
25 ~ViewportSurface() override; 25 ~ViewportSurface();
26 26
27 void SetWidgetId(uint64_t widget_id); 27 void SetWidgetId(uint64_t widget_id);
28 void SetSize(const gfx::Size& size); 28 void SetSize(const gfx::Size& size);
29 void SetChildId(cc::SurfaceId child_id); 29 void SetChildId(cc::SurfaceId child_id);
30 30
31 private: 31 private:
32 void BindSurfaceToNativeViewport(); 32 void BindSurfaceToNativeViewport();
33 void SubmitFrame(); 33 void SubmitFrame();
34 34
35 // SurfaceClient implementation.
36 void SetIdNamespace(uint32_t id_namespace) override;
37 void ReturnResources(
38 mojo::Array<mojo::ReturnedResourcePtr> resources) override;
39
40 mojo::SurfacePtr surface_; 35 mojo::SurfacePtr surface_;
41 mojo::Gpu* gpu_service_; 36 mojo::Gpu* gpu_service_;
42 uint64_t widget_id_; 37 uint64_t widget_id_;
43 gfx::Size size_; 38 gfx::Size size_;
44 bool gles2_bound_surface_created_; 39 bool gles2_bound_surface_created_;
45 cc::SurfaceId child_id_; 40 cc::SurfaceId child_id_;
46 base::WeakPtrFactory<ViewportSurface> weak_factory_; 41 base::WeakPtrFactory<ViewportSurface> weak_factory_;
47 42
48 DISALLOW_COPY_AND_ASSIGN(ViewportSurface); 43 DISALLOW_COPY_AND_ASSIGN(ViewportSurface);
49 }; 44 };
50 45
51 } // namespace native_viewport 46 } // namespace native_viewport
52 47
53 #endif // SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_ 48 #endif // SERVICES_NATIVE_VIEWPORT_VIEWPORT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698