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

Side by Side Diff: ui/android/delegated_frame_host_android.h

Issue 2133873004: content: Move Surfaces related code out of RWHVA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 4 years, 4 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 UI_ANDROID_DELEGATED_FRAME_HOST_ANDROID_H_
6 #define UI_ANDROID_DELEGATED_FRAME_HOST_ANDROID_H_
7
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "cc/resources/returned_resource.h"
11 #include "cc/surfaces/surface_factory.h"
12 #include "cc/surfaces/surface_factory_client.h"
13 #include "ui/android/ui_android_export.h"
14 #include "ui/gfx/selection_bound.h"
15
16 namespace cc {
17
18 class CompositorFrame;
19 class Layer;
20 class SurfaceId;
21 class SurfaceManager;
22 class SurfaceLayer;
23 class SurfaceIdAllocator;
24 enum class SurfaceDrawStatus;
25
26 } // namespace cc
27
28 namespace ui {
29 class ViewAndroid;
30
31 class UI_ANDROID_EXPORT DelegatedFrameHostAndroid
32 : public cc::SurfaceFactoryClient {
33 public:
34 using ReturnResourcesCallback =
35 base::Callback<void(const cc::ReturnedResourceArray&)>;
36
37 DelegatedFrameHostAndroid(ViewAndroid* view,
38 SkColor background_color,
39 ReturnResourcesCallback return_resources_callback);
40
41 ~DelegatedFrameHostAndroid();
42
43 void SubmitCompositorFrame(cc::CompositorFrame frame,
44 cc::SurfaceFactory::DrawCallback draw_callback);
45
46 void DestroyDelegatedContent();
47
48 uint32_t GetSurfaceClientId() const;
49
50 // Should only be called when the host has a content layer.
51 void RequestCopyOfSurface(
52 std::unique_ptr<cc::CopyOutputRequest> copy_output_request);
53
54 void OutputSurfaceChanged();
55
56 void UpdateBackgroundColor(SkColor color);
57
58 void UpdateSize(const gfx::Size& desired_content_size);
no sievers 2016/08/12 19:33:04 nit: can you call this 'UpdateContainerSize()'?
Khushal 2016/08/16 01:34:23 Done.
59
60 // Returns the layer holding the content from the renderer. Can be null.
61 cc::Layer* GetContentLayer() const;
62
63 private:
64 // cc::SurfaceFactoryClient implementation.
65 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
66 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
67
68 void CreateContentLayer();
69 void DestroyContentLayer();
70
71 void UpdateBackgroundLayer();
72
73 ViewAndroid* view_;
74
75 cc::SurfaceManager* surface_manager_;
76 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_;
77 ReturnResourcesCallback return_resources_callback_;
78
79 std::unique_ptr<cc::SurfaceFactory> surface_factory_;
80 cc::SurfaceId surface_id_;
81 gfx::Size current_surface_size_;
82 gfx::Vector2dF location_bar_content_translation_;
83 cc::Selection<gfx::SelectionBound> current_viewport_selection_;
84
85 scoped_refptr<cc::SurfaceLayer> content_layer_;
86
87 scoped_refptr<cc::Layer> background_layer_;
88
89 gfx::Size desired_content_size_;
90
91 DISALLOW_COPY_AND_ASSIGN(DelegatedFrameHostAndroid);
92 };
93
94 } // namespace ui
95
96 #endif // UI_ANDROID_DELEGATED_FRAME_HOST_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698