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

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_impl.h

Issue 1838853005: android: Remove in-process sync compositor code path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_in_proc_video
Patch Set: rebase Created 4 years, 8 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 2013 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 CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_
6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_
7
8 #include <stddef.h>
9
10 #include <memory>
11 #include <vector>
12
13 #include "base/compiler_specific.h"
14 #include "base/macros.h"
15 #include "content/browser/android/synchronous_compositor_base.h"
16 #include "content/renderer/android/synchronous_compositor_external_begin_frame_s ource.h"
17 #include "content/renderer/android/synchronous_compositor_output_surface.h"
18 #include "ipc/ipc_message.h"
19 #include "ui/events/blink/synchronous_input_handler_proxy.h"
20
21 namespace cc {
22 class InputHandler;
23 }
24
25 namespace content {
26 class InputHandlerManager;
27 class RenderWidgetHostViewAndroid;
28 class SynchronousCompositorExternalBeginFrameSource;
29 struct DidOverscrollParams;
30
31 // The purpose of this class is to act as the intermediary between the various
32 // components that make up the 'synchronous compositor mode' implementation and
33 // expose their functionality via the SynchronousCompositor interface.
34 // This class is created on the main thread but most of the APIs are called
35 // from the Compositor thread.
36 class SynchronousCompositorImpl
37 : public ui::SynchronousInputHandler,
38 public SynchronousCompositorBase,
39 public SynchronousCompositorExternalBeginFrameSourceClient,
40 public SynchronousCompositorOutputSurfaceClient {
41 public:
42 // For handling upcalls from renderer code; the process id
43 // is implicitly that of the in-process renderer.
44 static SynchronousCompositorImpl* FromRoutingID(int routing_id);
45
46 ~SynchronousCompositorImpl() override;
47
48 // Called by SynchronousCompositorRegistry.
49 void DidInitializeRendererObjects(
50 SynchronousCompositorOutputSurface* output_surface,
51 SynchronousCompositorExternalBeginFrameSource* begin_frame_source,
52 ui::SynchronousInputHandlerProxy* synchronous_input_handler_proxy);
53 void DidDestroyRendererObjects();
54
55 // SynchronousCompositorExternalBeginFrameSourceClient overrides.
56 void OnNeedsBeginFramesChange(bool needs_begin_frames) override;
57
58 // SynchronousCompositorOutputSurfaceClient overrides.
59 void Invalidate() override;
60 void SwapBuffers(uint32_t output_surface_id,
61 cc::CompositorFrame* frame) override;
62
63 // SynchronousCompositor overrides.
64 SynchronousCompositor::Frame DemandDrawHw(
65 const gfx::Size& surface_size,
66 const gfx::Transform& transform,
67 const gfx::Rect& viewport,
68 const gfx::Rect& clip,
69 const gfx::Rect& viewport_rect_for_tile_priority,
70 const gfx::Transform& transform_for_tile_priority) override;
71 bool DemandDrawSw(SkCanvas* canvas) override;
72 void ReturnResources(uint32_t output_surface_id,
73 const cc::CompositorFrameAck& frame_ack) override;
74 void SetMemoryPolicy(size_t bytes_limit) override;
75 void DidChangeRootLayerScrollOffset(
76 const gfx::ScrollOffset& root_offset) override;
77 void SynchronouslyZoomBy(float zoom_delta, const gfx::Point& anchor) override;
78 void SetIsActive(bool is_active) override;
79 void OnComputeScroll(base::TimeTicks animation_time) override;
80
81 // SynchronousCompositorBase overrides.
82 void BeginFrame(const cc::BeginFrameArgs& args) override;
83 InputEventAckState HandleInputEvent(
84 const blink::WebInputEvent& input_event) override;
85 void DidOverscroll(const DidOverscrollParams& params) override;
86 bool OnMessageReceived(const IPC::Message& message) override;
87 void DidBecomeCurrent() override;
88
89 // SynchronousInputHandler
90 void SetNeedsSynchronousAnimateInput() override;
91 void UpdateRootLayerState(const gfx::ScrollOffset& total_scroll_offset,
92 const gfx::ScrollOffset& max_scroll_offset,
93 const gfx::SizeF& scrollable_size,
94 float page_scale_factor,
95 float min_page_scale_factor,
96 float max_page_scale_factor) override;
97
98 void DidOverscrollInProcess(const DidOverscrollParams& params);
99 void DidStopFlinging();
100
101 private:
102 friend class SynchronousCompositorBase;
103 SynchronousCompositorImpl(RenderWidgetHostViewAndroid* rwhva,
104 SynchronousCompositorClient* client);
105 void RegisterWithClient();
106 void UpdateFrameMetaData(const cc::CompositorFrameMetadata& frame_info);
107 void DidActivatePendingTree();
108 void DeliverMessages();
109 bool CalledOnValidThread() const;
110 void UpdateNeedsBeginFrames();
111
112 RenderWidgetHostViewAndroid* const rwhva_;
113 const int routing_id_;
114 SynchronousCompositorClient* const compositor_client_;
115 SynchronousCompositorOutputSurface* output_surface_;
116 SynchronousCompositorExternalBeginFrameSource* begin_frame_source_;
117 ui::SynchronousInputHandlerProxy* synchronous_input_handler_proxy_;
118 bool registered_with_client_;
119 bool is_active_;
120 bool renderer_needs_begin_frames_;
121 bool need_animate_input_;
122 SynchronousCompositor::Frame frame_holder_;
123
124 base::WeakPtrFactory<SynchronousCompositorImpl> weak_ptr_factory_;
125
126 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorImpl);
127 };
128
129 } // namespace content
130
131 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698