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

Side by Side Diff: android_webview/browser/surfaces_instance.h

Issue 2090903002: aw: Share cc::Display instance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: works Created 4 years, 6 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
(Empty)
1 // Copyright 2016 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 ANDROID_WEBVIEW_BROWSER_SURFACES_INSTANCE_H_
6 #define ANDROID_WEBVIEW_BROWSER_SURFACES_INSTANCE_H_
7
8 #include <memory>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h"
12 #include "cc/surfaces/display_client.h"
13 #include "cc/surfaces/surface_factory_client.h"
14 #include "cc/surfaces/surface_id.h"
15
16 namespace cc {
17 class Display;
18 class SurfaceIdAllocator;
19 class SurfaceFactory;
20 class SurfaceManager;
21 }
22
23 namespace gfx {
24 class Rect;
25 class Size;
26 class Transform;
27 }
28
29 namespace android_webview {
30
31 class AwGLSurface;
32 class ParentOutputSurface;
33 class ScopedAppGLStateRestore;
34
35 class SurfacesInstance : public base::RefCounted<SurfacesInstance>,
36 public cc::DisplayClient,
37 public cc::SurfaceFactoryClient {
38 public:
39 static scoped_refptr<SurfacesInstance> GetOrCreateInstance();
40
41 std::unique_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator();
42 cc::SurfaceManager* GetSurfaceManager();
43 void SetBackingFrameBufferObject(int framebuffer_binding_ext);
44
45 void DrawAndSwap(const gfx::Size& viewport,
46 const gfx::Rect& clip,
47 const gfx::Transform& transform,
48 const gfx::Size& frame_size,
49 const cc::SurfaceId& child_id,
50 const ScopedAppGLStateRestore& gl_state);
51
52 private:
53 friend class base::RefCounted<SurfacesInstance>;
54
55 SurfacesInstance();
56 ~SurfacesInstance() override;
57
58 // cc::DisplayClient overrides.
59 void DisplayOutputSurfaceLost() override {}
60 void DisplaySetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override {}
61
62 // cc::SurfaceFactoryClient implementation.
63 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
64 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
65
66 uint32_t next_surface_id_namespace_;
67
68 scoped_refptr<AwGLSurface> gl_surface_;
69 std::unique_ptr<cc::SurfaceManager> surface_manager_;
70 std::unique_ptr<cc::Display> display_;
71 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_;
72 std::unique_ptr<cc::SurfaceFactory> surface_factory_;
73
74 cc::SurfaceId root_id_;
75
76 // This is owned by |display_|.
77 ParentOutputSurface* output_surface_;
78
79 base::WeakPtrFactory<SurfacesInstance> weak_ptr_factory_;
80
81 DISALLOW_COPY_AND_ASSIGN(SurfacesInstance);
82 };
83
84 } // namespace android_webview
85
86 #endif // ANDROID_WEBVIEW_BROWSER_SURFACES_INSTANCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698